1################################################################
2# Process this file with top-level configure script to produce Makefile
3#
4# Copyright 2000 Clark Cooper
5#
6#  This file is part of EXPAT.
7#
8#  EXPAT is free software; you can redistribute it and/or modify it
9#  under the terms of the License (based on the MIT/X license) contained
10#  in the file COPYING that comes with this distribution.
11#
12# EXPAT IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
13# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
14# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
15# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
16# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
17# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
18# SOFTWARE OR THE USE OR OTHER DEALINGS IN EXPAT.
19#
20
21include ../config.in
22include ../config.mk
23
24SHELL = @SHELL@
25
26srcdir = @srcdir@
27top_srcdir = @top_srcdir@
28VPATH = @srcdir@
29
30prefix = @prefix@
31exec_prefix = @exec_prefix@
32
33bindir = @bindir@
34libdir = @libdir@
35includedir = @includedir@
36man1dir = @mandir@/man1
37
38top_builddir = .
39
40
41INSTALL = @INSTALL@
42INSTALL_PROGRAM = @INSTALL_PROGRAM@
43INSTALL_DATA = @INSTALL_DATA@
44mkinstalldirs = $(SHELL) $(top_srcdir)/conftools/mkinstalldirs
45
46MANFILE = $(srcdir)/doc/xmlwf.1
47APIHEADER = $(srcdir)/lib/expat.h $(srcdir)/lib/expat_external.h
48LIBRARY = libexpat.la
49
50DESTDIR = $(INSTALL_ROOT)
51
52default:  buildlib xmlwf/xmlwf
53
54buildlib: $(LIBRARY)
55
56all: $(LIBRARY) xmlwf/xmlwf examples/elements examples/outline
57
58clean:
59	cd lib && rm -f $(LIBRARY) *.o *.lo && rm -rf .libs _libs
60	cd xmlwf && rm -f xmlwf *.o *.lo && rm -rf .libs _libs
61	cd examples && rm -f elements outline *.o *.lo && rm -rf .libs _libs
62	cd tests && rm -rf .libs runtests runtests.o runtestspp runtestspp.o
63	cd tests && rm -f chardata.o minicheck.o
64	rm -rf .libs libexpat.la
65	rm -f examples/core tests/core xmlwf/core
66
67clobber: clean
68
69distclean: clean
70	rm -f expat_config.h config.status config.log config.cache libtool
71	rm -f Makefile
72
73extraclean: distclean
74	rm -f expat_config.h.in configure
75	rm -f conftools/ltconfig conftools/ltmain.sh conftools/libtool.m4
76
77check: tests/runtests tests/runtestspp
78	tests/runtests
79	tests/runtestspp
80
81install: xmlwf/xmlwf installlib
82	$(mkinstalldirs) $(DESTDIR)$(bindir) $(DESTDIR)$(man1dir)
83	$(LIBTOOL) --mode=install $(INSTALL_PROGRAM) xmlwf/xmlwf $(DESTDIR)$(bindir)/xmlwf
84	$(INSTALL_DATA) $(MANFILE) $(DESTDIR)$(man1dir)
85
86installlib: $(LIBRARY) $(APIHEADER)
87	$(mkinstalldirs) $(DESTDIR)$(libdir) $(DESTDIR)$(includedir)
88	$(LIBTOOL) --mode=install $(INSTALL) $(LIBRARY) $(DESTDIR)$(libdir)/$(LIBRARY)
89	for FN in $(APIHEADER) ; do $(INSTALL_DATA) $$FN $(DESTDIR)$(includedir) ; done
90
91uninstall: uninstalllib
92	$(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(bindir)/xmlwf
93	rm -f $(DESTDIR)$(man1dir)/xmlwf.1
94
95uninstalllib:
96	$(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(libdir)/$(LIBRARY)
97	rm -f $(DESTDIR)$(includedir)/expat.h
98	rm -f $(DESTDIR)$(includedir)/expat_external.h
99
100# for VPATH builds (invoked by configure)
101mkdir-init:
102	@for d in lib xmlwf examples tests ; do \
103		(mkdir $$d 2> /dev/null || test 1) ; \
104	done
105
106CC = @CC@
107CXX = @CXX@
108LIBTOOL = @LIBTOOL@
109
110INCLUDES = -I$(srcdir)/lib -I.
111LDFLAGS = @LDFLAGS@
112CPPFLAGS = @CPPFLAGS@ -DHAVE_EXPAT_CONFIG_H
113CFLAGS = @CFLAGS@
114CXXFLAGS = @CXXFLAGS@
115VSNFLAG = -version-info @LIBCURRENT@:@LIBREVISION@:@LIBAGE@
116
117### autoconf this?
118LTFLAGS = --silent
119
120COMPILE = $(CC) $(INCLUDES) $(CFLAGS) $(DEFS) $(CPPFLAGS)
121CXXCOMPILE = $(CXX) $(INCLUDES) $(CXXFLAGS) $(DEFS) $(CPPFLAGS)
122LTCOMPILE = $(LIBTOOL) $(LTFLAGS) --mode=compile $(COMPILE)
123LINK_LIB = $(LIBTOOL) $(LTFLAGS) --mode=link $(COMPILE) -no-undefined $(VSNFLAG) -rpath $(libdir) $(LDFLAGS) -o $@
124LINK_EXE = $(LIBTOOL) $(LTFLAGS) --mode=link $(COMPILE) $(LDFLAGS) -o $@
125LINK_CXX_EXE = $(LIBTOOL) $(LTFLAGS) --mode=link $(CXXCOMPILE) $(LDFLAGS) -o $@
126
127LIB_OBJS = lib/xmlparse.lo lib/xmltok.lo lib/xmlrole.lo
128$(LIBRARY): $(LIB_OBJS)
129	$(LINK_LIB) $(LIB_OBJS)
130
131lib/xmlparse.lo: lib/xmlparse.c lib/expat.h lib/xmlrole.h lib/xmltok.h \
132	$(top_builddir)/expat_config.h lib/expat_external.h lib/internal.h
133
134lib/xmlrole.lo: lib/xmlrole.c lib/ascii.h lib/xmlrole.h \
135	$(top_builddir)/expat_config.h lib/expat_external.h lib/internal.h
136
137lib/xmltok.lo: lib/xmltok.c lib/xmltok_impl.c lib/xmltok_ns.c \
138	lib/ascii.h lib/asciitab.h lib/iasciitab.h lib/latin1tab.h \
139	lib/nametab.h lib/utf8tab.h lib/xmltok.h lib/xmltok_impl.h \
140	$(top_builddir)/expat_config.h lib/expat_external.h lib/internal.h
141
142
143XMLWF_OBJS = xmlwf/xmlwf.o xmlwf/xmlfile.o xmlwf/codepage.o xmlwf/@FILEMAP@.o
144xmlwf/xmlwf.o: xmlwf/xmlwf.c
145xmlwf/xmlfile.o: xmlwf/xmlfile.c
146xmlwf/codepage.o: xmlwf/codepage.c
147xmlwf/@FILEMAP@.o: xmlwf/@FILEMAP@.c
148xmlwf/xmlwf: $(XMLWF_OBJS) $(LIBRARY)
149	$(LINK_EXE) $(XMLWF_OBJS) $(LIBRARY)
150
151examples/elements.o: examples/elements.c
152examples/elements: examples/elements.o $(LIBRARY)
153	$(LINK_EXE) $< $(LIBRARY)
154
155examples/outline.o: examples/outline.c
156examples/outline: examples/outline.o $(LIBRARY)
157	$(LINK_EXE) $< $(LIBRARY)
158
159tests/chardata.o: tests/chardata.c tests/chardata.h
160tests/minicheck.o: tests/minicheck.c tests/minicheck.h
161tests/runtests.o: tests/runtests.c tests/chardata.h
162tests/runtests: tests/runtests.o tests/chardata.o tests/minicheck.o $(LIBRARY)
163	$(LINK_EXE) tests/runtests.o tests/chardata.o tests/minicheck.o $(LIBRARY)
164tests/runtestspp.o: tests/runtestspp.cpp tests/runtests.c tests/chardata.h
165tests/runtestspp: tests/runtestspp.o tests/chardata.o tests/minicheck.o $(LIBRARY)
166	$(LINK_CXX_EXE) tests/runtestspp.o tests/chardata.o tests/minicheck.o $(LIBRARY)
167
168tests/xmlts.zip:
169	wget --output-document=tests/xmlts.zip \
170		http://www.w3.org/XML/Test/xmlts20020606.zip
171
172tests/XML-Test-Suite: tests/xmlts.zip
173	cd tests && unzip -q xmlts.zip
174
175run-xmltest: xmlwf/xmlwf tests/XML-Test-Suite
176	tests/xmltest.sh
177
178.SUFFIXES: .c .cpp .lo .o
179
180.cpp.o:
181	$(CXXCOMPILE) -o $@ -c $<
182.c.o:
183	$(COMPILE) -o $@ -c $<
184.c.lo:
185	$(LTCOMPILE) -o $@ -c $<
186
187.PHONY: buildlib all \
188	clean distclean extraclean maintainer-clean \
189	dist distdir \
190	install uninstall
191