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 13variation = $(%LOCAL_ZIP) 14 15# Stifle annoying "Delete this file?" questions when errors occur: 16.ERASE 17 18.EXTENSIONS: 19.EXTENSIONS: .exe .obj .c .h .asm 20 21# We maintain multiple sets of object files in different directories so that 22# we can compile msdos, dos/4gw, and win32 versions of Zip without their 23# 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 28OBDIR = od32w 29!else 30OBDIR = ob32w 31!endif 32O = $(OBDIR)\ # comment here so backslash won't continue the line 33 34# The assembly hot-spot code in crc_i386.asm and match32.asm is optional. 35# This section controls its usage. 36 37!ifdef NOASM 38asmob = 39asmco = 40cvars = $+$(cvars)$- -DNO_ASM # otherwise ASM_CRC might default on! 41# "$+$(foo)$-" means expand foo as it has been defined up to now; normally, 42# this make defers inner expansion until the outer macro is expanded. 43!else # !NOASM 44asmco = $(O)crc_i386.obj 45asmob = $(asmco) $(O)match32.obj 46cvars = $+$(cvars)$- -DASMV -DASM_CRC 47!endif 48 49# Our object files. OBJZ is for Zip, OBJC is for ZipCloak, OBJN is for 50# ZipNote, and OBJS is for ZipSplit: 51 52OBJZ3 = $(O)zip.obj $(O)crypt.obj $(O)ttyio.obj $(O)trees.obj $(O)zipup.obj 53OBJZ2 = $(OBJZ3) $(O)util.obj $(O)zipfile.obj $(O)fileio.obj $(O)deflate.obj 54OBJZ1 = $(OBJZ2) $(O)globals.obj $(O)crc32.obj $(asmob) 55OBJZ = $(OBJZ1) $(O)win32zip.obj $(O)win32.obj $(O)win32i64.obj $(O)nt.obj 56 57OBJU1 = $(O)zipfile_.obj $(O)fileio_.obj $(O)util_.obj $(O)crc32_.obj $(asmco) 58OBJ_U = $(OBJU1) $(O)globals.obj $(O)win32_.obj $(O)win32i64_.obj 59 60OBJC = $(O)zipcloak.obj $(O)crypt_.obj $(O)ttyio.obj $(OBJ_U) 61 62OBJN = $(O)zipnote.obj $(OBJ_U) 63 64OBJS = $(O)zipsplit.obj $(OBJ_U) 65 66# Common header files included by all C sources: 67 68ZIP_H = zip.h ziperr.h tailor.h win32\osdep.h 69 70# Now we have to pick out the proper compiler and options for it. 71 72cc = wcc386 73link = wlink 74asm = wasm 75rc = wrc 76# Use Pentium Pro timings, register args, static strings in code: 77cflags = -bt=NT -6r -zt -zq 78aflags = -bt=NT -mf -3 -zq 79rcflags= -bt=NT -DWIN32 -iwin32 -q 80lflags = sys NT 81cvars = $+$(cvars)$- -DWIN32 $(variation) 82avars = $+$(avars)$- -DWATCOM_DSEG $(variation) 83 84# Specify optimizations, or a nonoptimized debugging version: 85 86!ifdef DEBUG 87cdebug = -od -d2 88ldebug = d w all op symf 89!else 90cdebug = -s -obhikl+rt -oe=100 -zp8 91# -oa helps slightly but might be dangerous. 92ldebug = op el 93!endif 94 95# How to compile sources: 96.c.obj: 97 $(cc) $(cdebug) $(cflags) $(cvars) $[@ -fo=$@ 98 99# Here we go! By default, make all targets: 100all: Zip.exe ZipNote.exe ZipCloak.exe ZipSplit.exe 101 102# Convenient shorthand options for single targets: 103z: Zip.exe .SYMBOLIC 104n: ZipNote.exe .SYMBOLIC 105c: ZipCloak.exe .SYMBOLIC 106s: ZipSplit.exe .SYMBOLIC 107 108Zip.exe: $(OBDIR) $(OBJZ) $(O)zip.res 109 $(link) $(lflags) $(ldebug) name $@ file {$(OBJZ)} 110 $(rc) $(O)zip.res $@ 111 112ZipNote.exe: $(OBDIR) $(OBJN) 113 $(link) $(lflags) $(ldebug) name $@ file {$(OBJN)} 114 115ZipCloak.exe: $(OBDIR) $(OBJC) 116 $(link) $(lflags) $(ldebug) name $@ file {$(OBJC)} 117 118ZipSplit.exe: $(OBDIR) $(OBJS) 119 $(link) $(lflags) $(ldebug) name $@ file {$(OBJS)} 120 121# Source dependencies: 122 123$(O)crc32.obj: crc32.c $(ZIP_H) crc32.h # only used if NOASM 124$(O)crypt.obj: crypt.c $(ZIP_H) crypt.h crc32.h ttyio.h 125$(O)deflate.obj: deflate.c $(ZIP_H) 126$(O)fileio.obj: fileio.c $(ZIP_H) crc32.h 127$(O)globals.obj: globals.c $(ZIP_H) 128$(O)trees.obj: trees.c $(ZIP_H) 129$(O)ttyio.obj: ttyio.c $(ZIP_H) crypt.h ttyio.h 130$(O)util.obj: util.c $(ZIP_H) 131$(O)zip.obj: zip.c $(ZIP_H) crc32.h crypt.h revision.h ttyio.h 132$(O)zipfile.obj: zipfile.c $(ZIP_H) crc32.h 133$(O)zipup.obj: zipup.c $(ZIP_H) revision.h crc32.h crypt.h win32\zipup.h 134$(O)zipnote.obj: zipnote.c $(ZIP_H) revision.h 135$(O)zipcloak.obj: zipcloak.c $(ZIP_H) revision.h crc32.h crypt.h ttyio.h 136$(O)zipsplit.obj: zipsplit.c $(ZIP_H) revision.h 137 138# Special case object files: 139 140$(O)win32.obj: win32\win32.c $(ZIP_H) win32\win32zip.h 141 $(cc) $(cdebug) $(cflags) $(cvars) win32\win32.c -fo=$@ 142 143$(O)win32i64.obj: win32\win32i64.c $(ZIP_H) 144 $(cc) $(cdebug) $(cflags) $(cvars) win32\win32i64.c -fo=$@ 145 146$(O)win32zip.obj: win32\win32zip.c $(ZIP_H) win32\win32zip.h win32\nt.h 147 $(cc) $(cdebug) $(cflags) $(cvars) win32\win32zip.c -fo=$@ 148 149$(O)nt.obj: win32\nt.c $(ZIP_H) win32\nt.h 150 $(cc) $(cdebug) $(cflags) $(cvars) win32\nt.c -fo=$@ 151 152$(O)match32.obj: win32\match32.asm 153 $(asm) $(aflags) $(avars) win32\match32.asm -fo=$@ 154 155$(O)crc_i386.obj: win32\crc_i386.asm 156 $(asm) $(aflags) $(avars) win32\crc_i386.asm -fo=$@ 157 158# Variant object files for ZipNote, ZipCloak, and ZipSplit: 159 160$(O)zipfile_.obj: zipfile.c $(ZIP_H) crc32.h 161 $(cc) $(cdebug) $(cflags) $(cvars) -DUTIL zipfile.c -fo=$@ 162 163$(O)fileio_.obj: fileio.c $(ZIP_H) crc32.h 164 $(cc) $(cdebug) $(cflags) $(cvars) -DUTIL fileio.c -fo=$@ 165 166$(O)util_.obj: util.c $(ZIP_H) 167 $(cc) $(cdebug) $(cflags) $(cvars) -DUTIL util.c -fo=$@ 168 169$(O)crc32_.obj: crc32.c $(ZIP_H) crc32.h 170 $(cc) $(cdebug) $(cflags) $(cvars) -DUTIL crc32.c -fo=$@ 171 172$(O)crypt_.obj: crypt.c $(ZIP_H) crypt.h crc32.h ttyio.h 173 $(cc) $(cdebug) $(cflags) $(cvars) -DUTIL crypt.c -fo=$@ 174 175$(O)win32_.obj: win32\win32.c $(ZIP_H) win32\win32zip.h 176 $(cc) $(cdebug) $(cflags) $(cvars) -DUTIL win32\win32.c -fo=$@ 177 178$(O)win32i64_.obj: win32\win32i64.c $(ZIP_H) 179 $(cc) $(cdebug) $(cflags) $(cvars) -DUTIL win32\win32i64.c -fo=$@ 180 181$(O)zip.res: win32\zip.rc revision.h 182 $(rc) -r $(rcflags) -fo=$@ win32\zip.rc 183 184# Creation of subdirectory for intermediate files 185$(OBDIR): 186 -mkdir $@ 187 188# Unwanted file removal: 189 190clean: .SYMBOLIC 191 del $(O)*.obj 192 193cleaner: clean .SYMBOLIC 194 del Zip.exe 195 del ZipNote.exe 196 del ZipCloak.exe 197 del ZipSplit.exe 198