blob: 162fd5e617c7f801092ccd5cbb69fbb7e3be5a31 [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 \
Daniel Veillardd3c68c42000-10-12 08:06:28 +000036 xpointer.c \
Daniel Veillarde8282ed2000-10-10 23:01:31 +000037 uri.c
38
39LIBOBJS=$(LIBSRCS:.c=.o)
40
41OBJS=$(LIBOBJS)
42
43LIBBASE=xml
44LIB=lib$(LIBBASE).a
45DLL=$(LIB:.a=.dll)
46
47OBJ1=testHTML.o
48OBJ2=testSAX.o
49OBJ3=testURI.o
50EXE1=$(OBJ1:.o=.exe)
51EXE2=$(OBJ2:.o=.exe)
52EXE3=$(OBJ3:.o=.exe)
53
54IMPBASE=$(LIBBASE)_dll
55IMP=lib$(IMPBASE).a
56
57DEF=$(DLL:.dll=.def)
58
59all: $(LIB) $(DLL) $(DEF) $(IMP) $(EXE1) $(EXE2) $(EXE3)
60
61dll: $(DLL)
62
63lib: $(LIB)
64
65$(DLL): $(LIB) $(DEF) $(IMP)
66 $(DLLWRAP) --def $(DEF) --dllname $@ --output-lib $@ $(LIB) $(LDFLAGS) $(LIBS) -mwindows
67
68$(LIB): $(LIBOBJS)
69 $(AR) $@ $^
70
71$(DEF): $(LIBOBJS)
72 $(DLLTOOL) --kill-at --export-all -D $(DLL) --output-def $@ $^
73
74$(IMP): $(DEF)
75 $(DLLTOOL) -d $< -l $@ -D $(DLL)
76
77$(EXE1): $(OBJ1) $(LIBOBJS) $(DLL)
78 $(CC) $(CFLAGS) $< -o $@ $(LDFLAGS) -l$(IMPBASE) $(LIBS)
79 strip $@
80
81$(EXE2): $(OBJ2) $(LIBOBJS) $(DLL)
82 $(CC) $(CFLAGS) $< -o $@ $(LDFLAGS) -l$(IMPBASE) $(LIBS)
83 strip $@
84
85$(EXE3): $(OBJ3) $(LIBOBJS) $(LIB)
86 $(CC) $(CFLAGS) $< -o $@ $(LDFLAGS) -l$(LIBBASE) $(LIBS)
87 strip $@
88
89.c.o:
90 $(CC) $(CFLAGS) -c $< -o $@
91
92clean:
93 rm *.o *.a *.dll *.def
94
95test: all
96 ./$(EXE1) -c $(OBJS) | xxd | head -3