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