home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / tlx501.zip / SRC / WC / MAKEFILE next >
Text File  |  1995-01-11  |  12KB  |  479 lines

  1. ##############################################################################
  2. #   $Id: makefile 1.1 1995/01/11 19:37:58 ron Exp $
  3. #
  4. #   Copyright (C) 1990-94 Tarma Software Research. All rights reserved.
  5. #
  6. #   Project:    Tarma Library for C++ V5.0
  7. #   Author:    Ron van der Wal
  8. #
  9. #   MAKEFILE for Tarma Library for C++, compiler versions:
  10. #
  11. #   - Watcom C++ 10.0 for DOS, Windows and OS/2
  12. #
  13. #   Syntax depends on the target platform, as follows:
  14. #
  15. #   - DOS:    MAKE -DDOS [-DEBUG] [M=(t|s|c|m|l|h)] [flags..]
  16. #   - OS/2:    MAKE -DOS2 [-DEBUG] [-DLL] [flags..]
  17. #   - Windows:    MAKE -DWIN [-DEBUG] [-DLL] [M=(s|c|m|l)] [flags..]
  18. #
  19. #   $Log: makefile $
  20.     Revision 1.1  1995/01/11  19:37:58  ron
  21.     Initial revision
  22.     
  23. ##############################################################################
  24.  
  25. #-----------------------------------------------------------------------------
  26. #    MAKE parameters
  27. #-----------------------------------------------------------------------------
  28.  
  29. !if !$d(DOS) && !$d(OS2) && !$d(WIN)
  30.  
  31. !if $d(__MSDOS__)
  32. DOS    = 1
  33. !elif $d(__OS2__)
  34. OS2    = 1
  35. !else
  36. !error Must specify -DDOS, -DOS2, or -DWIN
  37. !endif
  38.  
  39. !endif
  40.  
  41. #-----------------------------------------------------------------------------
  42. #    TLX version number (used with DLLs)
  43. #-----------------------------------------------------------------------------
  44.  
  45. TLXVER    = 500        # TLX version number
  46.  
  47. !ifndef PROJLEVEL
  48. PROJLEVEL = Experimental
  49. !endif
  50.  
  51. #-----------------------------------------------------------------------------
  52. #    Compiler information
  53. #    --------------------
  54. #
  55. #    The following macros are automatically defined, and in most cases,
  56. #    they should work as given. However, check them before you use this
  57. #    MAKEFILE.
  58. #
  59. #    CCDIR = base directory of your compiler. You may need to adjust
  60. #        the names given below if your compiler is somewhere else.
  61. #
  62. #    CCVER = version number of your compiler. You may need to adjust it
  63. #        if the automatic detection fails.
  64. #-----------------------------------------------------------------------------
  65.  
  66. CCDIR    = C:\WC10
  67. CCVER    = 1000
  68.  
  69. #-----------------------------------------------------------------------------
  70. #    Names for files and tools
  71. #-----------------------------------------------------------------------------
  72.  
  73. AS        = WASM
  74. CC        = WCL386
  75. LINK        = WLINK
  76. LIBR        = WLIB
  77.  
  78. MAKEFILE    = makefile
  79. DEPEND        = makefile.dep
  80.  
  81. #-----------------------------------------------------------------------------
  82. #    Platform-dependent tool options
  83. #
  84. #    DOS:    TLXDm[d]
  85. #    OS/2:    TLX2[d][i]
  86. #    Windows:    TLXWm[d][i]
  87. #-----------------------------------------------------------------------------
  88.  
  89. !if $d(DOS)    #--------- DOS target ----------------------------------------
  90.  
  91. !ifndef M
  92. M        = l
  93. !endif
  94.  
  95. POSTFIX     = d$(M)
  96. AFLAGS        = /mx
  97. CFLAGS        = -c -w -D_TLXBUILD -m$(M) -xs
  98. LFLAGS        = /c /yx
  99. BFLAGS        = /C
  100.  
  101. !ifdef EBUG    #-----    Debugging version
  102.  
  103. POSTFIX     = $(POSTFIX)d
  104. AFLAGS        = $(AFLAGS) /zi
  105. CFLAGS        = $(CFLAGS) -hw -D_TLXDBG
  106. LFLAGS        = $(LFLAGS) D All OP Map
  107. BFLAGS        = $(BFLAGS) -p=64
  108.  
  109. !else        #-----    Distribution version
  110.  
  111. AFLAGS        = $(AFLAGS)
  112. CFLAGS        = $(CFLAGS) -ox
  113. LFLAGS        = $(LFLAGS)
  114. BFLAGS        = $(BFLAGS)
  115.  
  116. !endif    # EBUG
  117.  
  118. !ifdef LL
  119. !error DLLs not supported under DOS
  120. !endif
  121.  
  122. STARTUP     =
  123. RUNTIME     =
  124.  
  125. !elif $d(OS2)    #-------- OS/2 target ----------------------------------------
  126.  
  127. # Under OS/2, compilation for static and dynamic libraries is identical;
  128. # only the linking step differs. Therefore, .OBJ files for both static and
  129. # dynamic libraries share the same directory and configuration file.
  130.  
  131. POSTFIX     = 2
  132. AFLAGS        = /mx
  133. CFLAGS        = -3 -c -w -D_TLXBUILD -xs -mf
  134. LFLAGS        =
  135. BFLAGS        = /C
  136.  
  137. !ifdef EBUG    #-----    Debugging version
  138.  
  139. POSTFIX     = $(POSTFIX)d
  140. AFLAGS        = $(AFLAGS) /zi
  141. CFLAGS        = $(CFLAGS) -hw -D_TLXDBG
  142. LFLAGS        = $(LFLAGS) D All OP Map
  143. BFLAGS        = $(BFLAGS) -p=64
  144.  
  145. !else        #-----    Distribution version
  146.  
  147. AFLAGS        = $(AFLAGS)
  148. CFLAGS        = $(CFLAGS) -ox
  149. LFLAGS        = $(LFLAGS)
  150. BFLAGS        = $(BFLAGS)
  151.  
  152. !endif    # EBUG
  153.  
  154. !ifdef LL    #-----    DLL version
  155.  
  156. POSTFIX     = $(POSTFIX)i
  157. LFLAGS        = $(LFLAGS) /Tod
  158. STARTUP     =
  159.  
  160. !else        #-----    Static version
  161.  
  162. LFLAGS        = $(LFLAGS) FORM OS2 LX PMC
  163. STARTUP     =
  164.  
  165. !endif    # LL
  166.  
  167. RUNTIME     =
  168.  
  169. !elif $d(WIN)    #-------- Windows target -------------------------------------
  170.  
  171. # Under Windows, compilation for static and dynamic libraries differs, and
  172. # we have separate output directories and configuration files for the .OBJ
  173. # files of each variant.
  174.  
  175. !ifndef M
  176. M        = l
  177. !endif
  178.  
  179. POSTFIX     = w$(M)
  180. AFLAGS        = /mx
  181. CFLAGS        = -2 -c -d -O1 -w -D_TLXBUILD -m$(M)
  182. LFLAGS        = /c /C /yx
  183. BFLAGS        = /C
  184.  
  185. !ifdef EBUG    #-----    Debugging version
  186.  
  187. POSTFIX     = $(POSTFIX)d
  188. AFLAGS        = $(AFLAGS) /zi
  189. CFLAGS        = $(CFLAGS) -N -v -D_TLXDBG
  190. LFLAGS        = $(LFLAGS) /m /v
  191. BFLAGS        = $(BFLAGS) -p=64
  192.  
  193. !else        #-----    Distribution version
  194.  
  195. AFLAGS        = $(AFLAGS)
  196. CFLAGS        = $(CFLAGS) -G-
  197. LFLAGS        = $(LFLAGS) /x
  198. BFLAGS        = $(BFLAGS) /0
  199.  
  200. !endif    # EBUG
  201.  
  202. !ifdef LL    #-----    DLL version
  203.  
  204. POSTFIX     = $(POSTFIX)i
  205. CFLAGS        = $(CFLAGS) -WDE
  206. LFLAGS        = $(LFLAGS) /Twd
  207. STARTUP     =
  208.  
  209. !else        #-----    Static version
  210.  
  211. CFLAGS        = $(CFLAGS) -WE
  212. LFLAGS        = $(LFLAGS) /Twe
  213. STARTUP     =
  214.  
  215. !endif    # LL
  216.  
  217. RUNTIME     =
  218. XLIBS        = tlxtr$(TLXVER).lib
  219.  
  220. !endif        #----- DOS - OS/2 - WIN -------------------------------------
  221.  
  222. #-----------------------------------------------------------------------------
  223. #       Directory configuration
  224. #-----------------------------------------------------------------------------
  225.  
  226. .PATH.asm    = ..\..\SRC
  227. .PATH.c     = ..\..\SRC
  228. .PATH.cpp    = ..\..\SRC
  229. .PATH.h     = ..\..
  230. .PATH.obj    = $(POSTFIX)
  231. .PATH.dll    = .
  232. .PATH.lib    = .
  233.  
  234. !ifndef INCLUDE
  235. INCLUDE     = $(CCDIR)\h
  236. !endif
  237. INCLUDE     = $(.PATH.h);$(INCLUDE)
  238.  
  239. !ifndef LIB
  240. LIB        = $(CCDIR)\lib386\os2
  241. !endif
  242. LIB         = $(.PATH.lib);$(LIB)
  243.  
  244. #-----------------------------------------------------------------------------
  245. #    Dependency maker
  246. #-----------------------------------------------------------------------------
  247.  
  248. MD    = makedep
  249. MDFLAGS = /I$(.PATH.h) /O$(DEPEND) /A$(MAKEFILE)
  250.  
  251. #-----------------------------------------------------------------------------
  252. #    Implicit rules
  253. #-----------------------------------------------------------------------------
  254.  
  255. CFLAGS    = $(CFLAGS) -DPROJLEVEL=$(PROJLEVEL) -i=$(INCLUDE)
  256.  
  257. .suffixes:
  258. .suffixes: .CPP .C .ASM
  259.  
  260. .asm.obj:
  261.     $(AS) $(AFLAGS) $<
  262.  
  263. .c.obj:
  264.     $(CC) $(CFLAGS) /fo=$@ $<
  265.  
  266. .cpp.obj:
  267.     $(CC) $(CFLAGS) /fo=$@ $<
  268.  
  269. #-----------------------------------------------------------------------------
  270. #       Target files
  271. #
  272. #    Does *not* include TIMESTMP.OBJ, although that file will be
  273. #    included in the library.
  274. #-----------------------------------------------------------------------------
  275.  
  276. FILELIST     = ..\filelist.mak
  277. OBJ         = obj
  278.  
  279. !include $(FILELIST)
  280.  
  281. OBJECTS        = $(FILES:+PRE\=)
  282. LIBFILES     = $(FILES:PRE=$(.PATH.obj))
  283. DLLFILES     = $(FILES:+PRE=$(.PATH.obj))
  284.  
  285. BASENAME      = tlx$(POSTFIX)
  286. CCONFIG       = $(BASENAME).cfg
  287. DEFFILE       = $(BASENAME).def
  288. LIBRSP          = $(BASENAME).rsp
  289. TARGET          = $(BASENAME).lib
  290. DLLTARGET     = $(BASENAME).dll
  291. TEST          = $(BASENAME).exe
  292. TESTRSP          = $(BASENAME).lnk
  293.  
  294. #-----------------------------------------------------------------------------
  295. #    Default target checks if output directory exists, then builds
  296. #    compiler configuration file and target library
  297. #-----------------------------------------------------------------------------
  298.  
  299. all:    start $(CCONFIG) timestamp timestmp.obj $(TARGET) $(TEST)
  300.  
  301. start:
  302.     -@if not exist $(.PATH.obj)\*.* md $(.PATH.obj)
  303.  
  304. timestamp:
  305.     -touch $(.PATH.cpp)\timestmp.cpp
  306.  
  307. #-----------------------------------------------------------------------------
  308. #    Library file target
  309. #-----------------------------------------------------------------------------
  310.  
  311. !ifdef LL    #-------- DLL target
  312.  
  313. $(TARGET): $(SUBTARGET)
  314.     implib $(.PATH.lib)\$(TARGET) $(.PATH.dll)\$(SUBTARGET)
  315.  
  316. $(DLLTARGET): $(OBJECTS) libmain.obj $(XLIBS)
  317.     @-del $(.PATH.dll)\$(DLLTARGET) >nul
  318.     $(LINK) @$(LIBRSP)
  319.  
  320. $(LIBRSP): $(MAKEFILE) $(FILELIST)
  321.     copy &&|
  322. $(LFLAGS) /L$(LIB) $(STARTUP) +
  323. $(DLLFILES) $(.PATH.obj)\timestmp.obj
  324. $(.PATH.dll)\$(DLLTARGET)
  325.  
  326. $(XLIBS) $(RUNTIME)
  327. $(DEFFILE)
  328. | $(LIBRSP)
  329.  
  330. !else        #-------- Static library target
  331.  
  332. $(TARGET): $(OBJECTS) $(LIBRSP)
  333.     @-del $(.PATH.lib)\$(TARGET) >nul
  334.     $(LIBR) @$(LIBRSP)
  335.  
  336. $(LIBRSP): $(MAKEFILE) $(FILELIST)
  337.     copy &&|
  338. $(BFLAGS) $(.PATH.lib)\$(TARGET)
  339. $(LIBFILES) +$(.PATH.obj)\timestmp.obj
  340. | $(LIBRSP)
  341.  
  342. !endif
  343.  
  344. #-----------------------------------------------------------------------------
  345. #    Test program target
  346. #-----------------------------------------------------------------------------
  347.  
  348. !ifdef DOS
  349.  
  350. $(TEST): $(TARGET) maintest.obj $(TESTRSP)
  351.     $(LINK) @$(TESTRSP)
  352.     $(TEST)
  353.  
  354. $(TESTRSP): $(MAKEFILE)
  355.     copy &&|
  356. $(LFLAGS)
  357. LIBP $(LIB)
  358. F $(.PATH.obj)\maintest.obj
  359. N $(TEST)
  360. L $(TARGET)
  361. | $(TESTRSP)
  362.  
  363. !else
  364.  
  365. $(TEST): $(TARGET) maintest.obj $(DEFFILE) $(TESTRSP)
  366.     $(LINK) @$(TESTRSP)
  367.     $(TEST)
  368.  
  369. $(TESTRSP): $(MAKEFILE)
  370.     copy &&|
  371. $(LFLAGS)
  372. LIBP $(LIB)
  373. F $(.PATH.obj)\maintest.obj
  374. N $(TEST)
  375. L $(TARGET)
  376. SEG TYPE CODE PRELOAD EXECUTEREAD
  377. SEG TYPE DATA PRELOAD
  378. | $(TESTRSP)
  379.  
  380. !endif
  381.  
  382. #-----------------------------------------------------------------------------
  383. #    Compiler configuration file
  384. #-----------------------------------------------------------------------------
  385.  
  386. $(CCONFIG): $(MAKEFILE)
  387.     copy &&|
  388. $(CFLAGS)
  389. -DPROJLEVEL=$(PROJLEVEL)
  390. -i=$(INCLUDE)
  391. | $(CCONFIG)
  392.  
  393. #-----------------------------------------------------------------------------
  394. #    Linker definition file
  395. #-----------------------------------------------------------------------------
  396.  
  397. !if $d(DOS)
  398.  
  399. $(DEFFILE): $(MAKEFILE)
  400.     copy &&|
  401. ; Linker definition file for $(TEST)
  402. ;
  403. ; Copyright (c) 1994 Tarma Software Research. All rights reserved.
  404. | $(DEFFILE)
  405.  
  406. !elif $d(OS2)
  407.  
  408. $(DEFFILE): $(MAKEFILE)
  409.     copy &&|
  410. ; Linker definition file for $(TEST)
  411. ;
  412. ; Copyright (c) 1994 Tarma Software Research. All rights reserved.
  413.  
  414. EXETYPE     OS2
  415.  
  416. CODE    PRELOAD EXECUTEREAD
  417. DATA    PRELOAD MULTIPLE
  418.  
  419. HEAPSIZE    4096
  420. STACKSIZE    8192
  421. | $(DEFFILE)
  422.  
  423. !else
  424.  
  425. $(DEFFILE): $(MAKEFILE)
  426.     copy &&|
  427. ; Linker definition file for $(TEST)
  428. ;
  429. ; Copyright (c) 1994 Tarma Software Research. All rights reserved.
  430.  
  431. EXETYPE     WINDOWS
  432.  
  433. CODE    PRELOAD MOVEABLE DISCARDABLE
  434. DATA    PRELOAD MOVEABLE MULTIPLE
  435.  
  436. HEAPSIZE    4096
  437. STACKSIZE    8192
  438. | $(DEFFILE)
  439.  
  440. !endif
  441.  
  442. #-----------------------------------------------------------------------------
  443. #    Tracing DLL & import library targets
  444. #-----------------------------------------------------------------------------
  445.  
  446. !if $d(WIN)
  447.  
  448. tlxtrace: tlxtrace.lib
  449.  
  450. tlxtrace.lib: tlxtr$(TLXVER).dll
  451.     IMPLIB $(.PATH.lib)\tlxtrace.lib $(.PATH.dll)\tlxtr$(TLXVER).dll
  452.  
  453. tlxtr$(TLXVER).dll: tracelib.def tracelib.cpp
  454.     $(CC) -v -c -WDE -d -G- -I$(INCLUDE) -m$(M) -O1 -w -D_TRACEBUILD $(.PATH.cpp)\tracelib.cpp
  455.     $(LINK) /v /c /yx /L$(LIB) /Twd C0D$(M).OBJ tracelib.obj, \
  456.          $(.PATH.dll)\tlxtr$(TLXVER).dll,,CW$(M).LIB MATHW$(M).LIB \
  457.          IMPORT.LIB, tracelib.def
  458.  
  459. !endif
  460.  
  461. #-----------------------------------------------------------------------------
  462. #    Explicit rules
  463. #-----------------------------------------------------------------------------
  464.  
  465. clean:
  466.     del *.bak *.map *.sym *.obj
  467.  
  468. depend:
  469.     $(MD) $(MDFLAGS) $(.PATH.cpp)\*.cpp
  470.  
  471. version:
  472.     ci /q /u *.c *.cpp *.h $(MAKEFILE)
  473.  
  474. #-----------------------------------------------------------------------------
  475. #    File dependencies
  476. #-----------------------------------------------------------------------------
  477.  
  478. !include $(DEPEND)
  479.