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

  1. # WMAKE makefile for 16 bit MSDOS or 32 bit DOS extender (PMODE/W or DOS/4GW)
  2. # using Watcom C/C++ v10.5, by Paul Kienitz, last revised 22 Mar 97.  Makes
  3. # UnZip.exe, fUnZip.exe, and UnZipSFX.exe.
  4. #
  5. # Invoke from UnZip source dir with "WMAKE -F MSDOS\MAKEFILE.WAT [targets]".
  6. # To make the PMODE/W version use "WMAKE PM=1 ..."
  7. # To make the DOS/4GW version use "WMAKE GW=1 ..." (overrides PM=1)
  8. #   Note: specifying PM or GW without NOASM requires that the win32 source
  9. #   directory be present, so it can access the 32 bit assembly source.
  10. #   PMODE/W is recommended over DOS/4GW for best performance.
  11. # To build with debug info use "WMAKE DEBUG=1 ..."
  12. # To build with no assembly modules use "WMAKE NOASM=1 ..."
  13. # To support unshrinking and unreducing use "WMAKE LAWSUIT=1 ..."
  14. #
  15. # Other options to be fed to the compiler can be specified in an environment
  16. # variable called LOCAL_UNZIP.
  17.  
  18. variation = $(%LOCAL_UNZIP)
  19.  
  20. # Stifle annoying "Delete this file?" questions when errors occur:
  21. .ERASE
  22.  
  23. .EXTENSIONS:
  24. .EXTENSIONS: .exe .obj .obx .c .h .asm
  25.  
  26. # We maintain multiple sets of object files in different directories so that
  27. # we can compile msdos, dos/4gw, and win32 versions of UnZip without their
  28. # object files interacting.  The following var must be a directory name
  29. # ending with a backslash.  All object file names must include this macro
  30. # at the beginning, for example "$(O)foo.obj".
  31.  
  32. !ifdef GW
  33. PM = 1      # both protected mode formats use the same object files
  34. !endif
  35.  
  36. !ifdef DEBUG
  37. !  ifdef PM
  38. O = od32d\  # comment here so backslash won't continue the line
  39. !  else
  40. O = od16d\  # ditto
  41. !  endif
  42. !else
  43. !  ifdef PM
  44. O = ob32d\  # ditto
  45. !  else
  46. O = ob16d\  # ditto
  47. !  endif
  48. !endif
  49.  
  50. !ifdef LAWSUIT
  51. cvars = $+$(cvars)$- -DUSE_SMITH_CODE -DUSE_UNSHRINK
  52. avars = $+$(avars)$- -DUSE_SMITH_CODE -DUSE_UNSHRINK
  53. # "$+$(foo)$-" means expand foo as it has been defined up to now; normally,
  54. # this Make defers inner expansion until the outer macro is expanded.
  55. !endif
  56.  
  57. # The assembly hot-spot code in crc_i[3]86.asm is optional.  This section
  58. # controls its usage.
  59.  
  60. !ifdef NOASM
  61. crcob = $(O)crc32.obj
  62. crcox = $(O)crc32.obx
  63. !else   # !NOASM
  64. cvars = $+$(cvars)$- -DASM_CRC
  65. !  ifdef PM
  66. crcob = $(O)crc_i386.obj
  67. crcox = $(O)crc_i386.obx
  68. crc_s = win32\crc_i386.asm   # requires that the win32 directory be present
  69. !  else
  70. crcob = $(O)crc_i86.obj
  71. crcox = $(O)crc_i86.obx
  72. crc_s = msdos\crc_i86.asm
  73. !  endif
  74. !endif
  75.  
  76. # Our object files: OBJA/OBJB is for UnZip, OBJX for UnZipSFX, OBJF for fUnZip:
  77.  
  78. OBJA1 = $(O)unzip.obj $(crcob) $(O)crctab.obj $(O)crypt.obj $(O)envargs.obj
  79. OBJA  = $(OBJA1) $(O)explode.obj $(O)extract.obj $(O)fileio.obj $(O)globals.obj
  80. OBJB2 = $(O)inflate.obj $(O)list.obj $(O)match.obj $(O)process.obj $(O)ttyio.obj
  81. OBJB  = $(OBJB2) $(O)unreduce.obj $(O)unshrink.obj $(O)zipinfo.obj $(O)msdos.obj
  82.  
  83. OBJX2 = $(O)unzip.obx $(crcox) $(O)crctab.obx $(O)crypt.obx $(O)extract.obx
  84. OBJX1 = $(OBJX2) $(O)fileio.obx $(O)globals.obx $(O)inflate.obx $(O)match.obx
  85. OBJX  = $(OBJX1) $(O)process.obx $(O)ttyio.obx $(O)msdos.obx
  86.  
  87. OBJF1  = $(O)funzip.obj $(crcox) $(O)cryptf.obj $(O)globalsf.obj
  88. OBJF  = $(OBJF1) $(O)inflatef.obj $(O)ttyio.obx
  89. # fUnZip uses $(crcox) and $(O)ttyio.obx because they're small-model.
  90.  
  91. # Common header files included by all C sources:
  92.  
  93. UNZIP_H = unzip.h unzpriv.h globals.h msdos\doscfg.h
  94.  
  95. # Now we have to pick out the proper compiler and options for it.  This gets
  96. # pretty complicated with the PM, GW, DEBUG, and NOASM options...
  97.  
  98. link   = wlink
  99. asm    = wasm
  100.  
  101. !ifdef PM
  102. cc     = wcc386
  103. # Use Pentium timings, flat memory, static strings in code, max strictness:
  104. cflags = -bt=DOS -mf -5r -zt -zq -wx -we
  105. aflags = -bt=DOS -mf -3 -zq
  106. cflagx = $(cflags)
  107. aflagx = $(aflags)
  108.  
  109. !  ifdef GW
  110. lflags = sys DOS4G
  111. !  else
  112. # THIS REQUIRES THAT PMODEW.EXE BE FINDABLE IN THE COMMAND PATH.
  113. # It does NOT require you to add a pmodew entry to wlink.lnk or wlsystem.lnk.
  114. defaultlibs = libpath %WATCOM%\lib386 libpath %WATCOM%\lib386\dos
  115. lflags = format os2 le op osname='PMODE/W' op stub=pmodew.exe $(defaultlibs)
  116. !  endif
  117.  
  118. !else   # plain 16-bit DOS:
  119.  
  120. cc     = wcc
  121. # Use plain 8086 code, medium memory, static strings in code, max strictness:
  122. cflags = -bt=DOS -mm -0 -zt -zq -wx -we
  123. aflags = -bt=DOS -mm -0 -zq
  124. # for UnZipSFX and fUnZip, use the small memory model:
  125. cflagx = -bt=DOS -ms -0 -zt -zq -wx -we
  126. aflagx = -bt=DOS -ms -0 -zq
  127. lflags = sys DOS
  128. !endif  # !PM
  129.  
  130. cvars  = $+$(cvars)$- -DMSDOS $(variation)
  131. avars  = $+$(avars)$- $(variation)
  132.  
  133.  
  134. # Specify optimizations, or a nonoptimized debugging version:
  135.  
  136. !ifdef DEBUG
  137. cdebug = -od -d2
  138. cdebux = -od -d2
  139. ldebug = d w all op symf
  140. !else
  141. !  ifdef PM
  142. cdebug = -s -oilrt -oe=100 -z4   # longword data alignment in 32 bit version
  143. # note: -ol+ does not help.  -oa helps slightly but might be dangerous.
  144. !  else
  145. cdebug = -s -oilrt -oe=100
  146. !  endif
  147. cdebux = -s -oilrs
  148. ldebug = op el
  149. !endif
  150.  
  151. # How to compile sources:
  152. .c.obx:
  153.     $(cc) $(cdebux) $(cflagx) $(cvars) -DSFX $< -fo=$@
  154.  
  155. .c.obj:
  156.     $(cc) $(cdebug) $(cflags) $(cvars) $< -fo=$@
  157.  
  158. # Here we go!  By default, make all targets, except no UnZipSFX for PMODE:
  159. !ifdef PM
  160. all: UnZip.exe fUnZip.exe
  161. !else
  162. all: UnZip.exe fUnZip.exe UnZipSFX.exe
  163. !endif
  164.  
  165. # Convenient shorthand options for single targets:
  166. u:   UnZip.exe    .SYMBOLIC
  167. f:   fUnZip.exe   .SYMBOLIC
  168. x:   UnZipSFX.exe .SYMBOLIC
  169.  
  170. UnZip.exe:    $(OBJA) $(OBJB)
  171.     set WLK_VA=file {$(OBJA)}
  172.     set WLK_VB=file {$(OBJB)}
  173.     $(link) $(lflags) $(ldebug) name $@ @WLK_VA @WLK_VB
  174.     set WLK_VA=
  175.     set WLK_VB=
  176. # We use WLK_VA/WLK_VB to keep the size of each command under 256 chars.
  177.  
  178. UnZipSFX.exe:    $(OBJX)
  179.     set WLK_VX=file {$(OBJX)}
  180.     $(link) $(lflags) $(ldebug) name $@ @WLK_VX
  181.     set WLK_VX=
  182.  
  183. fUnZip.exe:    $(OBJF)
  184.     set WLK_VF=file {$(OBJF)}
  185.     $(link) $(lflags) $(ldebug) name $@ @WLK_VF
  186.     set WLK_VF=
  187.  
  188.  
  189. # Source dependencies:
  190.  
  191. #       for UnZip ...
  192.  
  193. $(O)crc32.obj:    crc32.c $(UNZIP_H) zip.h
  194. $(O)crctab.obj:   crctab.c $(UNZIP_H) zip.h
  195. $(O)crypt.obj:    crypt.c $(UNZIP_H) zip.h crypt.h ttyio.h
  196. $(O)envargs.obj:  envargs.c $(UNZIP_H)
  197. $(O)explode.obj:  explode.c $(UNZIP_H)
  198. $(O)extract.obj:  extract.c $(UNZIP_H) crypt.h
  199. $(O)fileio.obj:   fileio.c $(UNZIP_H) crypt.h ttyio.h ebcdic.h
  200. $(O)globals.obj:  globals.c $(UNZIP_H)
  201. $(O)inflate.obj:  inflate.c inflate.h $(UNZIP_H)
  202. $(O)list.obj:     list.c $(UNZIP_H)
  203. $(O)match.obj:    match.c $(UNZIP_H)
  204. $(O)process.obj:  process.c $(UNZIP_H)
  205. $(O)ttyio.obj:    ttyio.c $(UNZIP_H) zip.h crypt.h ttyio.h
  206. $(O)unreduce.obj: unreduce.c $(UNZIP_H)
  207. $(O)unshrink.obj: unshrink.c $(UNZIP_H)
  208. $(O)unzip.obj:    unzip.c $(UNZIP_H) crypt.h version.h consts.h
  209. $(O)zipinfo.obj:  zipinfo.c $(UNZIP_H)
  210.  
  211. #       for UnZipSFX ...
  212.  
  213. $(O)crc32.obx:    crc32.c $(UNZIP_H) zip.h
  214. $(O)crctab.obx:   crctab.c $(UNZIP_H) zip.h
  215. $(O)crypt.obx:    crypt.c $(UNZIP_H) zip.h crypt.h ttyio.h
  216. $(O)extract.obx:  extract.c $(UNZIP_H) crypt.h
  217. $(O)fileio.obx:   fileio.c $(UNZIP_H) crypt.h ttyio.h ebcdic.h
  218. $(O)globals.obx:  globals.c $(UNZIP_H)
  219. $(O)inflate.obx:  inflate.c inflate.h $(UNZIP_H)
  220. $(O)match.obx:    match.c $(UNZIP_H)
  221. $(O)process.obx:  process.c $(UNZIP_H)
  222. $(O)ttyio.obx:    ttyio.c $(UNZIP_H) zip.h crypt.h ttyio.h
  223. $(O)unzip.obx:    unzip.c $(UNZIP_H) crypt.h version.h consts.h
  224.  
  225. # Special case object files:
  226.  
  227. $(O)msdos.obj:    msdos\msdos.c $(UNZIP_H)
  228.     $(cc) $(cdebug) $(cflags) $(cvars) msdos\msdos.c -fo=$@
  229.  
  230. $(O)msdos.obx:    msdos\msdos.c $(UNZIP_H)
  231.     $(cc) $(cdebux) $(cflagx) $(cvars) -DSFX msdos\msdos.c -fo=$@
  232.  
  233. !ifndef NOASM
  234. $(crcob):         $(crc_s)
  235.     $(asm) $(aflags) $(avars) $(crc_s) -fo=$@
  236.  
  237. $(crcox):         $(crc_s)
  238.     $(asm) $(aflagx) $(avars) $(crc_s) -fo=$@
  239. !endif
  240.  
  241. # Variant object files for fUnZip, using $(cflagx):
  242.  
  243. $(O)funzip.obj:   funzip.c $(UNZIP_H) crypt.h ttyio.h tables.h
  244.     $(cc) $(cdebux) $(cflagx) $(cvars) funzip.c -fo=$@
  245.  
  246. $(O)cryptf.obj:   crypt.c $(UNZIP_H) zip.h crypt.h ttyio.h
  247.     $(cc) $(cdebux) $(cflagx) $(cvars) -DFUNZIP crypt.c -fo=$@
  248.  
  249. $(O)globalsf.obj: globals.c $(UNZIP_H)
  250.     $(cc) $(cdebux) $(cflagx) $(cvars) -DFUNZIP globals.c -fo=$@
  251.  
  252. $(O)inflatef.obj: inflate.c inflate.h $(UNZIP_H) crypt.h
  253.     $(cc) $(cdebux) $(cflagx) $(cvars) -DFUNZIP inflate.c -fo=$@
  254.  
  255. $(O)ttyiof.obj:   ttyio.c $(UNZIP_H) zip.h crypt.h ttyio.h
  256.     $(cc) $(cdebux) $(cflagx) $(cvars) -DFUNZIP ttyio.c -fo=$@
  257.  
  258. # Unwanted file removal:
  259.  
  260. clean:     .SYMBOLIC
  261. !ifdef PM
  262.     del ob32d\*.ob?
  263. !else
  264.     del ob16d\*.ob?
  265. !endif
  266.  
  267. cleaner:   clean  .SYMBOLIC
  268.     del UnZip.exe
  269.     del fUnZip.exe
  270.     del UnZipSFX.exe
  271.