home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 9 Archive / 09-Archive.zip / zip22.zip / msdos / makefile.wat < prev    next >
Makefile  |  1997-10-01  |  8KB  |  255 lines

  1. # WMAKE makefile for 16 bit MSDOS or 32 bit DOS extender (PMODE/W or DOS/4GW)
  2. # using Watcom C/C++ v11.0+, by Paul Kienitz, last revised 29 Sep 97.  Makes
  3. # Zip.exe, ZipNote.exe, ZipCloak.exe, and ZipSplit.exe.
  4. #
  5. # Invoke from Zip source dir with "WMAKE -F MSDOS\MAKEFILE.WAT [targets]"
  6. # To build with debug info use "WMAKE DEBUG=1 ..."
  7. # To build with no assembly modules use "WMAKE NOASM=1 ..."
  8. # To make the PMODE/W version use "WMAKE PM=1 ..."
  9. # To make the DOS/4GW version use "WMAKE GW=1 ..." (overrides PM=1)
  10. #   Note: specifying PM or GW without NOASM requires that the win32 source
  11. #   directory be present, so it can access the 32 bit assembly sources.
  12. #   PMODE/W is recommended over DOS/4GW for best performance.
  13. # To create a low memory usage version of Zip, use "WMAKE WSIZE=8192 ..."
  14. #   (or whatever power of two less than 32768 you wish) -- this also causes
  15. #   SMALL_MEM to be defined.  Compression performance will be reduced.
  16. #   This currently is not supported with PM=1 or GW=1.
  17. #
  18. # Other options to be fed to the compiler and assembler can be specified in
  19. # an environment variable called LOCAL_ZIP.
  20.  
  21. variation = $(%LOCAL_ZIP)
  22.  
  23. # Stifle annoying "Delete this file?" questions when errors occur:
  24. .ERASE
  25.  
  26. .EXTENSIONS:
  27. .EXTENSIONS: .exe .obj .c .h .asm
  28.  
  29. # We maintain multiple sets of object files in different directories so that
  30. # we can compile msdos, dos/4gw or pmode/w, and win32 versions of Zip without
  31. # their object files interacting.  The following var must be a directory name
  32. # ending with a backslash.  All object file names must include this macro
  33. # at the beginning, for example "$(O)foo.obj".
  34.  
  35. !ifdef GW
  36. PM = 1      # both protected mode formats use the same object files
  37. !endif
  38.  
  39. !ifdef DEBUG
  40. !  ifdef PM
  41. O = od32d\  # comment here so backslash won't continue the line
  42. !  else
  43. !    ifdef WSIZE
  44. O = od16l\  # ditto
  45. size = -DWSIZE=$(WSIZE) -DSMALL_MEM
  46. !    else
  47. O = od16d\  # ditto
  48. size = -DMEDIUM_MEM
  49. !    endif
  50. !  endif
  51. !else
  52. !  ifdef PM
  53. O = ob32d\  # ditto
  54. !  else
  55. !    ifdef WSIZE
  56. O = ob16l\  # ditto
  57. size = -DWSIZE=$(WSIZE) -DSMALL_MEM
  58. !    else
  59. O = ob16d\  # ditto
  60. size = -DMEDIUM_MEM
  61. !    endif
  62. !  endif
  63. !endif
  64.  
  65. # The assembly hot-spot code in crc_i[3]86.asm and match[32].asm is
  66. # optional.  This section controls its usage.
  67.  
  68. !ifdef NOASM
  69. asmob = $(O)crc32.obj                       # C source
  70. cvars = $+$(cvars)$- -DDYN_ALLOC -DNO_ASM   # or ASM_CRC might default on!
  71. # "$+$(foo)$-" means expand foo as it has been defined up to now; normally,
  72. # this make defers inner expansion until the outer macro is expanded.
  73. !else  # !NOASM
  74. asmob = $(O)crc.obj $(O)match.obj
  75. !  ifdef PM
  76. cvars = $+$(cvars)$- -DASM_CRC -DASMV       # no DYN_ALLOC with match32.asm
  77. crc_s = win32\crc_i386.asm   # requires that the win32 directory be present
  78. mat_s = win32\match32.asm    # ditto
  79. !  else
  80. cvars = $+$(cvars)$- -DDYN_ALLOC -DASM_CRC -DASMV
  81. avars = $+$(avars)$- -DDYN_ALLOC
  82. crc_s = msdos\crc_i86.asm
  83. mat_s = msdos\match.asm
  84. !  endif
  85. !endif
  86.  
  87. # Now we have to pick out the proper compiler and options for it.  This gets
  88. # pretty complicated with the PM, GW, DEBUG, and NOASM options...
  89.  
  90. link   = wlink
  91. asm    = wasm
  92.  
  93. !ifdef PM
  94. cc     = wcc386
  95. # Use Pentium Pro timings, register args, static strings in code:
  96. cflags = -bt=DOS -mf -6r -zt -zq
  97. aflags = -bt=DOS -mf -3 -zq
  98. cvars  = $+$(cvars)$- -DDOS $(variation)
  99. avars  = $+$(avars)$- $(variation)
  100.  
  101. !  ifdef GW
  102. lflags = sys DOS4G
  103. !  else
  104. # THIS REQUIRES THAT PMODEW.EXE BE FINDABLE IN THE COMMAND PATH.
  105. # It does NOT require you to add a pmodew entry to wlink.lnk or wlsystem.lnk.
  106. defaultlibs = libpath %WATCOM%\lib386 libpath %WATCOM%\lib386\dos
  107. lflags = format os2 le op osname='PMODE/W' op stub=pmodew.exe $(defaultlibs)
  108. !  endif
  109.  
  110. !else   # plain 16-bit DOS:
  111.  
  112. cc     = wcc
  113. # Use plain 8086 instructions, large memory model, static strings in code:
  114. cflags = -bt=DOS -ml -0 -zt -zq
  115. aflags = -bt=DOS -ml -0 -zq
  116. cvars  = $+$(cvars)$- -DDOS $(size) $(variation)
  117. avars  = $+$(avars)$- $(size) $(variation)
  118. lflags = sys DOS
  119. !endif  # !PM
  120.  
  121. # Specify optimizations, or a nonoptimized debugging version:
  122.  
  123. !ifdef DEBUG
  124. cdebug = -od -d2
  125. ldebug = d w all op symf
  126. !else
  127. !  ifdef PM
  128. cdebug = -s -obhikl+rt -oe=100 -zp8
  129. # -oa helps slightly but might be dangerous.
  130. !  else
  131. cdebug = -s -oehiklrt
  132. !  endif
  133. ldebug = op el
  134. !endif
  135.  
  136. # How to compile most sources:
  137. .c.obj:
  138.     $(cc) $(cdebug) $(cflags) $(cvars) $[@ -fo=$@
  139.  
  140. # Our object files.  OBJZ is for Zip, OBJC is for ZipCloak, OBJN is for
  141. # ZipNote, and OBJS is for ZipSplit:
  142.  
  143. OBJZ2 = $(O)zip.obj $(O)crypt.obj $(O)ttyio.obj $(O)zipfile.obj $(O)zipup.obj
  144. OBJZA = $(OBJZ2) $(O)util.obj $(O)fileio.obj $(O)deflate.obj $(O)bits.obj
  145. OBJZB = $(O)trees.obj $(O)globals.obj $(O)crctab.obj $(asmob) $(O)msdos.obj
  146.  
  147. OBJU2 = $(O)zipfile_.obj $(O)fileio_.obj $(O)util_.obj $(O)globals.obj
  148. OBJ_U = $(OBJU2) $(O)msdos_.obj
  149.  
  150. OBJC  = $(O)zipcloak.obj $(O)crctab.obj $(O)crypt_.obj $(O)ttyio.obj $(OBJ_U)
  151.  
  152. OBJN  = $(O)zipnote.obj $(OBJ_U)
  153.  
  154. OBJS  = $(O)zipsplit.obj $(OBJ_U)
  155.  
  156. # Common header files included by all C sources:
  157.  
  158. ZIP_H = zip.h ziperr.h tailor.h msdos\osdep.h
  159.  
  160.  
  161. # HERE WE GO!  By default, make all targets:
  162. all: Zip.exe ZipNote.exe ZipCloak.exe ZipSplit.exe
  163.  
  164. # Convenient shorthand options for single targets:
  165. z:   Zip.exe       .SYMBOLIC
  166. n:   ZipNote.exe   .SYMBOLIC
  167. c:   ZipCloak.exe  .SYMBOLIC
  168. s:   ZipSplit.exe  .SYMBOLIC
  169.  
  170. Zip.exe:    $(OBJZA) $(OBJZB) $(OBJV)
  171.     set WLK_VA=file {$(OBJZA)}
  172.     set WLK_VB=file {$(OBJZB) $(OBJV)}
  173.     $(link) $(lflags) $(ldebug) name $@ @WLK_VA @WLK_VB
  174.     set WLK_VA=
  175.     set WLK_VB=
  176. # We use WLK_VA and WLK_VB to keep the size of each command under 256 chars.
  177.  
  178. ZipNote.exe:    $(OBJN)
  179.     set WLK_VAR=file {$(OBJN)}
  180.     $(link) $(lflags) $(ldebug) name $@ @WLK_VAR
  181.     set WLK_VAR=
  182.  
  183. ZipCloak.exe:    $(OBJC)
  184.     set WLK_VAR=file {$(OBJC)}
  185.     $(link) $(lflags) $(ldebug) name $@ @WLK_VAR
  186.     set WLK_VAR=
  187.  
  188. ZipSplit.exe:    $(OBJS)
  189.     set WLK_VAR=file {$(OBJS)}
  190.     $(link) $(lflags) $(ldebug) name $@ @WLK_VAR
  191.     set WLK_VAR=
  192.  
  193. # Source dependencies:
  194.  
  195. $(O)bits.obj:     bits.c $(ZIP_H) crypt.h
  196. $(O)crctab.obj:   crctab.c $(ZIP_H)
  197. $(O)crc32.obj:    crc32.c $(ZIP_H)              # only used if NOASM
  198. $(O)crypt.obj:    crypt.c $(ZIP_H) crypt.h ttyio.h
  199. $(O)deflate.obj:  deflate.c $(ZIP_H)
  200. $(O)fileio.obj:   fileio.c $(ZIP_H)
  201. $(O)globals.obj:  globals.c $(ZIP_H)
  202. $(O)trees.obj:    trees.c $(ZIP_H)
  203. $(O)ttyio.obj:    ttyio.c $(ZIP_H) crypt.h ttyio.h
  204. $(O)util.obj:     util.c $(ZIP_H)
  205. $(O)zip.obj:      zip.c $(ZIP_H) crypt.h revision.h ttyio.h
  206. $(O)zipfile.obj:  zipfile.c $(ZIP_H)
  207. $(O)zipup.obj:    zipup.c $(ZIP_H) revision.h crypt.h msdos\zipup.h
  208. $(O)zipnote.obj:  zipnote.c $(ZIP_H) revision.h
  209. $(O)zipcloak.obj: zipcloak.c $(ZIP_H) revision.h crypt.h ttyio.h
  210. $(O)zipsplit.obj: zipsplit.c $(ZIP_H) revision.h
  211.  
  212. # Special case object files:
  213.  
  214. $(O)msdos.obj:    msdos\msdos.c $(ZIP_H)
  215.     $(cc) $(cdebug) $(cflags) $(cvars) msdos\msdos.c -fo=$@
  216.  
  217. $(O)match.obj:    $(mat_s)
  218.     $(asm) $(aflags) $(avars) $(mat_s) -fo=$@
  219.  
  220. $(O)crc.obj:      $(crc_s)
  221.     $(asm) $(aflags) $(avars) $(crc_s) -fo=$@
  222.  
  223. # Variant object files for ZipNote, ZipCloak, and ZipSplit:
  224.  
  225. $(O)zipfile_.obj: zipfile.c $(ZIP_H)
  226.     $(cc) $(cdebug) $(cflags) $(cvars) -DUTIL zipfile.c -fo=$@
  227.  
  228. $(O)fileio_.obj:  fileio.c $(ZIP_H)
  229.     $(cc) $(cdebug) $(cflags) $(cvars) -DUTIL fileio.c -fo=$@
  230.  
  231. $(O)util_.obj:    util.c $(ZIP_H)
  232.     $(cc) $(cdebug) $(cflags) $(cvars) -DUTIL util.c -fo=$@
  233.  
  234. $(O)crypt_.obj:   crypt.c $(ZIP_H) crypt.h ttyio.h
  235.     $(cc) $(cdebug) $(cflags) $(cvars) -DUTIL crypt.c -fo=$@
  236.  
  237. $(O)msdos_.obj:   msdos\msdos.c $(ZIP_H)
  238.     $(cc) $(cdebug) $(cflags) $(cvars) -DUTIL msdos\msdos.c -fo=$@
  239.  
  240. # Unwanted file removal:
  241.  
  242. clean:     .SYMBOLIC
  243. !ifdef PM
  244.     del ob32d\*.obj
  245. !else
  246.     del ob16d\*.obj
  247.     del ob16l\*.obj
  248. !endif
  249.  
  250. cleaner:   clean  .SYMBOLIC
  251.     del Zip.exe
  252.     del ZipNote.exe
  253.     del ZipCloak.exe
  254.     del ZipSplit.exe
  255.