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
21SHELL = @SHELL@
22
23srcdir = @srcdir@
24top_srcdir = @top_srcdir@
25VPATH = @srcdir@
26
27prefix = @prefix@
28exec_prefix = @exec_prefix@
29
30bindir = @bindir@
31libdir = @libdir@
32includedir = @includedir@
33mandir = ${prefix}/man/man1
34
35top_builddir = .
36
37
38INSTALL = @INSTALL@
39INSTALL_PROGRAM = @INSTALL_PROGRAM@
40INSTALL_DATA = @INSTALL_DATA@
41mkinstalldirs = $(SHELL) $(top_srcdir)/conftools/mkinstalldirs
42
43MANFILE = $(srcdir)/doc/xmlwf.1
44APIHEADER = $(srcdir)/lib/expat.h
45LIBRARY = libexpat.la
46
47
48default:  buildlib xmlwf/xmlwf
49
50buildlib: $(LIBRARY)
51
52all: $(LIBRARY) xmlwf/xmlwf examples/elements examples/outline
53
54clean:
55	cd lib && rm -f $(LIBRARY) *.o *.lo && rm -rf .libs _libs
56	cd xmlwf && rm -f xmlwf *.o *.lo && rm -rf .libs _libs
57	cd examples && rm -f elements outline *.o *.lo && rm -rf .libs _libs
58	cd tests && rm -rf .libs runtests runtests.o chardata.o
59	rm -rf .libs libexpat.la
60	rm -f examples/core tests/core xmlwf/core
61
62clobber: clean
63
64distclean: clean
65	rm -f expat_config.h config.status config.log config.cache libtool
66	rm -f Makefile
67
68extraclean: distclean
69	rm -f expat_config.h.in configure
70	rm -f conftools/ltconfig conftools/ltmain.sh conftools/libtool.m4
71
72check: tests/runtests
73	tests/runtests
74
75install: xmlwf/xmlwf installlib
76	$(mkinstalldirs) $(bindir) $(mandir)
77	$(LIBTOOL) --mode=install $(INSTALL_PROGRAM) xmlwf/xmlwf $(bindir)/xmlwf
78	$(INSTALL_DATA) $(MANFILE) $(mandir)
79
80installlib: $(LIBRARY) $(APIHEADER)
81	$(mkinstalldirs) $(libdir) $(includedir)
82	$(LIBTOOL) --mode=install $(INSTALL) $(LIBRARY) $(libdir)/$(LIBRARY)
83	$(INSTALL_DATA) $(APIHEADER) $(includedir)
84
85uninstall: uninstalllib
86	$(LIBTOOL) --mode=uninstall rm -f $(bindir)/xmlwf
87	rm -f $(mandir)/xmlwf.1
88
89uninstalllib:
90	$(LIBTOOL) --mode=uninstall rm -f $(libdir)/$(LIBRARY)
91	rm -f $(includedir)/$(APIHEADER)
92
93# for VPATH builds (invoked by configure)
94mkdir-init:
95	@for d in lib xmlwf examples tests ; do \
96		(mkdir $$d 2> /dev/null || test 1) ; \
97	done
98
99CC = @CC@
100LIBTOOL = @LIBTOOL@
101
102INCLUDES = -I$(srcdir)/lib -I.
103LDFLAGS = @LDFLAGS@
104CPPFLAGS = @CPPFLAGS@
105CFLAGS = @CFLAGS@
106VSNFLAG = -version-info @LIBCURRENT@:@LIBREVISION@:@LIBAGE@
107
108### autoconf this?
109LTFLAGS = --silent
110
111COMPILE = $(CC) $(CFLAGS) $(DEFS) $(CPPFLAGS) $(INCLUDES)
112LTCOMPILE = $(LIBTOOL) $(LTFLAGS) --mode=compile $(COMPILE)
113LINK_LIB = $(LIBTOOL) $(LTFLAGS) --mode=link $(COMPILE) -no-undefined $(VSNFLAG) -rpath $(libdir) $(LDFLAGS) -o $@
114LINK_EXE = $(LIBTOOL) $(LTFLAGS) --mode=link $(COMPILE) $(LDFLAGS) -o $@
115
116LIB_OBJS = lib/xmlparse.lo lib/xmltok.lo lib/xmlrole.lo
117$(LIBRARY): $(LIB_OBJS)
118	$(LINK_LIB) $(LIB_OBJS)
119
120lib/xmlparse.lo: lib/xmlparse.c lib/expat.h lib/xmlrole.h lib/xmltok.h \
121	$(top_builddir)/expat_config.h lib/internal.h
122
123lib/xmlrole.lo: lib/xmlrole.c lib/ascii.h lib/xmlrole.h \
124	$(top_builddir)/expat_config.h lib/internal.h
125
126lib/xmltok.lo: lib/xmltok.c lib/xmltok_impl.c lib/xmltok_ns.c \
127	lib/ascii.h lib/asciitab.h lib/iasciitab.h lib/latin1tab.h \
128	lib/nametab.h lib/utf8tab.h lib/xmltok.h lib/xmltok_impl.h \
129	$(top_builddir)/expat_config.h
130
131
132XMLWF_OBJS = xmlwf/xmlwf.o xmlwf/xmlfile.o xmlwf/codepage.o xmlwf/@FILEMAP@.o
133xmlwf/xmlwf.o: xmlwf/xmlwf.c
134xmlwf/xmlfile.o: xmlwf/xmlfile.c
135xmlwf/codepage.o: xmlwf/codepage.c
136xmlwf/@FILEMAP@.o: xmlwf/@FILEMAP@.c
137xmlwf/xmlwf: $(XMLWF_OBJS) $(LIBRARY)
138	$(LINK_EXE) $(XMLWF_OBJS) $(LIBRARY)
139
140examples/elements.o: examples/elements.c
141examples/elements: examples/elements.o $(LIBRARY)
142	$(LINK_EXE) $< $(LIBRARY)
143
144examples/outline.o: examples/outline.c
145examples/outline: examples/outline.o $(LIBRARY)
146	$(LINK_EXE) $< $(LIBRARY)
147
148tests/chardata.o: tests/chardata.c tests/chardata.h
149tests/runtests.o: tests/runtests.c tests/chardata.h
150tests/runtests: tests/runtests.o tests/chardata.o $(LIBRARY)
151	$(LINK_EXE) $^ -lcheck
152
153tests/xmlts.zip:
154	wget --output-document=tests/xmlts.zip \
155		http://www.w3.org/XML/Test/xmlts20020606.zip
156
157tests/XML-Test-Suite: tests/xmlts.zip
158	cd tests && unzip -q xmlts.zip
159
160run-xmltest: xmlwf/xmlwf tests/XML-Test-Suite
161	tests/xmltest.sh
162
163.SUFFIXES: .c .lo .o
164
165.c.o:
166	$(COMPILE) -o $@ -c $<
167.c.lo:
168	$(LTCOMPILE) -o $@ -c $<
169
170.PHONY: buildlib all \
171	clean distclean extraclean maintainer-clean \
172	dist distdir \
173	install uninstall
174