makefile.wat 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197
  1. # WMAKE makefile for Windows 95 and Windows NT (Intel only)
  2. # using Watcom C/C++ v11.0+, by Paul Kienitz, last revised 22 Jun 2008.
  3. # Makes Zip.exe, ZipNote.exe, ZipCloak.exe, and ZipSplit.exe.
  4. #
  5. # Invoke from Zip source dir with "WMAKE -F WIN32\MAKEFILE.WAT [targets]"
  6. # To build with debug info use "WMAKE DEBUG=1 ..."
  7. # To build without any assembly modules use "WMAKE NOASM=1 ..."
  8. #
  9. # Other options to be fed to the compiler can be specified in an environment
  10. # variable called LOCAL_ZIP. One possibility "-DDYN_ALLOC", but currently
  11. # this is not supported unless NOASM is also used.
  12. variation = $(%LOCAL_ZIP)
  13. # Stifle annoying "Delete this file?" questions when errors occur:
  14. .ERASE
  15. .EXTENSIONS:
  16. .EXTENSIONS: .exe .obj .c .h .asm
  17. # We maintain multiple sets of object files in different directories so that
  18. # we can compile msdos, dos/4gw, and win32 versions of Zip without their
  19. # object files interacting. The following var must be a directory name
  20. # ending with a backslash. All object file names must include this macro
  21. # at the beginning, for example "$(O)foo.obj".
  22. !ifdef DEBUG
  23. OBDIR = od32w
  24. !else
  25. OBDIR = ob32w
  26. !endif
  27. O = $(OBDIR)\ # comment here so backslash won't continue the line
  28. # The assembly hot-spot code in crc_i386.asm and match32.asm is optional.
  29. # This section controls its usage.
  30. !ifdef NOASM
  31. asmob =
  32. asmco =
  33. cvars = $+$(cvars)$- -DNO_ASM # otherwise ASM_CRC might default on!
  34. # "$+$(foo)$-" means expand foo as it has been defined up to now; normally,
  35. # this make defers inner expansion until the outer macro is expanded.
  36. !else # !NOASM
  37. asmco = $(O)crc_i386.obj
  38. asmob = $(asmco) $(O)match32.obj
  39. cvars = $+$(cvars)$- -DASMV -DASM_CRC
  40. !endif
  41. # Our object files. OBJZ is for Zip, OBJC is for ZipCloak, OBJN is for
  42. # ZipNote, and OBJS is for ZipSplit:
  43. OBJZ3 = $(O)zip.obj $(O)crypt.obj $(O)ttyio.obj $(O)trees.obj $(O)zipup.obj
  44. OBJZ2 = $(OBJZ3) $(O)util.obj $(O)zipfile.obj $(O)fileio.obj $(O)deflate.obj
  45. OBJZ1 = $(OBJZ2) $(O)globals.obj $(O)crc32.obj $(asmob)
  46. OBJZ = $(OBJZ1) $(O)win32zip.obj $(O)win32.obj $(O)win32i64.obj $(O)nt.obj
  47. OBJU1 = $(O)zipfile_.obj $(O)fileio_.obj $(O)util_.obj $(O)crc32_.obj $(asmco)
  48. OBJ_U = $(OBJU1) $(O)globals.obj $(O)win32_.obj $(O)win32i64_.obj
  49. OBJC = $(O)zipcloak.obj $(O)crypt_.obj $(O)ttyio.obj $(OBJ_U)
  50. OBJN = $(O)zipnote.obj $(OBJ_U)
  51. OBJS = $(O)zipsplit.obj $(OBJ_U)
  52. # Common header files included by all C sources:
  53. ZIP_H = zip.h ziperr.h tailor.h win32\osdep.h
  54. # Now we have to pick out the proper compiler and options for it.
  55. cc = wcc386
  56. link = wlink
  57. asm = wasm
  58. rc = wrc
  59. # Use Pentium Pro timings, register args, static strings in code:
  60. cflags = -bt=NT -6r -zt -zq
  61. aflags = -bt=NT -mf -3 -zq
  62. rcflags= -bt=NT -DWIN32 -iwin32 -q
  63. lflags = sys NT
  64. cvars = $+$(cvars)$- -DWIN32 $(variation)
  65. avars = $+$(avars)$- -DWATCOM_DSEG $(variation)
  66. # Specify optimizations, or a nonoptimized debugging version:
  67. !ifdef DEBUG
  68. cdebug = -od -d2
  69. ldebug = d w all op symf
  70. !else
  71. cdebug = -s -obhikl+rt -oe=100 -zp8
  72. # -oa helps slightly but might be dangerous.
  73. ldebug = op el
  74. !endif
  75. # How to compile sources:
  76. .c.obj:
  77. $(cc) $(cdebug) $(cflags) $(cvars) $[@ -fo=$@
  78. # Here we go! By default, make all targets:
  79. all: Zip.exe ZipNote.exe ZipCloak.exe ZipSplit.exe
  80. # Convenient shorthand options for single targets:
  81. z: Zip.exe .SYMBOLIC
  82. n: ZipNote.exe .SYMBOLIC
  83. c: ZipCloak.exe .SYMBOLIC
  84. s: ZipSplit.exe .SYMBOLIC
  85. Zip.exe: $(OBDIR) $(OBJZ) $(O)zip.res
  86. $(link) $(lflags) $(ldebug) name $@ file {$(OBJZ)}
  87. $(rc) $(O)zip.res $@
  88. ZipNote.exe: $(OBDIR) $(OBJN)
  89. $(link) $(lflags) $(ldebug) name $@ file {$(OBJN)}
  90. ZipCloak.exe: $(OBDIR) $(OBJC)
  91. $(link) $(lflags) $(ldebug) name $@ file {$(OBJC)}
  92. ZipSplit.exe: $(OBDIR) $(OBJS)
  93. $(link) $(lflags) $(ldebug) name $@ file {$(OBJS)}
  94. # Source dependencies:
  95. $(O)crc32.obj: crc32.c $(ZIP_H) crc32.h # only used if NOASM
  96. $(O)crypt.obj: crypt.c $(ZIP_H) crypt.h crc32.h ttyio.h
  97. $(O)deflate.obj: deflate.c $(ZIP_H)
  98. $(O)fileio.obj: fileio.c $(ZIP_H) crc32.h
  99. $(O)globals.obj: globals.c $(ZIP_H)
  100. $(O)trees.obj: trees.c $(ZIP_H)
  101. $(O)ttyio.obj: ttyio.c $(ZIP_H) crypt.h ttyio.h
  102. $(O)util.obj: util.c $(ZIP_H)
  103. $(O)zip.obj: zip.c $(ZIP_H) crc32.h crypt.h revision.h ttyio.h
  104. $(O)zipfile.obj: zipfile.c $(ZIP_H) crc32.h
  105. $(O)zipup.obj: zipup.c $(ZIP_H) revision.h crc32.h crypt.h win32\zipup.h
  106. $(O)zipnote.obj: zipnote.c $(ZIP_H) revision.h
  107. $(O)zipcloak.obj: zipcloak.c $(ZIP_H) revision.h crc32.h crypt.h ttyio.h
  108. $(O)zipsplit.obj: zipsplit.c $(ZIP_H) revision.h
  109. # Special case object files:
  110. $(O)win32.obj: win32\win32.c $(ZIP_H) win32\win32zip.h
  111. $(cc) $(cdebug) $(cflags) $(cvars) win32\win32.c -fo=$@
  112. $(O)win32i64.obj: win32\win32i64.c $(ZIP_H)
  113. $(cc) $(cdebug) $(cflags) $(cvars) win32\win32i64.c -fo=$@
  114. $(O)win32zip.obj: win32\win32zip.c $(ZIP_H) win32\win32zip.h win32\nt.h
  115. $(cc) $(cdebug) $(cflags) $(cvars) win32\win32zip.c -fo=$@
  116. $(O)nt.obj: win32\nt.c $(ZIP_H) win32\nt.h
  117. $(cc) $(cdebug) $(cflags) $(cvars) win32\nt.c -fo=$@
  118. $(O)match32.obj: win32\match32.asm
  119. $(asm) $(aflags) $(avars) win32\match32.asm -fo=$@
  120. $(O)crc_i386.obj: win32\crc_i386.asm
  121. $(asm) $(aflags) $(avars) win32\crc_i386.asm -fo=$@
  122. # Variant object files for ZipNote, ZipCloak, and ZipSplit:
  123. $(O)zipfile_.obj: zipfile.c $(ZIP_H) crc32.h
  124. $(cc) $(cdebug) $(cflags) $(cvars) -DUTIL zipfile.c -fo=$@
  125. $(O)fileio_.obj: fileio.c $(ZIP_H) crc32.h
  126. $(cc) $(cdebug) $(cflags) $(cvars) -DUTIL fileio.c -fo=$@
  127. $(O)util_.obj: util.c $(ZIP_H)
  128. $(cc) $(cdebug) $(cflags) $(cvars) -DUTIL util.c -fo=$@
  129. $(O)crc32_.obj: crc32.c $(ZIP_H) crc32.h
  130. $(cc) $(cdebug) $(cflags) $(cvars) -DUTIL crc32.c -fo=$@
  131. $(O)crypt_.obj: crypt.c $(ZIP_H) crypt.h crc32.h ttyio.h
  132. $(cc) $(cdebug) $(cflags) $(cvars) -DUTIL crypt.c -fo=$@
  133. $(O)win32_.obj: win32\win32.c $(ZIP_H) win32\win32zip.h
  134. $(cc) $(cdebug) $(cflags) $(cvars) -DUTIL win32\win32.c -fo=$@
  135. $(O)win32i64_.obj: win32\win32i64.c $(ZIP_H)
  136. $(cc) $(cdebug) $(cflags) $(cvars) -DUTIL win32\win32i64.c -fo=$@
  137. $(O)zip.res: win32\zip.rc revision.h
  138. $(rc) -r $(rcflags) -fo=$@ win32\zip.rc
  139. # Creation of subdirectory for intermediate files
  140. $(OBDIR):
  141. -mkdir $@
  142. # Unwanted file removal:
  143. clean: .SYMBOLIC
  144. del $(O)*.obj
  145. cleaner: clean .SYMBOLIC
  146. del Zip.exe
  147. del ZipNote.exe
  148. del ZipCloak.exe
  149. del ZipSplit.exe