summaryrefslogtreecommitdiff
path: root/amiga/Makefile
blob: eadb8a3d3a1f4cf2d8e166c99ed52876e8f3cc38 (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
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
#
# Makefile for AmigaOS
#

.PHONY: help all check clean package
.PHONY: clib2 newlib library so

vpath %.c ../lib ../examples ../xmlwf ../tests ../tests/benchmark
vpath %.h ../lib ../tests

#############################################################################

help:
	@echo "Requires:"
	@echo " AmigaOS 4.x"
	@echo " SDK 53.13"
	@echo ""
	@echo "Targets:"
	@echo " all     - make libraries, xmlwf, examples and runs tests"
	@echo " install - install expat libraries and tools into SDK"
	@echo " clean   - clean object files"
	@echo " package - prepare distribution archive"

all: clib2 newlib library so check

clib2: clib2/libexpat.a clib2/xmlwf clib2/elements clib2/outline clib2/runtests clib2/benchmark

newlib: newlib/libexpat.a newlib/xmlwf newlib/elements newlib/outline newlib/runtests newlib/benchmark

library: libs/expat.library libs/xmlwf libs/elements libs/outline libs/runtests libs/benchmark

so: so/libexpat.so so/xmlwf so/elements so/outline so/runtests so/benchmark

check: clib2/runtests newlib/runtests libs/runtests so/runtests
	clib2/runtests
	newlib/runtests
	libs/runtests
	so/runtests

clean:
	-delete clib2/#?.o quiet
	-delete newlib/#?.o quiet
	-delete libs/#?.o quiet
	-delete so/#?.o quiet

package:
	$(MAKE) all
	-delete T:expat all force quiet
	makedir all T:expat/Workbench/Libs
	copy clone libs/expat.library T:expat/Workbench/Libs
	makedir all T:expat/SDK/Local/C
	copy clone libs/xmlwf T:expat/SDK/Local/C
	makedir all T:expat/SDK/Local/clib2/lib
	copy clone clib2/libexpat.a T:expat/SDK/Local/clib2/lib
	makedir all T:expat/SDK/Local/newlib/lib
	copy clone newlib/libexpat.a T:expat/SDK/Local/newlib/lib
	makedir all T:expat/SDK/Local/common/include
	copy clone /lib/expat.h /lib/expat_external.h T:expat/SDK/Local/common/include
	makedir all T:expat/SDK/Include/include_h/inline4
	copy clone include/inline4/expat.h T:expat/SDK/Include/include_h/inline4
	makedir all T:expat/SDK/Include/include_h/interfaces
	copy clone include/interfaces/expat.h T:expat/SDK/Include/include_h/interfaces
	makedir all T:expat/SDK/Include/include_h/libraries
	copy clone include/libraries/expat.h T:expat/SDK/Include/include_h/libraries
	makedir all T:expat/SDK/Include/include_h/proto
	copy clone include/proto/expat.h T:expat/SDK/Include/include_h/proto
	makedir all T:expat/SDK/Documentation/Libs/Expat
	copy clone /COPYING T:expat/SDK/Documentation/Libs/Expat
	copy clone /README T:expat/SDK/Documentation/Libs/Expat
	copy clone README.txt T:expat/SDK/Documentation/Libs/Expat/README.AmigaOS
	-delete expat.lha
	lha -r a expat.lha T:expat

#############################################################################

CC         := gcc
LIBTOOL    := ar
STRIP      := strip

CFLAGS     := -DNDEBUG -O3
LTFLAGS    := -crs
STRIPFLAGS := -R.comment

#############################################################################

clib2/libexpat.a: clib2/xmlparse.o clib2/xmltok.o clib2/xmlrole.o
	$(LIBTOOL) $(LTFLAGS) $@ $^

clib2/xmlparse.o: xmlparse.c expat.h xmlrole.h xmltok.h \
	expat_external.h internal.h amigaconfig.h

clib2/xmlrole.o: xmlrole.c ascii.h xmlrole.h expat_external.h \
	internal.h amigaconfig.h

clib2/xmltok.o: xmltok.c xmltok_impl.c xmltok_ns.c ascii.h asciitab.h \
	iasciitab.h latin1tab.h nametab.h utf8tab.h xmltok.h xmltok_impl.h \
	expat_external.h internal.h amigaconfig.h

#############################################################################

clib2/xmlwf: clib2/xmlwf.o clib2/xmlfile.o clib2/codepage.o clib2/readfilemap.o
	$(CC) -mcrt=clib2 $^ -o $@ clib2/libexpat.a
	$(STRIP) $(STRIPFLAGS) $@

clib2/xmlwf.o: xmlwf.c

clib2/xmlfile.o: xmlfile.c

clib2/codepage.o: codepage.c

clib2/readfilemap.o: readfilemap.c

#############################################################################

clib2/elements: clib2/elements.o
	$(CC) -mcrt=clib2 $^ -o $@ clib2/libexpat.a
	$(STRIP) $(STRIPFLAGS) $@

clib2/elements.o: elements.c

#############################################################################

clib2/outline: clib2/outline.o
	$(CC) -mcrt=clib2 $^ -o $@ clib2/libexpat.a
	$(STRIP) $(STRIPFLAGS) $@

clib2/outline.o: outline.c

#############################################################################

clib2/runtests: clib2/runtests.o clib2/chardata.o clib2/minicheck.o
	$(CC) -mcrt=clib2 $^ -o $@ clib2/libexpat.a

clib2/chardata.o: chardata.c chardata.h

clib2/minicheck.o: minicheck.c minicheck.h

clib2/runtests.o: runtests.c chardata.h

#############################################################################

clib2/benchmark: clib2/benchmark.o
	$(CC) -mcrt=clib2 $^ -o $@ clib2/libexpat.a -lm

clib2/benchmark.o: benchmark.c

#############################################################################

newlib/libexpat.a: newlib/xmlparse.o newlib/xmltok.o newlib/xmlrole.o
	$(LIBTOOL) $(LTFLAGS) $@ $^

newlib/xmlparse.o: xmlparse.c expat.h xmlrole.h xmltok.h \
	expat_external.h internal.h amigaconfig.h

newlib/xmlrole.o: xmlrole.c ascii.h xmlrole.h expat_external.h \
	internal.h amigaconfig.h

newlib/xmltok.o: xmltok.c xmltok_impl.c xmltok_ns.c ascii.h asciitab.h \
	iasciitab.h latin1tab.h nametab.h utf8tab.h xmltok.h xmltok_impl.h \
	expat_external.h internal.h amigaconfig.h

#############################################################################

newlib/xmlwf: newlib/xmlwf.o newlib/xmlfile.o newlib/codepage.o newlib/readfilemap.o
	$(CC) -mcrt=newlib $^ -o $@ newlib/libexpat.a
	$(STRIP) $(STRIPFLAGS) $@

newlib/xmlwf.o: xmlwf.c

newlib/xmlfile.o: xmlfile.c

newlib/codepage.o: codepage.c

newlib/readfilemap.o: readfilemap.c

#############################################################################

newlib/elements: newlib/elements.o
	$(CC) -mcrt=newlib $^ -o $@ newlib/libexpat.a
	$(STRIP) $(STRIPFLAGS) $@

newlib/elements.o: elements.c

#############################################################################

newlib/outline: newlib/outline.o
	$(CC) -mcrt=newlib $^ -o $@ newlib/libexpat.a
	$(STRIP) $(STRIPFLAGS) $@

newlib/outline.o: outline.c

#############################################################################

newlib/runtests: newlib/runtests.o newlib/chardata.o newlib/minicheck.o
	$(CC) -mcrt=newlib $^ -o $@ newlib/libexpat.a

newlib/chardata.o: chardata.c chardata.h

newlib/minicheck.o: minicheck.c minicheck.h

newlib/runtests.o: runtests.c chardata.h

#############################################################################

newlib/benchmark: newlib/benchmark.o
	$(CC) -mcrt=newlib $^ -o $@ newlib/libexpat.a

newlib/benchmark.o: benchmark.c

#############################################################################

libs/expat.library: libs/expat_lib.o libs/expat_68k.o libs/expat_68k_handler_stubs.o libs/expat_vectors.o libs/stdlib.o newlib/libexpat.a
	$(CC) -mcrt=newlib -nostartfiles -nostdlib $^ -o $@ newlib/libexpat.a

libs/expat_lib.o: expat_lib.c

libs/expat_68k.o: expat_68k.c expat_68k.h

libs/expat_68k_handler_stubs.o: expat_68k_handler_stubs.c expat_68k.h

libs/expat_vectors.o: expat_vectors.c

libs/stdlib.o: stdlib.c

libs/launch.o: launch.c

#############################################################################

libs/xmlwf: libs/xmlwf.o libs/xmlfile.o libs/codepage.o libs/readfilemap.o libs/launch.o
	$(CC) -mcrt=newlib $^ -o $@
	$(STRIP) $(STRIPFLAGS) $@

libs/xmlwf.o: xmlwf.c

libs/xmlfile.o: xmlfile.c

libs/codepage.o: codepage.c

libs/readfilemap.o: readfilemap.c

#############################################################################

libs/elements: libs/elements.o libs/launch.o
	$(CC) -mcrt=newlib $^ -o $@
	$(STRIP) $(STRIPFLAGS) $@

libs/elements.o: elements.c

#############################################################################

libs/outline: libs/outline.o libs/launch.o
	$(CC) -mcrt=newlib $^ -o $@
	$(STRIP) $(STRIPFLAGS) $@

libs/outline.o: outline.c

#############################################################################

libs/runtests: libs/runtests.o libs/chardata.o libs/minicheck.o libs/launch.o
	$(CC) -mcrt=newlib $^ -o $@

libs/chardata.o: chardata.c chardata.h

libs/minicheck.o: minicheck.c minicheck.h

libs/runtests.o: runtests.c chardata.h

#############################################################################

libs/benchmark: libs/benchmark.o libs/launch.o
	$(CC) -mcrt=newlib $^ -o $@

libs/benchmark.o: benchmark.c

#############################################################################

so/libexpat.so: so/xmlparse.o so/xmltok.o so/xmlrole.o
	$(CC) -mcrt=newlib -shared -o $@ $^

so/xmlparse.o: xmlparse.c expat.h xmlrole.h xmltok.h \
	expat_external.h internal.h amigaconfig.h

so/xmlrole.o: xmlrole.c ascii.h xmlrole.h expat_external.h \
	internal.h amigaconfig.h

so/xmltok.o: xmltok.c xmltok_impl.c xmltok_ns.c ascii.h asciitab.h \
	iasciitab.h latin1tab.h nametab.h utf8tab.h xmltok.h xmltok_impl.h \
	expat_external.h internal.h amigaconfig.h

#############################################################################

so/xmlwf: newlib/xmlwf.o newlib/xmlfile.o newlib/codepage.o newlib/readfilemap.o
	$(CC) -mcrt=newlib -use-dynld $^ -o $@ -Lso -lexpat
	$(STRIP) $(STRIPFLAGS) $@

#############################################################################

so/elements: newlib/elements.o
	$(CC) -mcrt=newlib -use-dynld $^ -o $@ -Lso -lexpat
	$(STRIP) $(STRIPFLAGS) $@

#############################################################################

so/outline: newlib/outline.o
	$(CC) -mcrt=newlib -use-dynld $^ -o $@ -Lso -lexpat
	$(STRIP) $(STRIPFLAGS) $@

#############################################################################

so/runtests: newlib/runtests.o newlib/chardata.o newlib/minicheck.o
	$(CC) -mcrt=newlib -use-dynld $^ -o $@ -Lso -lexpat

#############################################################################

so/benchmark: newlib/benchmark.o
	$(CC) -mcrt=newlib -use-dynld $^ -o $@ -Lso -lexpat

#############################################################################

clib2/%.o: %.c
	$(CC) -mcrt=clib2 $(CFLAGS) -I../lib -c $< -o $@

newlib/%.o: %.c
	$(CC) -mcrt=newlib $(CFLAGS) -I../lib -c $< -o $@

libs/%.o: %.c
	$(CC) -mcrt=newlib $(CFLAGS) -D__USE_INLINE__ -I. -Iinclude -Iinclude/libraries -I../lib -c $< -o $@

so/%.o: %.c
	$(CC) -mcrt=newlib $(CFLAGS) -fPIC -I../lib -c $< -o $@