1# Makefile for UnZip 5.53 using Manx Aztec C 5.2, last revised 25 Dec 06.
2# Define EXTRA=xxx on the Make command line for e.g. -dUSE_UNSHRINK.
3
4EXTRA =
5
6DEFINES = -d AMIGA $(EXTRA)
7VERNUMS = -d __VERSION__=5 -d __REVISION__=2
8
9CC = cc
10LD = ln
11
12LDLIBS = -lc16
13
14# release version:
15# ----------------
16CFLAGS = -ps -wcpr0u -sabfmnpu $(DEFINES)
17# -ps means short ints, -wcpr0u is type checking, -sabfmnpu is optimizations..
18# Option flags MORE and ASM_* are now set in the Aztec section of amiga/amiga.h;
19# it's cleaner, and that way any changes forces a recompile.
20LDFLAGS = +q -m
21# Linker arg -m suppresses warnings about overriding c.lib functions.
22
23# debug version:
24# --------------
25CFLAGD = -ps -wcpr0u -bs -s0f0n $(DEFINES)
26# -bs is include source debugging info, -s0f0n is avoid hard-to-debug optimizations
27LDFLAGD = +q -m -g -w
28# -g activates source-level debugging (a .dbg file), -w saves assembly-level symbols
29
30# the directory for object files:
31O = obA/
32
33OBJS = $(O)unzip.o $(O)envargs.o $(O)process.o $(O)extract.o \
34         $(O)explode.o $(O)ubz2err.o $(O)unshrink.o $(O)unreduce.o \
35         $(O)inflate.o $(O)match.o $(O)zipinfo.o $(O)list.o $(O)globals.o \
36         $(O)crypt.o $(O)ttyio.o $(O)fileio.o $(O)crc32.o $(O)timezone.o \
37         $(O)amiga.o $(O)crc_68.o $(O)flate.o
38
39XOBJS = $(O)unzip.xo $(O)process.xo $(O)extract.xo $(O)ubz2err.xo \
40         $(O)inflate.xo $(O)match.xo $(O)globals.xo $(O)crypt.xo \
41         $(O)ttyio.xo $(O)fileio.xo $(O)crc32.xo $(O)timezone.xo \
42         $(O)amiga.xo $(O)crc_68.o $(O)flate.xo
43
44FOBJS = $(O)funzip.o $(O)inflate.fo $(O)crypt.fo $(O)ttyio.fo $(O)globals.fo \
45         $(O)crc32.fo $(O)filedate.fo $(O)crc_68.o $(O)flate.fo
46
47DBJS = $(O)unzip.od $(O)envargs.od $(O)process.od \
48         $(O)extract.od $(O)explode.od $(O)unshrink.od $(O)unreduce.od \
49         $(O)inflate.od $(O)match.od $(O)zipinfo.od $(O)list.od $(O)globals.od \
50         $(O)crypt.od $(O)ttyio.od $(O)fileio.od $(O)crc32.od $(O)timezone.od \
51         $(O)amiga.od $(O)crc_68.o $(O)flate.o
52
53XDBJS = $(O)unzip.xd $(O)process.xd $(O)extract.xd \
54         $(O)inflate.xd $(O)match.xd $(O)globals.xd $(O)crypt.xd \
55         $(O)ttyio.xd $(O)fileio.xd $(O)crc32.xd $(O)timezone.xd \
56         $(O)amiga.xd $(O)crc_68.o $(O)flate.xo
57
58FDBJS = $(O)funzip.od $(O)inflate.fd $(O)crypt.fd $(O)ttyio.fd $(O)globals.fd \
59         $(O)crc32.fd $(O)filedate.fd $(O)crc_68.o $(O)flate.fo
60
61
62.c.o :
63	$(CC) -o $@ $(CFLAGS) $*.c
64
65.c.xo:
66	$(CC) -o $@ -d SFX $(CFLAGS) $*.c
67
68.c.fo:
69	$(CC) -o $@ -d FUNZIP $(CFLAGS) $*.c
70
71.c.od :
72	$(CC) -o $@ $(CFLAGD) $*.c
73
74.c.xd:
75	$(CC) -o $@ -d SFX $(CFLAGD) $*.c
76
77.c.fd:
78	$(CC) -o $@ -d FUNZIP $(CFLAGD) $*.c
79
80# HERE WE GO:
81
82all : Unzip UnzipSFX fUnzip MakeSFX
83
84u : Unzip
85
86f : fUnzip
87
88x : UnzipSFX
89
90m : MakeSFX
91
92dall: Unzip.dbg UnzipSFX.dbg fUnzip.dbg MakeSFX.dbg
93
94ud : Unzip.dbg
95
96fd : fUnzip.dbg
97
98xd : UnzipSFX.dbg
99
100md : MakeSFX.dbg
101
102
103Unzip :     $(OBJS)
104	$(LD) $(LDFLAGS) -o Unzip $(OBJS) $(LDLIBS)
105	-@delete Unzip.dbg
106
107UnzipSFX :  $(XOBJS) MakeSFX
108	$(LD) $(LDFLAGS) -o UnzipSFX $(XOBJS) $(LDLIBS)
109	-@delete UnzipSFX.dbg
110
111fUnzip :    $(FOBJS)
112	$(LD) $(LDFLAGS) -o fUnzip $(FOBJS) $(LDLIBS)
113	-@delete fUnzip.dbg
114
115MakeSFX :   amiga/makesfx.c
116	$(CC) $(CFLAGS) -o t:makesfx.o amiga/makesfx.c
117	$(LD) $(LDFLAGS) -o MakeSFX t:makesfx.o $(LDLIBS)
118	-@delete MakeSFX.dbg
119	-@delete t:makesfx.o
120
121
122Unzip.dbg :     $(DBJS)
123	$(LD) $(LDFLAGD) -o Unzip $(DBJS) $(LDLIBS)
124
125UnzipSFX.dbg :  $(XDBJS) MakeSFX.dbg
126	$(LD) $(LDFLAGD) -o UnzipSFX $(XDBJS) $(LDLIBS)
127
128fUnzip.dbg :    $(FDBJS)
129	$(LD) $(LDFLAGD) -o fUnzip $(FDBJS) $(LDLIBS)
130
131MakeSFX.dbg :   amiga/makesfx.c
132	$(CC) $(CFLAGD) -o t:makesfx.o amiga/makesfx.c
133	$(LD) $(LDFLAGD) -o MakeSFX t:makesfx.o $(LDLIBS)
134	-@delete t:makesfx.o
135
136
137clean :
138	-delete $(OBJS)
139	-delete $(XOBJS)
140	-delete $(FOBJS)
141	-delete $(DBJS)
142	-delete $(XDBJS)
143	-delete $(FDBJS)
144	-delete amiga/gbloffs amiga/Fgbloffs amiga/Xgbloffs
145
146cleaner : clean
147	-delete UnZip fUnZip UnZipSFX MakeSFX *.dbg
148
149# header dependencies:
150
151$(OBJS) $(XOBJS) $(FOBJS) : unzip.h unzpriv.h globals.h \
152                             amiga/amiga.h amiga/z-stat.h
153$(DBJS) $(XDBJS) $(FDBJS) : unzip.h unzpriv.h globals.h \
154                             amiga/amiga.h amiga/z-stat.h
155
156$(O)crypt.o  $(O)crypt.fo $(O)timezone.o  $(O)ttyio.o  $(O)ttyio.fo : zip.h
157$(O)crypt.od $(O)crypt.fd $(O)timezone.od $(O)ttyio.od $(O)ttyio.fd : zip.h
158
159$(O)inflate.o $(O)inflate.fo $(O)inflate.od $(O)inflate.fd : inflate.h
160
161$(O)fileio.o $(O)fileio.od : ebcdic.h
162
163$(O)funzip.o $(O)funzip.od : crc32.h
164$(O)crc32.o  $(O)crc32.fo $(O)crc32.xo : crc32.h
165$(O)crc32.od $(O)crc32.fd $(O)crc32.xd : crc32.h
166$(O)crypt.o  $(O)crypt.fo $(O)crypt.xo : crc32.h
167$(O)crypt.od $(O)crypt.fd $(O)crypt.xd : crc32.h
168$(O)extract.o $(O)extract.xo $(O)extract.od $(O)extract.xd : crc32.h
169$(O)fileio.o $(O)fileio.xo $(O)fileio.od $(O)fileio.xd : crc32.h
170$(O)process.o $(O)process.xo $(O)process.od $(O)process.xd : crc32.h
171
172$(O)crypt.o  $(O)crypt.fo $(O)crypt.xo : crypt.h
173$(O)crypt.od $(O)crypt.fd $(O)crypt.xd : crypt.h
174$(O)ttyio.o  $(O)ttyio.fo $(O)ttyio.xo : crypt.h
175$(O)ttyio.od $(O)ttyio.fd $(O)ttyio.xd : crypt.h
176$(O)unzip.o  $(O)unzip.xo $(O)funzip.o  : crypt.h
177$(O)unzip.od $(O)unzip.xd $(O)funzip.od : crypt.h
178$(O)fileio.o  $(O)fileio.xo $(O)extract.o  $(O)extract.xo : crypt.h
179$(O)fileio.od $(O)fileio.xd $(O)extract.od $(O)extract.xd : crypt.h
180$(O)inflate.o  $(O)inflate.fo $(O)inflate.xo $(O)filedate.fo : crypt.h
181$(O)inflate.od $(O)inflate.fd $(O)inflate.xd $(O)filedate.fd : crypt.h
182amiga/gbloffs amiga/Fgbloffs amiga/Xgbloffs : crypt.h
183
184$(O)crypt.o  $(O)crypt.fo $(O)crypt.xo : ttyio.h
185$(O)crypt.od $(O)crypt.fd $(O)crypt.xd : ttyio.h
186$(O)ttyio.o  $(O)ttyio.fo $(O)ttyio.xo : ttyio.h
187$(O)ttyio.od $(O)ttyio.fd $(O)ttyio.xd : ttyio.h
188$(O)funzip.o  $(O)fileio.o  $(O)fileio.xo : ttyio.h
189$(O)funzip.od $(O)fileio.od $(O)fileio.xd : ttyio.h
190
191$(O)timezone.o  $(O)timezone.xo $(O)amiga.o  $(O)amiga.xo : timezone.h
192$(O)timezone.od $(O)timezone.xd $(O)amiga.od $(O)amiga.xd : timezone.h
193
194$(O)unzip.o $(O)unzip.xo $(O)unzip.od $(O)unzip.xd : unzvers.h consts.h
195
196
197# Special case object files:
198
199$(O)amiga.o : amiga/filedate.c amiga/stat.c amiga/amiga.c unzvers.h
200	rx > env:VersionDate "say '""'translate(date('E'), '.', '/')'""'"
201	$(CC) -o $(O)amiga.o $(CFLAGS) $(VERNUMS) amiga/amiga.c
202
203$(O)amiga.xo : amiga/filedate.c amiga/stat.c amiga/amiga.c unzvers.h
204	$(CC) -o $(O)amiga.xo $(CFLAGS) $(VERNUMS) -d SFX amiga/amiga.c
205
206$(O)amiga.od : amiga/filedate.c amiga/stat.c amiga/amiga.c unzvers.h
207	rx > env:VersionDate "say '""'translate(date('E'), '.', '/')'""'"
208	$(CC) -o $(O)amiga.od $(CFLAGD) $(VERNUMS) amiga/amiga.c
209
210$(O)amiga.xd : amiga/filedate.c amiga/stat.c amiga/amiga.c unzvers.h
211	$(CC) -o $(O)amiga.xd $(CFLAGD) $(VERNUMS) -d SFX amiga/amiga.c
212
213$(O)crc_68.o : amiga/crc_68.a
214	as -n -o $(O)crc_68.o amiga/crc_68.a
215# no debug version of crc_68
216
217$(O)filedate.fo : amiga/filedate.c
218	$(CC) -o $(O)filedate.fo -d FUNZIP $(CFLAGS) amiga/filedate.c
219
220$(O)filedate.fd : amiga/filedate.c
221	$(CC) -o $(O)filedate.fd -d FUNZIP $(CFLAGD) amiga/filedate.c
222
223# The file t:G_offs.a is generated on the fly by programs we compile
224# and then run, and then it's included into amiga/flate.a to provide
225# definitions for it.  There are no debug versions of flate.o.
226
227$(O)flate.o : amiga/flate.a amiga/gbloffs
228	amiga/gbloffs > t:G_offs.a
229	as -n -o $(O)flate.o -eINT16 amiga/flate.a
230	-@delete t:G_offs.a
231
232$(O)flate.fo : amiga/flate.a amiga/Fgbloffs
233	amiga/Fgbloffs > t:G_offs.a
234	as -n -o $(O)flate.fo -eINT16 -eFUNZIP -eAZTEC amiga/flate.a
235	-@delete t:G_offs.a
236
237$(O)flate.xo : amiga/flate.a amiga/Xgbloffs
238	amiga/Xgbloffs > t:G_offs.a
239	as -n -o $(O)flate.xo -eINT16 -eSFX amiga/flate.a
240	-@delete t:G_offs.a
241
242# Here are the programs that generate different versions of G_offs.a:
243
244amiga/gbloffs : gbloffs.c unzip.h unzpriv.h globals.h amiga/amiga.h crypt.h
245	$(CC) -o t:gbloffs.o $(CFLAGS) gbloffs.c
246	$(LD) $(LDFLAGS) -o amiga/gbloffs t:gbloffs.o $(LDLIBS)
247	-@delete t:gbloffs.o
248
249amiga/Fgbloffs : gbloffs.c unzip.h unzpriv.h globals.h amiga/amiga.h crypt.h
250	$(CC) -o t:gbloffs.o $(CFLAGS) -d FUNZIP gbloffs.c
251	$(LD) $(LDFLAGS) -o amiga/Fgbloffs t:gbloffs.o $(LDLIBS)
252	-@delete t:gbloffs.o
253
254amiga/Xgbloffs : gbloffs.c unzip.h unzpriv.h globals.h amiga/amiga.h crypt.h
255	$(CC) -o t:gbloffs.o $(CFLAGS) -d SFX gbloffs.c
256	$(LD) $(LDFLAGS) -o amiga/Xgbloffs t:gbloffs.o $(LDLIBS)
257	-@delete t:gbloffs.o
258