blob: 11ff7bcdc7d382fee9416731e288afd4fa0692f1 [file] [log] [blame]
Daniel Veillarde8282ed2000-10-10 23:01:31 +00001# This Makefile will allow you to build the static library, a DLL, the
2# DLL-import library, and the test executables using the "mingw" gcc
3# compiler environment. This Makefile is based on Alfred Reibenschuh's
4# version for 2.1.1, and was modified by Wayne Davison.
5
6# Set "PREFIX" to the root of the mingw installed files.
7
8PREFIX = /mingw
9
10CC=gcc
11CFLAGS=-O -Iinclude -I$(PREFIX)/include -D_WINSOCKAPI_ -fnative-struct
12LDFLAGS=-L. -L$(PREFIX)/lib
13LIBS=-lwsock32 -lz
14
15AR=ar rc
16DLLTOOL=dlltool
17DLLWRAP=dllwrap
18
19LIBSRCS=HTMLparser.c \
20 HTMLtree.c \
21 SAX.c \
22 debugXML.c \
23 encoding.c \
24 entities.c \
25 error.c \
26 nanoftp.c \
27 nanohttp.c \
28 parser.c \
29 parserInternals.c \
30 tree.c \
31 valid.c \
32 xlink.c \
33 xmlIO.c \
34 xmlmemory.c \
35 xpath.c \
36 uri.c
37
38LIBOBJS=$(LIBSRCS:.c=.o)
39
40OBJS=$(LIBOBJS)
41
42LIBBASE=xml
43LIB=lib$(LIBBASE).a
44DLL=$(LIB:.a=.dll)
45
46OBJ1=testHTML.o
47OBJ2=testSAX.o
48OBJ3=testURI.o
49EXE1=$(OBJ1:.o=.exe)
50EXE2=$(OBJ2:.o=.exe)
51EXE3=$(OBJ3:.o=.exe)
52
53IMPBASE=$(LIBBASE)_dll
54IMP=lib$(IMPBASE).a
55
56DEF=$(DLL:.dll=.def)
57
58all: $(LIB) $(DLL) $(DEF) $(IMP) $(EXE1) $(EXE2) $(EXE3)
59
60dll: $(DLL)
61
62lib: $(LIB)
63
64$(DLL): $(LIB) $(DEF) $(IMP)
65 $(DLLWRAP) --def $(DEF) --dllname $@ --output-lib $@ $(LIB) $(LDFLAGS) $(LIBS) -mwindows
66
67$(LIB): $(LIBOBJS)
68 $(AR) $@ $^
69
70$(DEF): $(LIBOBJS)
71 $(DLLTOOL) --kill-at --export-all -D $(DLL) --output-def $@ $^
72
73$(IMP): $(DEF)
74 $(DLLTOOL) -d $< -l $@ -D $(DLL)
75
76$(EXE1): $(OBJ1) $(LIBOBJS) $(DLL)
77 $(CC) $(CFLAGS) $< -o $@ $(LDFLAGS) -l$(IMPBASE) $(LIBS)
78 strip $@
79
80$(EXE2): $(OBJ2) $(LIBOBJS) $(DLL)
81 $(CC) $(CFLAGS) $< -o $@ $(LDFLAGS) -l$(IMPBASE) $(LIBS)
82 strip $@
83
84$(EXE3): $(OBJ3) $(LIBOBJS) $(LIB)
85 $(CC) $(CFLAGS) $< -o $@ $(LDFLAGS) -l$(LIBBASE) $(LIBS)
86 strip $@
87
88.c.o:
89 $(CC) $(CFLAGS) -c $< -o $@
90
91clean:
92 rm *.o *.a *.dll *.def
93
94test: all
95 ./$(EXE1) -c $(OBJS) | xxd | head -3