| 1 |
# Makefile for Zip, ZipCloak, ZipNote and ZipSplit for |
| 2 |
# Microsoft C 5.1 and above. |
| 3 |
|
| 4 |
# To use, do "make makefile.msc" |
| 5 |
|
| 6 |
# Add -DSMALL_MEM or -DMEDIUM_MEM to the LOC macro if you wish to reduce |
| 7 |
# the memory requirements. |
| 8 |
# Add -DNO_ASM to CFLAGS and comment out the ASMOBJS definition if |
| 9 |
# you do not have masm. |
| 10 |
# |
| 11 |
# If you want link Zip against zlib to replace the built-in deflate routines, |
| 12 |
# the following changes are required: |
| 13 |
# - in the definition of "LOC", add "-DUSE_ZLIB" and remove "-DNO_SECURE_TESTS" |
| 14 |
# - comment out the "ASMOBJS" symbol definition |
| 15 |
# - modify the linking command blocks for zip and zipcloak according to |
| 16 |
# the following scheme: |
| 17 |
# add a command line "echo ,,,zlib_$(ZIPMODEL); >> zip[c].rsp" just |
| 18 |
# before the "$(LD)..." line; and remove the semicolon character from the |
| 19 |
# "echo ..." line immediately preceding the just inserted command |
| 20 |
|
| 21 |
|
| 22 |
# Optional nonstandard preprocessor flags (as -DMEDIUM_MEM or -DNO_ASM) |
| 23 |
# should be added to the environment via "set LOCAL_ZIP=-DFOO" or added |
| 24 |
# to the declaration of LOC here: |
| 25 |
LOC = -DDOS -DDYN_ALLOC -DNO_SECURE_TESTS $(LOCAL_ZIP) |
| 26 |
|
| 27 |
# Zip requires compact or large memory model. |
| 28 |
# with 2.1, compact model exceeds 64k code segment; use large model |
| 29 |
ZIPMODEL=L # large model for Zip and ZipUtils |
| 30 |
|
| 31 |
# name of Flag to select memory model for assembler compiles, supported |
| 32 |
# values are __SMALL__ , __MEDIUM__ , __COMPACT__ , __LARGE__ : |
| 33 |
ASMODEL=__LARGE__ # keep in sync with ZIPMODEL definition !! |
| 34 |
|
| 35 |
# Type for CPU required: 0: 8086, 1: 80186, 2: 80286, 3: 80386, etc. |
| 36 |
CPU_TYP = 0 |
| 37 |
|
| 38 |
# Uncomment the following macro to use the optimized assembler |
| 39 |
# routines in Zip: |
| 40 |
ASMOBJS = match.obj crc_i86.obj |
| 41 |
|
| 42 |
ASCPUFLAG = __$(CPU_TYP)86 |
| 43 |
|
| 44 |
# ------------- Microsoft C 5.1, 6.0, 7.0 and VC++ Pro 1.0 ------------- |
| 45 |
CC=cl |
| 46 |
MODEL=-A$(ZIPMODEL) |
| 47 |
FP= |
| 48 |
# With the feature additions of Zip 3, the default data segment gets occupied |
| 49 |
# with too much initialized data to fit into 64k. As a workaround, for some |
| 50 |
# source files with large amount of message strings, -Gt<num> is used to |
| 51 |
# force data items of size <num> or larger into their own data segments. |
| 52 |
COMMON_CFLAGS=-nologo -I. $(MODEL) $(FP) -DMSC $(LOC) -W3 -G$(CPU_TYP) |
| 53 |
CFLAGS=$(COMMON_CFLAGS) -Ox |
| 54 |
SPECFLAGS=$(COMMON_CFLAGS) -Oaict -Gs |
| 55 |
# For MSC/C++ 7.0 and VC++ no special flags are needed: |
| 56 |
# SPECFLAGS=$(CFLAGS) |
| 57 |
UTILFLAGS=-DUTIL $(CFLAGS) -Fo |
| 58 |
|
| 59 |
AS=masm |
| 60 |
ASFLAGS=-ml -t -D$(ASCPUFLAG) -D$(ASMODEL) $(LOC) |
| 61 |
# For MSC 6.0, use: |
| 62 |
#AS=ml |
| 63 |
#ASFLAGS=-c -D$(ASCPUFLAG) -D$(ASMODEL) $(LOC) |
| 64 |
# Supress -DDYN_ALLOC in ASFLAGS if you have suppressed it in CFLAGS |
| 65 |
|
| 66 |
LD=link |
| 67 |
LDFLAGS=/noi/farcall/packcode/e/st:0x1400/m |
| 68 |
# If you use an exe packer as recommended below, remove /e from LDFLAGS |
| 69 |
|
| 70 |
# ------------- Common declarations: |
| 71 |
STRIP=rem |
| 72 |
# If you don't have UPX, LZEXE, or PKLITE, get one of them. Then define: |
| 73 |
# (NOTE: upx needs a 386 or higher system to run the exe compressor) |
| 74 |
#STRIP=upx --8086 --best |
| 75 |
# or |
| 76 |
#STRIP=lzexe |
| 77 |
# or (if you've registered PKLITE) |
| 78 |
#STRIP=pklite |
| 79 |
# and remove /e from LDFLAGS. |
| 80 |
# This makes a big difference in .exe size (and possibly load time) |
| 81 |
|
| 82 |
# ------------- Used by install rule |
| 83 |
# set BIN to the directory you want to install the executables to |
| 84 |
BIN = c:\util |
| 85 |
|
| 86 |
# variables |
| 87 |
OBJZ = zip.obj crypt.obj ttyio.obj zipfile.obj zipup.obj fileio.obj util.obj \ |
| 88 |
crc32.obj globals.obj |
| 89 |
|
| 90 |
OBJI = deflate.obj trees.obj $(ASMOBJS) msdos.obj |
| 91 |
|
| 92 |
OBJU = zipfile_.obj fileio_.obj util_.obj globals.obj msdos_.obj |
| 93 |
OBJN = zipnote.obj $(OBJU) |
| 94 |
OBJC = zipcloak.obj crc32_.obj crypt_.obj ttyio.obj $(OBJU) |
| 95 |
OBJS = zipsplit.obj $(OBJU) |
| 96 |
|
| 97 |
ZIP_H = zip.h ziperr.h tailor.h msdos/osdep.h |
| 98 |
|
| 99 |
ZIPS = zip.exe zipnote.exe zipsplit.exe zipcloak.exe |
| 100 |
|
| 101 |
zips: $(ZIPS) |
| 102 |
|
| 103 |
zip.obj: zip.c $(ZIP_H) revision.h crc32.h crypt.h ttyio.h |
| 104 |
$(CC) -c $(CFLAGS) -Gt65 $*.c |
| 105 |
|
| 106 |
# MSC 5.1 generates bad code on zipfile with -Ox |
| 107 |
zipfile.obj: zipfile.c $(ZIP_H) crc32.h |
| 108 |
$(CC) -c $(SPECFLAGS) $*.c |
| 109 |
|
| 110 |
zipup.obj: zipup.c $(ZIP_H) revision.h crc32.h crypt.h msdos/zipup.h |
| 111 |
$(CC) -c $(CFLAGS) $*.c |
| 112 |
|
| 113 |
fileio.obj: fileio.c $(ZIP_H) crc32.h |
| 114 |
$(CC) -c $(CFLAGS) $*.c |
| 115 |
|
| 116 |
util.obj: util.c $(ZIP_H) |
| 117 |
$(CC) -c $(CFLAGS) $*.c |
| 118 |
|
| 119 |
globals.obj: globals.c $(ZIP_H) |
| 120 |
$(CC) -c $(CFLAGS) $*.c |
| 121 |
|
| 122 |
deflate.obj: deflate.c $(ZIP_H) |
| 123 |
$(CC) -c $(CFLAGS) $*.c |
| 124 |
|
| 125 |
trees.obj: trees.c $(ZIP_H) |
| 126 |
$(CC) -c $(CFLAGS) $*.c |
| 127 |
|
| 128 |
crc32.obj: crc32.c $(ZIP_H) crc32.h |
| 129 |
$(CC) -c $(CFLAGS) $*.c |
| 130 |
|
| 131 |
crypt.obj: crypt.c $(ZIP_H) crypt.h crc32.h ttyio.h |
| 132 |
$(CC) -c $(CFLAGS) $*.c |
| 133 |
|
| 134 |
ttyio.obj: ttyio.c $(ZIP_H) crypt.h ttyio.h |
| 135 |
$(CC) -c $(CFLAGS) $*.c |
| 136 |
|
| 137 |
msdos.obj: msdos/msdos.c $(ZIP_H) |
| 138 |
$(CC) -c $(CFLAGS) msdos/$*.c |
| 139 |
|
| 140 |
zipcloak.obj: zipcloak.c $(ZIP_H) revision.h crc32.h crypt.h ttyio.h |
| 141 |
$(CC) -c $(CFLAGS) $*.c |
| 142 |
|
| 143 |
zipnote.obj: zipnote.c $(ZIP_H) revision.h |
| 144 |
$(CC) -c $(CFLAGS) $*.c |
| 145 |
|
| 146 |
# MSC 5.1 dies on zipsplit with -Ox |
| 147 |
zipsplit.obj: zipsplit.c $(ZIP_H) revision.h |
| 148 |
$(CC) -c $(SPECFLAGS) $*.c |
| 149 |
|
| 150 |
# MSC 5.1 generates bad code on zipfile with -Ox |
| 151 |
zipfile_.obj: zipfile.c $(ZIP_H) crc32.h |
| 152 |
$(CC) -c $(SPECFLAGS) -DUTIL -Fo$@ zipfile.c |
| 153 |
|
| 154 |
fileio_.obj: fileio.c $(ZIP_H) crc32.h |
| 155 |
$(CC) -c $(UTILFLAGS)$@ fileio.c |
| 156 |
|
| 157 |
util_.obj: util.c $(ZIP_H) |
| 158 |
$(CC) -c $(UTILFLAGS)$@ util.c |
| 159 |
|
| 160 |
crc32_.obj: crc32.c $(ZIP_H) crc32.h |
| 161 |
$(CC) -c $(UTILFLAGS)$@ crc32.c |
| 162 |
|
| 163 |
crypt_.obj: crypt.c $(ZIP_H) crypt.h crc32.h ttyio.h |
| 164 |
$(CC) -c $(UTILFLAGS)$@ crypt.c |
| 165 |
|
| 166 |
msdos_.obj: msdos/msdos.c $(ZIP_H) |
| 167 |
$(CC) -c $(UTILFLAGS)$@ msdos/msdos.c |
| 168 |
|
| 169 |
crc_i86.obj: msdos/crc_i86.asm |
| 170 |
$(AS) $(ASFLAGS) msdos\crc_i86.asm ; |
| 171 |
|
| 172 |
match.obj: msdos/match.asm |
| 173 |
$(AS) $(ASFLAGS) msdos\match.asm ; |
| 174 |
|
| 175 |
# we must cut the command line to fit in the MS/DOS 128 byte limit: |
| 176 |
zip.exe: $(OBJZ) $(OBJI) |
| 177 |
echo $(OBJZ)+ > zip.rsp |
| 178 |
echo $(OBJI); >> zip.rsp |
| 179 |
$(LD) $(LDFLAGS) @zip.rsp |
| 180 |
del zip.rsp |
| 181 |
$(STRIP) zip.exe |
| 182 |
|
| 183 |
zipcloak.exe: $(OBJC) |
| 184 |
echo $(OBJC); > zipc.rsp |
| 185 |
$(LD) $(LDFLAGS) @zipc.rsp |
| 186 |
del zipc.rsp |
| 187 |
$(STRIP) zipcloak.exe |
| 188 |
|
| 189 |
zipnote.exe: $(OBJN) |
| 190 |
echo $(OBJN); > zipn.rsp |
| 191 |
$(LD) $(LDFLAGS) @zipn.rsp |
| 192 |
del zipn.rsp |
| 193 |
$(STRIP) zipnote.exe |
| 194 |
|
| 195 |
zipsplit.exe: $(OBJS) |
| 196 |
echo $(OBJS); > zips.rsp |
| 197 |
$(LD) $(LDFLAGS) @zips.rsp |
| 198 |
del zips.rsp |
| 199 |
$(STRIP) zipsplit.exe |
| 200 |
|
| 201 |
# No `install' and `clean' target possible as long as MSC's old MAKE utility |
| 202 |
# is supported (MSC 5.1 Make always tries to update ALL targets. The result |
| 203 |
# is that install and clean are always executed, unless an error occured.) |
| 204 |
#install: $(ZIPS) |
| 205 |
# copy /b *.exe $(BIN) |
| 206 |
# |
| 207 |
#clean: |
| 208 |
# del *.obj |
| 209 |
# del *.exe |