summaryrefslogtreecommitdiff
path: root/msdos/makefile.tc
blob: 9ce3e3212b7caa07f8fc4d5de8c4c3338d9afc4a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
# Makefile for Zip, ZipCloak, ZipNote and ZipSplit for
# Turbo C 2.0. (Thanks to Andrew Cadach <kadach@isi.itfs.nsk.su>)

# To use, do "make -fmakefile.tc"

# WARNING: the small model is not supported. You must use the large model.
# Add -DSMALL_MEM or -DMEDIUM_MEM to the LOC macro if you wish to reduce
# the memory requirements.
# Add -DNO_ASM to CFLAGS and comment out the ASMOBJS definition if
# you do not have tasm.

# Optional nonstandard preprocessor flags (as -DMEDIUM_MEM or -DNO_ASM)
# should be added to the environment via "set LOCAL_ZIP=-DFOO" or added
# to the declaration of LOC here:
LOC = -DDOS -DNO_SECURE_TESTS $(LOCAL_ZIP)

# Zip requires compact or large memory model.
# with 2.1, compact model exceeds 64k code segment; use large model
ZIPMODEL=l	# large model for Zip and ZipUtils

# name of Flag to select memory model for assembler compiles, supported
# values are __SMALL__ , __MEDIUM__ , __COMPACT__ , __LARGE__ :
ASMODEL=__LARGE__		# keep in sync with ZIPMODEL definition !!

# Type for CPU required: 0: 8086, 1: 80186, 2: 80286, 3: 80386, etc.
CPU_TYP = 0

# Uncomment the following macro to use the optimized assembler
# routines in Zip:
ASMOBJS = match.obj crc_i86.obj

ASCPUFLAG = __$(CPU_TYP)86

# ------------- Turbo C 2.0 -------------
MODEL=-m$(ZIPMODEL)
CFLAGS=-w -w-eff -w-def -w-sig -w-cln -a -d -G -O -Z $(MODEL) $(LOC)
UTILFLAGS=-DUTIL $(CFLAGS) -o
CC=tcc

# Old versions of tasm (prior to 2.01) may not like the "-m2" option...
AS=tasm
ASFLAGS=-ml -t -m2 -DDYN_ALLOC -DSS_NEQ_DS -D$(ASCPUFLAG) -D$(ASMODEL) $(LOC)

LD=tcc
LDFLAGS=$(MODEL)

# ------------- Common declarations:
STRIP=rem
#    If you don't have UPX, LZEXE, or PKLITE, get one of them. Then define:
#    (NOTE: upx needs a 386 or higher system to run the exe compressor)
#STRIP=upx --8086 --best
#    or
#STRIP=lzexe
#    or (if you've registered PKLITE)
#STRIP=pklite
#    This makes a big difference in .exe size (and possibly load time)

# ------------- Used by install rule
# set BIN to the directory you want to install the executables to
BIN = c:\util

# variables
OBJZ = zip.obj crypt.obj ttyio.obj zipfile.obj zipup.obj fileio.obj util.obj \
	crc32.obj globals.obj

OBJI = deflate.obj trees.obj $(ASMOBJS) msdos.obj

OBJU = _zipfile.obj _fileio.obj _util.obj globals.obj _msdos.obj
OBJN = zipnote.obj $(OBJU)
OBJC = zipcloak.obj _crc32.obj _crypt.obj ttyio.obj $(OBJU)
OBJS = zipsplit.obj $(OBJU)

ZIP_H = zip.h ziperr.h tailor.h msdos/osdep.h

ZIPS = zip.exe zipnote.exe zipsplit.exe zipcloak.exe

zips:	$(ZIPS)

zip.obj:	zip.c $(ZIP_H) revision.h crc32.h crypt.h ttyio.h
	$(CC) -c $(CFLAGS) $*.c

zipfile.obj:	zipfile.c $(ZIP_H) crc32.h
	$(CC) -c $(CFLAGS) $*.c

zipup.obj:	zipup.c $(ZIP_H) revision.h crc32.h crypt.h msdos/zipup.h
	$(CC) -c $(CFLAGS) $*.c

fileio.obj:	fileio.c $(ZIP_H) crc32.h
	$(CC) -c $(CFLAGS) $*.c

util.obj:	util.c $(ZIP_H)
	$(CC) -c $(CFLAGS) $*.c

globals.obj:	globals.c $(ZIP_H)
	$(CC) -c $(CFLAGS) $*.c

deflate.obj:	deflate.c $(ZIP_H)
	$(CC) -c $(CFLAGS) $*.c

trees.obj:	trees.c $(ZIP_H)
	$(CC) -c $(CFLAGS) $*.c

crc32.obj:	crc32.c $(ZIP_H) crc32.h
	$(CC) -c $(CFLAGS) $*.c

crypt.obj:	crypt.c $(ZIP_H) crypt.h crc32.h ttyio.h
	$(CC) -c $(CFLAGS) $*.c

ttyio.obj:	ttyio.c $(ZIP_H) crypt.h ttyio.h
	$(CC) -c $(CFLAGS) $*.c

msdos.obj:	msdos/msdos.c $(ZIP_H)
	$(CC) -c $(CFLAGS) msdos/$*.c

zipcloak.obj:	zipcloak.c $(ZIP_H) revision.h crc32.h crypt.h ttyio.h
	$(CC) -c $(CFLAGS) -o$* $*.c

zipnote.obj:	zipnote.c $(ZIP_H) revision.h
	$(CC) -c $(CFLAGS) -o$* $*.c

zipsplit.obj:	zipsplit.c $(ZIP_H) revision.h
	$(CC) -c $(CFLAGS) -o$* $*.c

_zipfile.obj:	zipfile.c $(ZIP_H) crc32.h
	$(CC) -c $(UTILFLAGS)$* zipfile.c

_fileio.obj:	fileio.c $(ZIP_H) crc32.h
	$(CC) -c $(UTILFLAGS)$* fileio.c

_util.obj:	util.c $(ZIP_H)
	$(CC) -c $(UTILFLAGS)$* util.c

_crc32.obj:	crc32.c $(ZIP_H) crc32.h
	$(CC) -c $(UTILFLAGS)$* crc32.c

_crypt.obj:	crypt.c $(ZIP_H) crypt.h crc32.h ttyio.h
	$(CC) -c $(UTILFLAGS)$* crypt.c

_msdos.obj:	msdos/msdos.c $(ZIP_H)
	$(CC) -c $(UTILFLAGS)$* msdos/msdos.c

crc_i86.obj:	msdos/crc_i86.asm
	$(AS) $(ASFLAGS) msdos\crc_i86.asm ;

match.obj:	msdos/match.asm
	$(AS) $(ASFLAGS) msdos\match.asm ;

# make sure the command line fits in the MS/DOS 128 byte limit:
zip.exe: $(OBJZ) $(OBJI)
	rem   ignore any warnings in the following renaming commands:
	ren _*.obj _*.ob
	ren zipcloak.obj *.ob
	ren zipnote.obj *.ob
	ren zipsplit.obj *.ob
	$(LD) $(LDFLAGS) -ezip.exe *.obj
	ren _*.ob _*.obj
	ren zip???*.ob *.obj
	$(STRIP) zip.exe

zipcloak.exe: $(OBJC)
	$(LD) $(LDFLAGS) -ezipcloak.exe $(OBJC)
	$(STRIP) zipcloak.exe

zipnote.exe: $(OBJN)
	$(LD) $(LDFLAGS) -ezipnote.exe $(OBJN)
	$(STRIP) zipnote.exe

zipsplit.exe: $(OBJS)
	$(LD) $(LDFLAGS) -ezipsplit.exe $(OBJS)
	$(STRIP) zipsplit.exe

install:        $(ZIPS)
	copy /b *.exe $(BIN)

clean:
	del *.obj
	del *.exe