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