blob: 7c4571a2f29717f5ef364e97d6b46d3cd91f2eda [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.
Daniel Veillardff0b7312001-10-11 06:46:09 +00005# Modified 2001/10/10 Tobias Peters for libxml2-2.4.5
Daniel Veillarde8282ed2000-10-10 23:01:31 +00006
7# Set "PREFIX" to the root of the mingw installed files.
8
9PREFIX = /mingw
10
Daniel Veillardff0b7312001-10-11 06:46:09 +000011CC = gcc
12CFLAGS = -Iinclude -fnative-struct -D_WINSOCKAPI_ \
13 -Dsnprintf=_snprintf -Dvsnprintf=_vsnprintf
14LDFLAGS = -L. -L$(PREFIX)/lib
15LIBS = -lwsock32 -lz
Daniel Veillarde8282ed2000-10-10 23:01:31 +000016
17AR=ar rc
18DLLTOOL=dlltool
19DLLWRAP=dllwrap
20
Daniel Veillardff0b7312001-10-11 06:46:09 +000021
22LIBSRCS=SAX.c entities.c encoding.c error.c parserInternals.c \
23 parser.c tree.c hash.c list.c xmlIO.c xmlmemory.c uri.c \
24 valid.c xlink.c HTMLparser.c HTMLtree.c debugXML.c xpath.c \
25 xpointer.c xinclude.c nanohttp.c nanoftp.c DOCBparser.c \
26 catalog.c strio.c
Daniel Veillarde8282ed2000-10-10 23:01:31 +000027
28LIBOBJS=$(LIBSRCS:.c=.o)
29
30OBJS=$(LIBOBJS)
31
32LIBBASE=xml
33LIB=lib$(LIBBASE).a
34DLL=$(LIB:.a=.dll)
35
36OBJ1=testHTML.o
37OBJ2=testSAX.o
38OBJ3=testURI.o
39EXE1=$(OBJ1:.o=.exe)
40EXE2=$(OBJ2:.o=.exe)
41EXE3=$(OBJ3:.o=.exe)
42
43IMPBASE=$(LIBBASE)_dll
44IMP=lib$(IMPBASE).a
45
Daniel Veillardff0b7312001-10-11 06:46:09 +000046DLLFLAGS = --shared -o $(DLL) -Wl,--out-implib,$(IMP)
47
Daniel Veillarde8282ed2000-10-10 23:01:31 +000048DEF=$(DLL:.dll=.def)
49
50all: $(LIB) $(DLL) $(DEF) $(IMP) $(EXE1) $(EXE2) $(EXE3)
51
52dll: $(DLL)
53
54lib: $(LIB)
55
Daniel Veillardff0b7312001-10-11 06:46:09 +000056$(DLL) $(IMP): $(LIBOBJS)
57 $(CC) $(DLLFLAGS) $(LIBOBJS) $(LDFLAGS) $(LIBS)
58# -mwindows
Daniel Veillarde8282ed2000-10-10 23:01:31 +000059
60$(LIB): $(LIBOBJS)
61 $(AR) $@ $^
62
63$(DEF): $(LIBOBJS)
64 $(DLLTOOL) --kill-at --export-all -D $(DLL) --output-def $@ $^
65
Daniel Veillardff0b7312001-10-11 06:46:09 +000066$(EXE1): $(OBJ1) $(DLL)
Daniel Veillarde8282ed2000-10-10 23:01:31 +000067 $(CC) $(CFLAGS) $< -o $@ $(LDFLAGS) -l$(IMPBASE) $(LIBS)
68 strip $@
69
Daniel Veillardff0b7312001-10-11 06:46:09 +000070$(EXE2): $(OBJ2) $(DLL)
Daniel Veillarde8282ed2000-10-10 23:01:31 +000071 $(CC) $(CFLAGS) $< -o $@ $(LDFLAGS) -l$(IMPBASE) $(LIBS)
72 strip $@
73
Daniel Veillardff0b7312001-10-11 06:46:09 +000074$(EXE3): $(OBJ3) $(LIB)
Daniel Veillarde8282ed2000-10-10 23:01:31 +000075 $(CC) $(CFLAGS) $< -o $@ $(LDFLAGS) -l$(LIBBASE) $(LIBS)
76 strip $@
77
Daniel Veillardff0b7312001-10-11 06:46:09 +000078$(OBJ1): $(OBJ1:.o=.c)
79 $(CC) $(CFLAGS) -DLIBXML_DLL_IMPORT=__declspec'(dllimport)' -c $< -o $@
80
81$(OBJ2): $(OBJ2:.o=.c)
82 $(CC) $(CFLAGS) -DLIBXML_DLL_IMPORT=__declspec'(dllimport)' -c $< -o $@
83
84$(OBJ3): $(OBJ3:.o=.c)
85 $(CC) $(CFLAGS) -c $< -o $@
86
Daniel Veillarde8282ed2000-10-10 23:01:31 +000087.c.o:
Daniel Veillardff0b7312001-10-11 06:46:09 +000088 $(CC) $(CFLAGS) -DIN_LIBXML -c $< -o $@
Daniel Veillarde8282ed2000-10-10 23:01:31 +000089
90clean:
91 rm *.o *.a *.dll *.def
92
93test: all
94 ./$(EXE1) -c $(OBJS) | xxd | head -3