home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 9 Archive / 09-Archive.zip / zip21.zip / msdos / makefile.wat < prev    next >
Makefile  |  1996-04-01  |  7KB  |  234 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 10 Feb 96.  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 PM
  40. O = ob32d\  # comment here so backslash won't continue the line
  41. !else
  42. !  ifdef WSIZE
  43. O = ob16l\  # ditto
  44. size = -DWSIZE=$(WSIZE) -DSMALL_MEM
  45. !  else
  46. O = ob16d\  # ditto
  47. size = -DMEDIUM_MEM
  48. !  endif
  49. !endif
  50.  
  51. # The assembly hot-spot code in crc_i[3]86.asm and match[32].asm is
  52. # optional.  This section controls its usage.
  53.  
  54. !ifdef NOASM
  55. asmob = $(O)crc32.obj                       # C source
  56. cvars = $+$(cvars)$- -DDYN_ALLOC -DNO_ASM   # or ASM_CRC might default on!
  57. # "$+$(foo)$-" means expand foo as it has been defined up to now; normally,
  58. # this make defers inner expansion until the outer macro is expanded.
  59. !else  # !NOASM
  60. asmob = $(O)crc.obj $(O)match.obj
  61. !  ifdef PM
  62. cvars = $+$(cvars)$- -DASM_CRC -DASMV       # no DYN_ALLOC with match32.asm
  63. crc_s = win32\crc_i386.asm   # requires that the win32 directory be present
  64. mat_s = win32\match32.asm    # ditto
  65. !  else
  66. cvars = $+$(cvars)$- -DDYN_ALLOC -DASM_CRC -DASMV
  67. avars = $+$(avars)$- -DDYN_ALLOC
  68. crc_s = msdos\crc_i86.asm
  69. mat_s = msdos\match.asm
  70. !  endif
  71. !endif
  72.  
  73. # Now we have to pick out the proper compiler and options for it.  This gets
  74. # pretty complicated with the PM, GW, DEBUG, and NOASM options...
  75.  
  76. link   = wlink
  77. asm    = wasm
  78.  
  79. !ifdef PM
  80. cc     = wcc386
  81. # Use Pentium timings, register args, static strings in code:
  82. cflags = -bt=DOS -mf -5r -zt -zq
  83. aflags = -bt=DOS -mf -3 -zq
  84. cvars  = $+$(cvars)$- -DDOS $(variation)
  85. avars  = $+$(avars)$- $(variation)
  86.  
  87. !  ifdef GW
  88. lflags = sys DOS4G
  89. !  else
  90. # THIS REQUIRES THAT PMODEW.EXE BE FINDABLE IN THE COMMAND PATH.
  91. # It does NOT require you to add a pmodew entry to wlink.lnk or wlsystem.lnk.
  92. defaultlibs = libpath %WATCOM%\lib386 libpath %WATCOM%\lib386\dos
  93. lflags = format os2 le op osname='PMODE/W' op stub=pmodew.exe $(defaultlibs)
  94. !  endif
  95.  
  96. !else   # plain 16-bit DOS:
  97.  
  98. cc     = wcc
  99. # Use plain 8086 instructions, large memory model, static strings in code:
  100. cflags = -bt=DOS -ml -0 -zt -zq
  101. aflags = -bt=DOS -ml -0 -zq
  102. cvars  = $+$(cvars)$- -DDOS $(size) $(variation)
  103. avars  = $+$(avars)$- $(size) $(variation)
  104. lflags = sys DOS
  105. !endif  # !PM
  106.  
  107. # Specify optimizations, or a nonoptimized debugging version:
  108.  
  109. !ifdef DEBUG
  110. cdebug = -od -d2
  111. ldebug = d w all op symf
  112. !else
  113. !  ifdef PM
  114. cdebug = -s -oeilrt -zp4
  115. # note: -ol+ does not help.  -oa helps slightly but might be dangerous.
  116. !  else
  117. cdebug = -s -oeilrt
  118. !  endif
  119. ldebug = op el
  120. !endif
  121.  
  122. # How to compile most sources:
  123. .c.obj:
  124.     $(cc) $(cdebug) $(cflags) $(cvars) $< -fo=$@
  125.  
  126. # Our object files.  OBJZ is for Zip, OBJC is for ZipCloak, OBJN is for
  127. # ZipNote, and OBJS is for ZipSplit:
  128.  
  129. OBJZ2 = $(O)zip.obj $(O)crypt.obj $(O)ttyio.obj $(O)zipfile.obj $(O)zipup.obj
  130. OBJZA = $(OBJZ2) $(O)util.obj $(O)fileio.obj $(O)deflate.obj $(O)bits.obj
  131. OBJZB = $(O)trees.obj $(O)globals.obj $(O)crctab.obj $(asmob) $(O)msdos.obj
  132.  
  133. OBJU1 = $(O)zipfile_.obj $(O)fileio_.obj $(O)util_.obj
  134. OBJ_U = $(OBJU1) $(O)globals.obj
  135.  
  136. OBJC  = $(O)zipcloak.obj $(O)crctab.obj $(O)crypt_.obj $(O)ttyio.obj $(OBJ_U)
  137.  
  138. OBJN  = $(O)zipnote.obj $(OBJ_U)
  139.  
  140. OBJS  = $(O)zipsplit.obj $(OBJ_U)
  141.  
  142. # Common header files included by all C sources:
  143.  
  144. ZIP_H = zip.h ziperr.h tailor.h msdos\osdep.h
  145.  
  146.  
  147. # HERE WE GO!  By default, make all targets:
  148. all: Zip.exe ZipNote.exe ZipCloak.exe ZipSplit.exe
  149.  
  150. # Convenient shorthand options for single targets:
  151. z:   Zip.exe       .SYMBOLIC
  152. n:   ZipNote.exe   .SYMBOLIC
  153. c:   ZipCloak.exe  .SYMBOLIC
  154. s:   ZipSplit.exe  .SYMBOLIC
  155.  
  156. Zip.exe:    $(OBJZA) $(OBJZB)
  157.     set WLK_VA=file {$(OBJZA)}
  158.     set WLK_VB=file {$(OBJZB)}
  159.     $(link) $(lflags) $(ldebug) name $@ @WLK_VA @WLK_VB
  160.     set WLK_VA=
  161.     set WLK_VB=
  162. # We use WLK_VA and WLK_VB to keep the size of each command under 256 chars.
  163.  
  164. ZipNote.exe:    $(OBJN)
  165.     set WLK_VAR=file {$(OBJN)}
  166.     $(link) $(lflags) $(ldebug) name $@ @WLK_VAR
  167.     set WLK_VAR=
  168.  
  169. ZipCloak.exe:    $(OBJC)
  170.     set WLK_VAR=file {$(OBJC)}
  171.     $(link) $(lflags) $(ldebug) name $@ @WLK_VAR
  172.     set WLK_VAR=
  173.  
  174. ZipSplit.exe:    $(OBJS)
  175.     set WLK_VAR=file {$(OBJS)}
  176.     $(link) $(lflags) $(ldebug) name $@ @WLK_VAR
  177.     set WLK_VAR=
  178.  
  179. # Source dependencies:
  180.  
  181. $(O)bits.obj:     bits.c $(ZIP_H) crypt.h
  182. $(O)crctab.obj:   crctab.c $(ZIP_H)
  183. $(O)crc32.obj:    crc32.c $(ZIP_H)              # only used if NOASM
  184. $(O)crypt.obj:    crypt.c $(ZIP_H) crypt.h ttyio.h
  185. $(O)deflate.obj:  deflate.c $(ZIP_H)
  186. $(O)fileio.obj:   fileio.c $(ZIP_H)
  187. $(O)globals.obj:  globals.c $(ZIP_H)
  188. $(O)trees.obj:    trees.c $(ZIP_H)
  189. $(O)ttyio.obj:    ttyio.c $(ZIP_H) crypt.h ttyio.h
  190. $(O)util.obj:     util.c $(ZIP_H)
  191. $(O)zip.obj:      zip.c $(ZIP_H) crypt.h revision.h ttyio.h
  192. $(O)zipfile.obj:  zipfile.c $(ZIP_H)
  193. $(O)zipup.obj:    zipup.c $(ZIP_H) revision.h crypt.h msdos\zipup.h
  194. $(O)zipnote.obj:  zipnote.c $(ZIP_H) revision.h
  195. $(O)zipcloak.obj: zipcloak.c $(ZIP_H) revision.h crypt.h ttyio.h
  196. $(O)zipsplit.obj: zipsplit.c $(ZIP_H) revision.h
  197.  
  198. # Special case object files:
  199.  
  200. $(O)msdos.obj:    msdos\msdos.c $(ZIP_H)
  201.     $(cc) $(cdebug) $(cflags) $(cvars) msdos\msdos.c -fo=$@
  202.  
  203. $(O)match.obj:    $(mat_s)
  204.     $(asm) $(aflags) $(avars) $(mat_s) -fo=$@
  205.  
  206. $(O)crc.obj:      $(crc_s)
  207.     $(asm) $(aflags) $(avars) $(crc_s) -fo=$@
  208.  
  209. # Variant object files for ZipNote, ZipCloak, and ZipSplit:
  210.  
  211. $(O)zipfile_.obj: zipfile.c $(ZIP_H)
  212.     $(cc) $(cdebug) $(cflags) $(cvars) -DUTIL zipfile.c -fo=$@
  213.  
  214. $(O)fileio_.obj:  fileio.c $(ZIP_H)
  215.     $(cc) $(cdebug) $(cflags) $(cvars) -DUTIL fileio.c -fo=$@
  216.  
  217. $(O)util_.obj:    util.c $(ZIP_H)
  218.     $(cc) $(cdebug) $(cflags) $(cvars) -DUTIL util.c -fo=$@
  219.  
  220. $(O)crypt_.obj:   crypt.c $(ZIP_H) crypt.h ttyio.h
  221.     $(cc) $(cdebug) $(cflags) $(cvars) -DUTIL crypt.c -fo=$@
  222.  
  223. # Unwanted file removal:
  224.  
  225. clean:     .SYMBOLIC
  226.     del ob16d\*.obj
  227.     del ob32d\*.obj
  228.  
  229. cleaner:   clean  .SYMBOLIC
  230.     del Zip.exe
  231.     del ZipNote.exe
  232.     del ZipCloak.exe
  233.     del ZipSplit.exe
  234.