home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 9 Archive / 09-Archive.zip / unzip540.zip / win32 / Makefile.wat < prev    next >
Makefile  |  1998-08-24  |  6KB  |  198 lines

  1. # WMAKE makefile for Windows 95 and Windows NT (Intel only)
  2. # using Watcom C/C++ v11.0+, by Paul Kienitz, last revised 26 Apr 98.
  3. # Makes UnZip.exe, fUnZip.exe, and UnZipSFX.exe.
  4. #
  5. # Invoke from UnZip source dir with "WMAKE -F WIN32\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 support unshrinking and unreducing use "WMAKE LAWSUIT=1 ..."
  9. #
  10. # Other options to be fed to the compiler can be specified in an environment
  11. # variable called LOCAL_UNZIP.
  12.  
  13. variation = $(%LOCAL_UNZIP)
  14.  
  15. # Stifle annoying "Delete this file?" questions when errors occur:
  16. .ERASE
  17.  
  18. .EXTENSIONS:
  19. .EXTENSIONS: .exe .obj .obx .c .h .asm
  20.  
  21. # We maintain multiple sets of object files in different directories so that
  22. # we can compile msdos, dos/4gw or pmode/w, and win32 versions of UnZip without
  23. # their object files interacting.  The following var must be a directory name
  24. # ending with a backslash.  All object file names must include this macro
  25. # at the beginning, for example "$(O)foo.obj".
  26.  
  27. !ifdef DEBUG
  28. O = od32w\  # comment here so backslash won't continue the line
  29. !else
  30. O = ob32w\  # likewise
  31. !endif
  32.  
  33. !ifdef LAWSUIT
  34. cvars = $+$(cvars)$- -DUSE_SMITH_CODE -DUSE_UNSHRINK
  35. avars = $+$(avars)$- -DUSE_SMITH_CODE -DUSE_UNSHRINK
  36. # "$+$(foo)$-" means expand foo as it has been defined up to now; normally,
  37. # this Make defers inner expansion until the outer macro is expanded.
  38. !endif
  39.  
  40. # The assembly hot-spot code in crc_i386.asm is optional.  This section
  41. # controls its usage.
  42.  
  43. !ifdef NOASM
  44. crcob = $(O)crc32.obj
  45. !else   # !NOASM
  46. cvars = $+$(cvars)$- -DASM_CRC
  47. crcob = $(O)crc_i386.obj
  48. !endif
  49.  
  50. # Our object files.  OBJS is for UnZip, OBJX for UnZipSFX, OBJF for fUnZip:
  51.  
  52. OBJS1 = $(O)unzip.obj $(crcob) $(O)crctab.obj $(O)crypt.obj $(O)envargs.obj
  53. OBJS2 = $(O)explode.obj $(O)extract.obj $(O)fileio.obj $(O)globals.obj
  54. OBJS3 = $(O)inflate.obj $(O)list.obj $(O)match.obj $(O)process.obj
  55. OBJS4 = $(O)ttyio.obj $(O)unreduce.obj $(O)unshrink.obj $(O)zipinfo.obj
  56. OBJS  = $(OBJS1) $(OBJS2) $(OBJS3) $(OBJS4) $(O)win32.obj $(O)nt.obj
  57.  
  58. OBJX1 = $(O)unzip.obx $(crcob) $(O)crctab.obx $(O)crypt.obx $(O)extract.obx
  59. OBJX2 = $(O)fileio.obx $(O)globals.obx $(O)inflate.obx $(O)match.obx
  60. OBJX3 = $(O)process.obx $(O)ttyio.obx
  61. OBJX  = $(OBJX1) $(OBJX2) $(OBJX3) $(O)win32.obx $(O)nt.obx
  62.  
  63. OBJF1 = $(O)funzip.obj $(crcob) $(O)cryptf.obj $(O)globalsf.obj
  64. OBJF  = $(OBJF1) $(O)inflatef.obj $(O)ttyiof.obj $(O)win32f.obj
  65.  
  66. UNZIP_H = unzip.h unzpriv.h globals.h win32\w32cfg.h
  67.  
  68. # Now we have to pick out the proper compiler and options for it.
  69.  
  70. cc     = wcc386
  71. link   = wlink
  72. asm    = wasm
  73. # Use Pentium Pro timings, register args, static strings in code, high strictness:
  74. cflags = -bt=NT -6r -zt -zq -wx
  75. aflags = -bt=NT -mf -3 -zq
  76. lflags = sys NT
  77. cvars  = $+$(cvars)$- -DWIN32 $(variation)
  78. avars  = $+$(avars)$- $(variation)
  79.  
  80. # Specify optimizations, or a nonoptimized debugging version:
  81.  
  82. !ifdef DEBUG
  83. cdebug = -od -d2
  84. cdebux = -od -d2
  85. ldebug = d w all op symf
  86. !else
  87. cdebug = -s -obhikl+rt -oe=100 -zp8
  88. cdebux = -s -obhiklrs
  89. # -oa helps slightly but might be dangerous.
  90. ldebug = op el
  91. !endif
  92.  
  93. # How to compile sources:
  94. .c.obx:
  95.     $(cc) $(cdebux) $(cflags) $(cvars) -DSFX $[@ -fo=$@
  96.  
  97. .c.obj:
  98.     $(cc) $(cdebug) $(cflags) $(cvars) $[@ -fo=$@
  99.  
  100. # Here we go!  By default, make all targets:
  101. all: UnZip.exe fUnZip.exe UnZipSFX.exe
  102.  
  103. # Convenient shorthand options for single targets:
  104. u:   UnZip.exe     .SYMBOLIC
  105. f:   fUnZip.exe    .SYMBOLIC
  106. x:   UnZipSFX.exe  .SYMBOLIC
  107.  
  108. UnZip.exe:    $(OBJS)
  109.     $(link) $(lflags) $(ldebug) name $@ file {$(OBJS)}
  110.  
  111. UnZipSFX.exe:    $(OBJX)
  112.     $(link) $(lflags) $(ldebug) name $@ file {$(OBJX)}
  113.  
  114. fUnZip.exe:    $(OBJF)
  115.     $(link) $(lflags) $(ldebug) name $@ file {$(OBJF)}
  116.  
  117. # Source dependencies:
  118.  
  119. #       generic (UnZip, fUnZip):
  120.  
  121. $(O)crc32.obj:    crc32.c $(UNZIP_H) zip.h
  122. $(O)crctab.obj:   crctab.c $(UNZIP_H) zip.h
  123. $(O)crypt.obj:    crypt.c $(UNZIP_H) zip.h crypt.h ttyio.h
  124. $(O)envargs.obj:  envargs.c $(UNZIP_H)
  125. $(O)explode.obj:  explode.c $(UNZIP_H)
  126. $(O)extract.obj:  extract.c $(UNZIP_H) crypt.h
  127. $(O)fileio.obj:   fileio.c $(UNZIP_H) crypt.h ttyio.h ebcdic.h
  128. $(O)funzip.obj:   funzip.c $(UNZIP_H) crypt.h ttyio.h tables.h
  129. $(O)globals.obj:  globals.c $(UNZIP_H)
  130. $(O)inflate.obj:  inflate.c inflate.h $(UNZIP_H)
  131. $(O)list.obj:     list.c $(UNZIP_H)
  132. $(O)match.obj:    match.c $(UNZIP_H)
  133. $(O)process.obj:  process.c $(UNZIP_H)
  134. $(O)ttyio.obj:    ttyio.c $(UNZIP_H) zip.h crypt.h ttyio.h
  135. $(O)unreduce.obj: unreduce.c $(UNZIP_H)
  136. $(O)unshrink.obj: unshrink.c $(UNZIP_H)
  137. $(O)unzip.obj:    unzip.c $(UNZIP_H) crypt.h version.h consts.h
  138. $(O)zipinfo.obj:  zipinfo.c $(UNZIP_H)
  139.  
  140. #       UnZipSFX variants:
  141.  
  142. $(O)crc32.obx:    crc32.c $(UNZIP_H) zip.h
  143. $(O)crctab.obx:   crctab.c $(UNZIP_H) zip.h
  144. $(O)crypt.obx:    crypt.c $(UNZIP_H) zip.h crypt.h ttyio.h
  145. $(O)extract.obx:  extract.c $(UNZIP_H) crypt.h
  146. $(O)fileio.obx:   fileio.c $(UNZIP_H) crypt.h ttyio.h ebcdic.h
  147. $(O)globals.obx:  globals.c $(UNZIP_H)
  148. $(O)inflate.obx:  inflate.c inflate.h $(UNZIP_H)
  149. $(O)match.obx:    match.c $(UNZIP_H)
  150. $(O)process.obx:  process.c $(UNZIP_H)
  151. $(O)ttyio.obx:    ttyio.c $(UNZIP_H) zip.h crypt.h ttyio.h
  152. $(O)unzip.obx:    unzip.c $(UNZIP_H) crypt.h version.h consts.h
  153.  
  154. # Special case object files:
  155.  
  156. $(O)win32.obj:    win32\win32.c $(UNZIP_H)
  157.     $(cc) $(cdebug) $(cflags) $(cvars) win32\win32.c -fo=$@
  158.  
  159. $(O)win32.obx:    win32\win32.c $(UNZIP_H)
  160.     $(cc) $(cdebux) $(cflags) $(cvars) -DSFX win32\win32.c -fo=$@
  161.  
  162. $(O)nt.obj:    win32\nt.c $(UNZIP_H) win32\nt.h
  163.     $(cc) $(cdebug) $(cflags) $(cvars) win32\nt.c -fo=$@
  164.  
  165. $(O)nt.obx:    win32\nt.c $(UNZIP_H) win32\nt.h
  166.     $(cc) $(cdebux) $(cflags) $(cvars) -DSFX win32\nt.c -fo=$@
  167.  
  168. $(O)crc_i386.obj: win32\crc_i386.asm
  169.     $(asm) $(aflags) $(avars) win32\crc_i386.asm -fo=$@
  170.  
  171. # Variant object files for fUnZip:
  172.  
  173. $(O)cryptf.obj:   crypt.c $(UNZIP_H) zip.h crypt.h ttyio.h
  174.     $(cc) $(cdebug) $(cflags) $(cvars) -DFUNZIP crypt.c -fo=$@
  175.  
  176. $(O)globalsf.obj: globals.c $(UNZIP_H)
  177.     $(cc) $(cdebug) $(cflags) $(cvars) -DFUNZIP globals.c -fo=$@
  178.  
  179. $(O)inflatef.obj: inflate.c inflate.h $(UNZIP_H) crypt.h
  180.     $(cc) $(cdebug) $(cflags) $(cvars) -DFUNZIP inflate.c -fo=$@
  181.  
  182. $(O)ttyiof.obj:   ttyio.c $(UNZIP_H) zip.h crypt.h ttyio.h
  183.     $(cc) $(cdebug) $(cflags) $(cvars) -DFUNZIP ttyio.c -fo=$@
  184.  
  185. $(O)win32f.obj:    win32\win32.c $(UNZIP_H)
  186.     $(cc) $(cdebux) $(cflags) $(cvars) -DFUNZIP win32\win32.c -fo=$@
  187.  
  188. # Unwanted file removal:
  189.  
  190. clean:     .SYMBOLIC
  191.     del $(O)*.ob?
  192.  
  193. cleaner:   clean  .SYMBOLIC
  194.     del UnZip.exe
  195.     del fUnZip.exe
  196.     del UnZipSFX.exe
  197.  
  198.