• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#
2# Makefile for AmigaOS
3#
4
5.PHONY: help all staticlib sharedlib check clean install
6
7vpath %.c ../lib ../examples ../xmlwf ../tests
8vpath %.h ../lib ../tests
9
10
11#
12# Set these for SDK installation.
13#
14tooldir = SDK:Local/C
15staticlibdir = SDK:Local/clib2/lib
16staticincludedir = SDK:Local/clib2/include
17sharedlibdir = LIBS:
18sharedincludedir = SDK:Local/common/include
19
20
21ifeq ($(MAKECMDGOALS), staticlib)
22 DESTDIR = lib
23else
24 DESTDIR = libs
25endif
26
27STATICLIB = $(DESTDIR)/libexpat.a
28SHAREDLIB = $(DESTDIR)/expat.library
29
30XMLWF = $(DESTDIR)/xmlwf
31ELEMENTS = $(DESTDIR)/elements
32OUTLINE = $(DESTDIR)/outline
33RUNTESTS = $(DESTDIR)/runtests
34BENCHMARK = $(DESTDIR)/benchmark
35
36
37help:
38	@echo "Requires:"
39	@echo " AmigaOS 4.0"
40	@echo " SDK 51.15"
41	@echo " clib2 1.198"
42	@echo ""
43	@echo "Targets:"
44	@echo " all - make expat libraries, xmlwf, examples and run test suite"
45	@echo " install - install expat libraries and tools into SDK"
46
47all:
48	-makedir lib libs
49	$(MAKE) staticlib
50	$(MAKE) sharedlib
51
52staticlib: $(STATICLIB) $(XMLWF) $(ELEMENTS) $(OUTLINE) $(RUNTESTS) $(BENCHMARK) check
53	@echo done
54
55sharedlib: $(SHAREDLIB) $(XMLWF) $(ELEMENTS) $(OUTLINE) $(RUNTESTS) $(BENCHMARK) check
56	@echo done
57
58check:
59	$(RUNTESTS)
60
61clean:
62	-delete lib/#?.o quiet
63	-delete libs/#?.o quiet
64
65install:
66	copy lib/xmlwf $(tooldir) quiet
67	copy /lib/expat.h /lib/expat_external.h $(staticincludedir) quiet
68	copy lib/libexpat.a $(staticlibdir) quiet
69	copy libs/expat.library $(sharedlibdir) quiet
70	copy include $(sharedincludedir) quiet all
71
72
73CC = gcc
74LIBTOOL = ar
75STRIP = strip
76
77LDFLAGS =
78LIBS =
79LOCAL_CFLAGS = -DNDEBUG -O2
80LTFLAGS = -crs
81STRIPFLAGS = -R.comment
82LAUNCH =
83
84ifeq ($(MAKECMDGOALS), staticlib)
85 LIBS += $(STATICLIB)
86 INCLUDES = -I../lib
87endif
88
89ifeq ($(MAKECMDGOALS), sharedlib)
90LOCAL_CFLAGS += -DAMIGA_SHARED_LIB -D__USE_INLINE__
91 INCLUDES = -I. -Iinclude -Iinclude/libraries -I../lib
92 LAUNCH = $(DESTDIR)/launch.o
93endif
94
95
96COMPILE = $(CC) $(CFLAGS) $(INCLUDES) -c
97
98LINK = $(CC) $(LDFLAGS) -o $@
99
100
101$(STATICLIB): $(DESTDIR)/xmlparse.o $(DESTDIR)/xmltok.o $(DESTDIR)/xmlrole.o
102	$(LIBTOOL) $(LTFLAGS) $@ $^
103
104$(DESTDIR)/xmlparse.o: xmlparse.c expat.h xmlrole.h xmltok.h \
105	expat_external.h internal.h amigaconfig.h
106	$(COMPILE) $< -o $@
107
108$(DESTDIR)/xmlrole.o: xmlrole.c ascii.h xmlrole.h expat_external.h \
109	internal.h amigaconfig.h
110	$(COMPILE) $< -o $@
111
112$(DESTDIR)/xmltok.o: xmltok.c xmltok_impl.c xmltok_ns.c ascii.h asciitab.h \
113	iasciitab.h latin1tab.h nametab.h utf8tab.h xmltok.h xmltok_impl.h \
114	expat_external.h internal.h amigaconfig.h
115	$(COMPILE) $< -o $@
116
117
118$(SHAREDLIB): $(DESTDIR)/expat_lib.o $(DESTDIR)/expat_vectors.o $(DESTDIR)/stdlib.o lib/libexpat.a
119	$(LINK) -nostartfiles -nostdlib -o $@ $^
120
121$(DESTDIR)/expat_lib.o: expat_lib.c
122	$(COMPILE) $< -o $@
123
124$(DESTDIR)/expat_vectors.o: expat_vectors.c
125	$(COMPILE) $< -o $@
126
127$(DESTDIR)/stdlib.o: stdlib.c
128	$(COMPILE) $< -o $@
129
130$(LAUNCH): launch.c
131	$(COMPILE) $< -o $@
132
133
134$(XMLWF): $(DESTDIR)/xmlwf.o $(DESTDIR)/xmlfile.o $(DESTDIR)/codepage.o $(DESTDIR)/readfilemap.o $(LAUNCH)
135	$(LINK) $^ $(LIBS)
136	$(STRIP) $(STRIPFLAGS) $@
137
138$(DESTDIR)/xmlwf.o: xmlwf.c
139	$(COMPILE) $< -o $@
140
141$(DESTDIR)/xmlfile.o: xmlfile.c
142	$(COMPILE) $< -o $@
143
144$(DESTDIR)/codepage.o: codepage.c
145	$(COMPILE) $< -o $@
146
147$(DESTDIR)/readfilemap.o: readfilemap.c
148	$(COMPILE) $< -o $@
149
150
151$(ELEMENTS): $(DESTDIR)/elements.o $(LAUNCH)
152	$(LINK) $^ $(LIBS)
153	$(STRIP) $(STRIPFLAGS) $@
154
155$(DESTDIR)/elements.o: elements.c
156	$(COMPILE) $< -o $@
157
158
159$(OUTLINE): $(DESTDIR)/outline.o $(LAUNCH)
160	$(LINK) $^ $(LIBS)
161	$(STRIP) $(STRIPFLAGS) $@
162
163$(DESTDIR)/outline.o: outline.c
164	$(COMPILE) $< -o $@
165
166
167$(RUNTESTS): $(DESTDIR)/runtests.o $(DESTDIR)/chardata.o $(DESTDIR)/minicheck.o $(LAUNCH)
168	$(LINK) $^ $(LIBS)
169
170$(DESTDIR)/chardata.o: chardata.c chardata.h
171	$(COMPILE) $< -o $@
172
173$(DESTDIR)/minicheck.o: minicheck.c minicheck.h
174	$(COMPILE) $< -o $@
175
176$(DESTDIR)/runtests.o: runtests.c chardata.h
177	$(COMPILE) $< -o $@
178
179
180$(BENCHMARK): $(DESTDIR)/benchmark.o $(LAUNCH)
181	$(LINK) $^ $(LIBS) -lm
182
183$(DESTDIR)/benchmark.o: benchmark/benchmark.c
184	$(COMPILE) $< -o $@
185