summaryrefslogtreecommitdiff
path: root/amiga/makefile.azt
blob: d9390c8f2ec01c84a3158459524472b51459c393 (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
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
# Makefile for Zip, ZipNote, ZipCloak, ZipSplit for Aztec C 5.2
# Also ZipLM, a version of Zip that needs much less free memory
#   -- Paul Kienitz, last updated 07 Jan 2007

# Make sure platform is defined correctly, and select memory usage options:
DEFINES = -d AMIGA -d DYN_ALLOC -d ASM_CRC

CC = cc
AS = as
LD = ln
LDLIBS = -lc16


# -------- RELEASE VERSION:
CFLAGS = -psb0e -sabfmnpu -wcr0u $(DEFINES)
# -pbs means unsigned chars and short ints, -sabfmnpu is various small
# optimizations, -wcr0u adjusts type checking strictness
ASOPTS = -n -eAMIGA -eDYN_ALLOC -eCPUTEST -eINT16
LDFLAGS = -m +q

# -------- DEBUG VERSION:
CFLAGD = -bs -psb0e -s0f0n -wcr0u $(DEFINES)
# -bs is include source debugging info, -s0f0n is avoid hard-to-debug
# optimizations
LDFLAGD = -m +q -g -w

# -------- MINIMUM MEMORY USAGE RELEASE VERSION:
WSIZ = WSIZE=4096
LOWFLAGS = $(CFLAGS) -d $(WSIZ) -d SMALL_MEM
LOWASOPTS = $(ASOPTS) -e$(WSIZ) -eSMALL_MEM
# Options used for assembling amiga/deflate.a; must generally match the
# settings in DEFINES.

# -------- MINIMUM MEMORY USAGE DEBUG VERSION:
LOWFLAGD = $(CFLAGD) -d $(WSIZ) -d SMALL_MEM

# the directory where we stick all the object files:
O = obA/


# default C rules
.c.o :
	$(CC) $(CFLAGS) -o $@ $*.c

# rules for routines containing entries needed by utilities
.c.oo :
	$(CC) $(CFLAGS) -d UTIL -o $@ $*.c

# rules for the low-memory version:

.c.ol :
	$(CC) $(LOWFLAGS) -o $@ $*.c

# default C rules for debugging
.c.od :
	$(CC) $(CFLAGD) -o $@ $*.c

# debugging rules for routines containing entries needed by utilities
.c.dd :
	$(CC) $(CFLAGD) -d UTIL -o $@ $*.c

# rules for the debugging low-memory version:

.c.dl :
	$(CC) $(LOWFLAGD) -o $@ $*.c


# object file lists

ZIP_H = zip.h ziperr.h tailor.h amiga/osdep.h amiga/z-stat.h


OBJZ = $(O)zip.o $(O)deflate.o \
        $(O)trees.o $(O)zipfile.o $(O)zipup.o $(O)util.o $(O)timezone.o \
        $(O)fileio.o $(O)globals.o $(O)crc32.o $(O)crypt.o $(O)ttyio.o \
        $(O)amiga.o $(O)amigazip.o $(O)crc_68.o

OBJL = $(O)zip.ol $(O)deflate.ol \
        $(O)trees.ol $(O)zipfile.ol $(O)zipup.ol $(O)util.ol $(O)timezone.ol \
        $(O)fileio.ol $(O)globals.ol $(O)crc32.ol $(O)crypt.ol $(O)ttyio.ol \
        $(O)amiga.ol $(O)amigazip.ol $(O)crc_68.o

OBJU = $(O)zipfile.oo $(O)fileio.oo \
        $(O)util.oo $(O)globals.o $(O)amiga.oo $(O)amigazip.oo
OBJN = $(O)zipnote.o  $(OBJU)
OBJC = $(O)zipcloak.o $(OBJU) $(O)crc32.oo \
        $(O)crypt.oo $(O)ttyio.o
OBJS = $(O)zipsplit.o $(OBJU)

# These are the debuggable versions:

DBJZ = $(O)zip.od $(O)deflate.od \
        $(O)trees.od $(O)zipfile.od $(O)zipup.od $(O)util.od $(O)timezone.od \
        $(O)fileio.od $(O)globals.od $(O)crc32.od $(O)crypt.od $(O)ttyio.od \
        $(O)amiga.od $(O)amigazip.od $(O)crc_68.o

DBJL = $(O)zip.dl $(O)deflate.dl \
        $(O)trees.dl $(O)zipfile.dl $(O)zipup.dl $(O)util.dl $(O)timezone.dl \
        $(O)fileio.dl $(O)globals.dl $(O)crc32.dl $(O)crypt.dl $(O)ttyio.dl \
        $(O)amiga.dl $(O)amigazip.dl $(O)crc_68.o

DBJU = $(O)zipfile.dd $(O)fileio.dd \
        $(O)util.dd $(O)globals.od $(O)amiga.dd $(O)amigazip.dd
DBJN = $(O)zipnote.od  $(DBJU)
DBJC = $(O)zipcloak.od $(DBJU) $(O)crc32.dd \
        $(O)crypt.dd $(O)ttyio.od
DBJS = $(O)zipsplit.od $(DBJU)


#  HERE WE GO:

all : Zip ZipNote ZipSplit ZipCloak ZipLM

z : Zip

n : ZipNote

s : ZipSplit

c : ZipCloak

l : ZipLM

# Debug versions:

dall : Zip.dbg ZipNote.dbg ZipSplit.dbg ZipCloak.dbg ZipLM.dbg

dz : Zip.dbg

dn : ZipNote.dbg

ds : ZipSplit.dbg

dc : ZipCloak.dbg

dl : ZipLM.dbg


Zip : $(OBJZ) $(ZIP_H)
	$(LD) $(LDFLAGS) -o $@ $(OBJZ) $(LDLIBS)
	-@delete Zip.dbg

ZipNote : $(OBJN) $(ZIP_H)
	$(LD) $(LDFLAGS) -o $@ $(OBJN) $(LDLIBS)
	-@delete ZipNote.dbg

ZipSplit : $(OBJS) $(ZIP_H)
	$(LD) $(LDFLAGS) -o $@ $(OBJS) $(LDLIBS)
	-@delete ZipSplit.dbg

ZipCloak : $(OBJC) $(ZIP_H)
	$(LD) $(LDFLAGS) -o $@ $(OBJC) $(LDLIBS)
	-@delete ZipCloak.dbg

ZipLM : $(OBJL) $(ZIP_H)
	$(LD) $(LDFLAGS) -o $@ $(OBJL) $(LDLIBS)
	-@delete ZipLM.dbg


Zip.dbg : $(DBJZ) $(ZIP_H)
	$(LD) $(LDFLAGD) -o Zip $(DBJZ) $(LDLIBS)

ZipNote.dbg : $(DBJN) $(ZIP_H)
	$(LD) $(LDFLAGD) -o ZipNote $(DBJN) $(LDLIBS)

ZipSplit.dbg : $(DBJS) $(ZIP_H)
	$(LD) $(LDFLAGD) -o ZipSplit $(DBJS) $(LDLIBS)

ZipCloak.dbg : $(DBJC) $(ZIP_H)
	$(LD) $(LDFLAGD) -o ZipCloak $(DBJC) $(LDLIBS)

ZipLM.dbg : $(DBJL) $(ZIP_H)
	$(LD) $(LDFLAGD) -o ZipLM $(DBJL) $(LDLIBS)


clean : bugclean
	-delete quiet $(OBJZ)
	-delete quiet $(OBJL)
	-delete quiet $(O)zipnote.o $(O)zipcloak.o $(O)zipsplit.o \
                       $(O)crypt.oo $(OBJU)

bugclean :
	-delete quiet $(DBJZ)
	-delete quiet $(DBJL)
	-delete quiet $(O)zipnote.od $(O)zipcloak.od $(O)zipsplit.od \
                       $(O)crypt.dd $(DBJU)

cleaner : clean
	-delete quiet Zip ZipNote ZipSplit ZipCloak ZipLM
	-delete quiet Zip.dbg ZipNote.dbg ZipSplit.dbg ZipCloak.dbg ZipLM.dbg


# header dependencies:

$(O)zip.o $(O)zipnote.o $(O)zipcloak.o $(O)zipsplit.o $(O)crypt.o $(O)ttyio.o \
   $(O)deflate.o $(O)trees.o $(O)zipfile.o $(O)zipup.o $(O)fileio.o $(O)util.o \
   $(O)timezone.o $(O)crc32.o $(O)globals.o $(O)amiga.o : $(ZIP_H)

$(O)zip.ol $(O)zipnote.ol $(O)zipcloak.ol $(O)zipsplit.ol $(O)crypt.ol \
   $(O)ttyio.ol $(O)deflate.ol $(O)trees.ol $(O)zipfile.ol $(O)zipup.ol \
   $(O)fileio.ol $(O)util.ol $(O)timezone.ol $(O)crc32.ol $(O)globals.ol \
   $(O)amiga.ol : $(ZIP_H)

$(O)crc32.oo $(O)crypt.oo $(O)zipfile.oo $(O)fileio.oo $(O)util.oo : $(ZIP_H)

$(O)amigazip.o $(O)amigazip.ol $(O)amigazip.oo : amiga/amiga.h $(ZIP_H)

$(O)zip.o $(O)zipnote.o $(O)zipcloak.o $(O)zipsplit.o $(O)zipup.o \
   $(O)zip.ol $(O)zipnote.ol $(O)zipcloak.ol $(O)zipsplit.ol \
   $(O)zipup.ol : revision.h

$(O)amiga.o $(O)amiga.ol : crypt.h

$(O)crc32.o $(O)crc32.oo $(O)crc32.ol $(O)crypt.o $(O)crypt.oo $(O)crypt.ol \
   $(O)zipcloak.o $(O)zipcloak.ol $(O)zip.o $(O)zip.ol \
   $(O)zipup.o $(O)zipup.ol \
   $(O)zipfile.o $(O)zipfile.oo $(O)zipfile.ol \
   $(O)fileio.o $(O)fileio.oo $(O)fileio.ol : crc32.h

$(O)crypt.o $(O)crypt.oo $(O)crypt.ol $(O)ttyio.o $(O)ttyio.ol \
   $(O)zipcloak.o $(O)zipcloak.ol $(O)zip.o $(O)zip.ol \
   $(O)zipup.o $(O)zipup.ol : crypt.h ttyio.h

$(O)timezone.o $(O)timezone.ol $(O)timezone.od $(O)timezone.dl \
   $(O)amiga.o $(O)amiga.ol $(O)amiga.oo : timezone.h

$(O)zipup.o $(O)zipup.ol : amiga/zipup.h


# SPECIAL CASES:

# -mr changes expression parsing; avoids a bogus "expression too complex" error:
$(O)trees.o : trees.c
	$(CC) $(CFLAGS) -mr -o $@ trees.c

$(O)trees.ol : trees.c
	$(CC) $(LOWFLAGS) -mr -o $@ trees.c

$(O)trees.od : trees.c
	$(CC) $(CFLAGD) -mr -o $@ trees.c

$(O)trees.ld : trees.c
	$(CC) $(LOWFLAGD) -mr -o $@ trees.c

# Substitute the assembly version of deflate.c: (but not in debug version)
$(O)deflate.o : amiga/deflate.a
	$(AS) $(ASOPTS) -o $@ amiga/deflate.a

$(O)deflate.ol : amiga/deflate.a
	$(AS) $(LOWASOPTS) -o $@ amiga/deflate.a

# The assembly CRC function:
$(O)crc_68.o : amiga/crc_68.a
	$(AS) -n -o $@ amiga/crc_68.a

# Put the Amiga internal version data with today's date into amiga.c:
$(O)amiga.o : amiga/amiga.c amiga/filedate.c amiga/stat.c
	rx > env:VersionDate "say '""'translate(date('E'), '.', '/')'""'"
	$(CC) $(CFLAGS) -o $@ amiga/amiga.c
	delete env:VersionDate

$(O)amiga.ol : amiga/amiga.c amiga/filedate.c amiga/stat.c
	rx > env:VersionDate "say '""'translate(date('E'), '.', '/')'""'"
	$(CC) $(LOWFLAGS) -o $@ amiga/amiga.c
	delete env:VersionDate

$(O)amiga.od : amiga/amiga.c amiga/filedate.c amiga/stat.c
	rx > env:VersionDate "say '""'translate(date('E'), '.', '/')'""'"
	$(CC) $(CFLAGD) -o $@ amiga/amiga.c
	delete env:VersionDate

$(O)amiga.ld : amiga/amiga.c amiga/filedate.c amiga/stat.c
	rx > env:VersionDate "say '""'translate(date('E'), '.', '/')'""'"
	$(CC) $(LOWFLAGD) -o $@ amiga/amiga.c
	delete env:VersionDate

$(O)amiga.oo : amiga/amiga.c amiga/filedate.c amiga/stat.c
	rx > env:VersionDate "say '""'translate(date('E'), '.', '/')'""'"
	$(CC) $(CFLAGS) -d UTIL -o $@ amiga/amiga.c
	delete env:VersionDate

$(O)amiga.dd : amiga/amiga.c amiga/filedate.c amiga/stat.c
	rx > env:VersionDate "say '""'translate(date('E'), '.', '/')'""'"
	$(CC) $(CFLAGD) -d UTIL -o $@ amiga/amiga.c
	delete env:VersionDate

# Put the compiler version number into amigazip.c:
$(O)amigazip.o : amiga/amigazip.c
	$(CC) $(CFLAGS) -o $@ -d __VERSION__=5 -d __REVISION__=2 amiga/amigazip.c

$(O)amigazip.ol : amiga/amigazip.c
	$(CC) $(LOWFLAGS) -o $@ -d __VERSION__=5 -d __REVISION__=2 amiga/amigazip.c

$(O)amigazip.od : amiga/amigazip.c
	$(CC) $(CFLAGD) -o $@ -d __VERSION__=5 -d __REVISION__=2 amiga/amigazip.c

$(O)amigazip.ld : amiga/amigazip.c
	$(CC) $(LOWFLAGD) -o $@ -d __VERSION__=5 -d __REVISION__=2 amiga/amigazip.c

$(O)amigazip.oo : amiga/amigazip.c
	$(CC) $(CFLAGS) -d UTIL -o $@ -d __VERSION__=5 -d __REVISION__=2 amiga/amigazip.c

$(O)amigazip.dd : amiga/amigazip.c
	$(CC) $(CFLAGD) -d UTIL -o $@ -d __VERSION__=5 -d __REVISION__=2 amiga/amigazip.c