Daniel Veillard | e8282ed | 2000-10-10 23:01:31 +0000 | [diff] [blame] | 1 | # 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 Veillard | ff0b731 | 2001-10-11 06:46:09 +0000 | [diff] [blame] | 5 | # Modified 2001/10/10 Tobias Peters for libxml2-2.4.5
|
Daniel Veillard | e8282ed | 2000-10-10 23:01:31 +0000 | [diff] [blame] | 6 |
|
| 7 | # Set "PREFIX" to the root of the mingw installed files.
|
| 8 |
|
| 9 | PREFIX = /mingw
|
| 10 |
|
Daniel Veillard | ff0b731 | 2001-10-11 06:46:09 +0000 | [diff] [blame] | 11 | CC = gcc
|
| 12 | CFLAGS = -Iinclude -fnative-struct -D_WINSOCKAPI_ \
|
| 13 | -Dsnprintf=_snprintf -Dvsnprintf=_vsnprintf
|
| 14 | LDFLAGS = -L. -L$(PREFIX)/lib
|
| 15 | LIBS = -lwsock32 -lz
|
Daniel Veillard | e8282ed | 2000-10-10 23:01:31 +0000 | [diff] [blame] | 16 |
|
| 17 | AR=ar rc
|
| 18 | DLLTOOL=dlltool
|
| 19 | DLLWRAP=dllwrap
|
| 20 |
|
Daniel Veillard | ff0b731 | 2001-10-11 06:46:09 +0000 | [diff] [blame] | 21 |
|
| 22 | LIBSRCS=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 Veillard | e8282ed | 2000-10-10 23:01:31 +0000 | [diff] [blame] | 27 |
|
| 28 | LIBOBJS=$(LIBSRCS:.c=.o)
|
| 29 |
|
| 30 | OBJS=$(LIBOBJS)
|
| 31 |
|
| 32 | LIBBASE=xml
|
| 33 | LIB=lib$(LIBBASE).a
|
| 34 | DLL=$(LIB:.a=.dll)
|
| 35 |
|
| 36 | OBJ1=testHTML.o
|
| 37 | OBJ2=testSAX.o
|
| 38 | OBJ3=testURI.o
|
| 39 | EXE1=$(OBJ1:.o=.exe)
|
| 40 | EXE2=$(OBJ2:.o=.exe)
|
| 41 | EXE3=$(OBJ3:.o=.exe)
|
| 42 |
|
| 43 | IMPBASE=$(LIBBASE)_dll
|
| 44 | IMP=lib$(IMPBASE).a
|
| 45 |
|
Daniel Veillard | ff0b731 | 2001-10-11 06:46:09 +0000 | [diff] [blame] | 46 | DLLFLAGS = --shared -o $(DLL) -Wl,--out-implib,$(IMP)
|
| 47 |
|
Daniel Veillard | e8282ed | 2000-10-10 23:01:31 +0000 | [diff] [blame] | 48 | DEF=$(DLL:.dll=.def)
|
| 49 |
|
| 50 | all: $(LIB) $(DLL) $(DEF) $(IMP) $(EXE1) $(EXE2) $(EXE3)
|
| 51 |
|
| 52 | dll: $(DLL)
|
| 53 |
|
| 54 | lib: $(LIB)
|
| 55 |
|
Daniel Veillard | ff0b731 | 2001-10-11 06:46:09 +0000 | [diff] [blame] | 56 | $(DLL) $(IMP): $(LIBOBJS)
|
| 57 | $(CC) $(DLLFLAGS) $(LIBOBJS) $(LDFLAGS) $(LIBS)
|
| 58 | # -mwindows
|
Daniel Veillard | e8282ed | 2000-10-10 23:01:31 +0000 | [diff] [blame] | 59 |
|
| 60 | $(LIB): $(LIBOBJS)
|
| 61 | $(AR) $@ $^
|
| 62 |
|
| 63 | $(DEF): $(LIBOBJS)
|
| 64 | $(DLLTOOL) --kill-at --export-all -D $(DLL) --output-def $@ $^
|
| 65 |
|
Daniel Veillard | ff0b731 | 2001-10-11 06:46:09 +0000 | [diff] [blame] | 66 | $(EXE1): $(OBJ1) $(DLL)
|
Daniel Veillard | e8282ed | 2000-10-10 23:01:31 +0000 | [diff] [blame] | 67 | $(CC) $(CFLAGS) $< -o $@ $(LDFLAGS) -l$(IMPBASE) $(LIBS)
|
| 68 | strip $@
|
| 69 |
|
Daniel Veillard | ff0b731 | 2001-10-11 06:46:09 +0000 | [diff] [blame] | 70 | $(EXE2): $(OBJ2) $(DLL)
|
Daniel Veillard | e8282ed | 2000-10-10 23:01:31 +0000 | [diff] [blame] | 71 | $(CC) $(CFLAGS) $< -o $@ $(LDFLAGS) -l$(IMPBASE) $(LIBS)
|
| 72 | strip $@
|
| 73 |
|
Daniel Veillard | ff0b731 | 2001-10-11 06:46:09 +0000 | [diff] [blame] | 74 | $(EXE3): $(OBJ3) $(LIB)
|
Daniel Veillard | e8282ed | 2000-10-10 23:01:31 +0000 | [diff] [blame] | 75 | $(CC) $(CFLAGS) $< -o $@ $(LDFLAGS) -l$(LIBBASE) $(LIBS)
|
| 76 | strip $@
|
| 77 |
|
Daniel Veillard | ff0b731 | 2001-10-11 06:46:09 +0000 | [diff] [blame] | 78 | $(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 Veillard | e8282ed | 2000-10-10 23:01:31 +0000 | [diff] [blame] | 87 | .c.o:
|
Daniel Veillard | ff0b731 | 2001-10-11 06:46:09 +0000 | [diff] [blame] | 88 | $(CC) $(CFLAGS) -DIN_LIBXML -c $< -o $@
|
Daniel Veillard | e8282ed | 2000-10-10 23:01:31 +0000 | [diff] [blame] | 89 |
|
| 90 | clean:
|
| 91 | rm *.o *.a *.dll *.def
|
| 92 |
|
| 93 | test: all
|
| 94 | ./$(EXE1) -c $(OBJS) | xxd | head -3
|