From a13d856e8f05c60e23a3d08ddd7b50881f4ba4d8 Mon Sep 17 00:00:00 2001 From: Greg Stein Date: Fri, 7 Dec 2001 10:19:31 +0000 Subject: [PATCH] * Switch to a single, top-level Makefile (simplification, consistency) * use libtool to compile/link all programs * remove */Makefile.in and remove them from configure * remove autom4te.cache after running autoconf * remove .o from the FILEMAP logic in configure and the Make system; provides more flexibility in the Makefile to use it * for VPATH builds: create the build subdirs by running "make mkdir-init" from the configure script * adjust .cvsignore files to account for presence of .libs now --- expat/Makefile.in | 95 ++++++++++++++++++++++++++++++-------- expat/buildconf.sh | 3 ++ expat/configure.in | 25 ++++------ expat/examples/.gitignore | 1 + expat/examples/Makefile.in | 39 ---------------- expat/lib/Makefile.in | 80 -------------------------------- expat/tests/.gitignore | 1 + expat/tests/Makefile.in | 21 --------- expat/xmlwf/.gitignore | 1 + expat/xmlwf/Makefile.in | 36 --------------- 10 files changed, 90 insertions(+), 212 deletions(-) delete mode 100644 expat/examples/Makefile.in delete mode 100644 expat/lib/Makefile.in delete mode 100644 expat/tests/Makefile.in delete mode 100644 expat/xmlwf/Makefile.in diff --git a/expat/Makefile.in b/expat/Makefile.in index 87157af8..e4171207 100644 --- a/expat/Makefile.in +++ b/expat/Makefile.in @@ -33,6 +33,7 @@ SHELL = @SHELL@ srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ + prefix = @prefix@ exec_prefix = @exec_prefix@ @@ -48,43 +49,33 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_DATA = @INSTALL_DATA@ mkinstalldirs = $(SHELL) $(top_srcdir)/conftools/mkinstalldirs -CC = @CC@ - -LIBTOOL = @LIBTOOL@ - -SUBDIRS = lib examples xmlwf -CONFIG_HEADERS = config.h - APIHEADER = expat.h LIBRARY = libexpat.la -default: lib xmlwf +default: buildlib xmlwf/xmlwf -buildlib: lib +buildlib: lib/$(LIBRARY) -all: $(SUBDIRS) - -$(SUBDIRS):: - cd $@ && $(MAKE) +all: lib/$(LIBRARY) xmlwf/xmlwf examples/elements examples/outline clean: cd lib && rm -f $(LIBRARY) *.o *.lo && rm -rf .libs _libs - cd xmlwf && rm -f xmlwf *.o - cd examples && rm -f elements outline *.o + cd xmlwf && rm -f xmlwf *.o *.lo && rm -rf .libs _libs + cd examples && rm -f elements outline *.o *.lo && rm -rf .libs _libs find . -name core | xargs rm -f distclean: clean rm -f config.h config.status config.log config.cache libtool - rm -f Makefile lib/Makefile examples/Makefile xmlwf/Makefile tests/Makefile + rm -f Makefile extraclean: distclean rm -f config.h.in configure rm -f conftools/config.guess conftools/config.sub rm -f conftools/ltconfig conftools/ltmain.sh -check: $(SUBDIRS) - cd tests && $(MAKE) check +check: tests/runtests + @cd tests && ./runtests install: xmlwf/xmlwf lib/$(LIBRARY) lib/$(APIHEADER) $(mkinstalldirs) $(bindir) $(libdir) $(includedir) @@ -97,7 +88,73 @@ uninstall: $(LIBTOOL) --mode=uninstall rm -f $(libdir)/$(LIBRARY) rm -f $(libdir)/$(APIHEADER) -.PHONY: buildlib all $(SUBDIRS) \ +# for VPATH builds (invoked by configure) +mkdir-init: + @for d in lib xmlwf examples tests ; do \ + (mkdir $$d 2> /dev/null || test 1) ; \ + done + +CC = @CC@ +LIBTOOL = @LIBTOOL@ + +INCLUDES = -Ilib -I. +LDFLAGS = @LDFLAGS@ +CPPFLAGS = @CPPFLAGS@ +CFLAGS = @CFLAGS@ +VSNFLAG = -version-info @LIBCURRENT@:@LIBREVISION@:@LIBAGE@ + +### autoconf this? +LTFLAGS = --silent + +COMPILE = $(CC) $(CFLAGS) $(DEFS) $(CPPFLAGS) $(INCLUDES) +LTCOMPILE = $(LIBTOOL) $(LTFLAGS) --mode=compile $(COMPILE) +LINK_LIB = $(LIBTOOL) $(LTFLAGS) --mode=link $(COMPILE) $(VSNFLAG) -rpath $(libdir) $(LDFLAGS) -o $@ +LINK_EXE = $(LIBTOOL) $(LTFLAGS) --mode=link $(COMPILE) $(LDFLAGS) -o $@ + +LIB_OBJS = lib/xmlparse.lo lib/xmltok.lo lib/xmlrole.lo +lib/$(LIBRARY): $(LIB_OBJS) + $(LINK_LIB) $(LIB_OBJS) + +lib/xmlparse.lo: lib/xmlparse.c lib/expat.h lib/xmlrole.h lib/xmltok.h \ + $(top_builddir)/config.h + +lib/xmlrole.lo: lib/xmlrole.c lib/ascii.h lib/xmlrole.h \ + $(top_builddir)/config.h + +lib/xmltok.lo: lib/xmltok.c lib/xmltok_impl.c lib/xmltok_ns.c \ + lib/ascii.h lib/asciitab.h lib/iasciitab.h lib/latin1tab.h \ + lib/nametab.h lib/utf8tab.h lib/xmltok.h lib/xmltok_impl.h \ + $(top_builddir)/config.h + + +XMLWF_OBJS = xmlwf/xmlwf.o xmlwf/xmlfile.o xmlwf/codepage.o xmlwf/@FILEMAP@.o +xmlwf/xmlwf.o: xmlwf/xmlwf.c +xmlwf/xmlfile.o: xmlwf/xmlfile.c +xmlwf/codepage.o: xmlwf/codepage.c +xmlwf/@FILEMAP@.o: xmlwf/@FILEMAP@.c +xmlwf/xmlwf: $(XMLWF_OBJS) + $(LINK_EXE) $(XMLWF_OBJS) lib/$(LIBRARY) + +examples/elements.o: examples/elements.c +examples/elements: examples/elements.o + $(LINK_EXE) $< lib/$(LIBRARY) + +examples/outline.o: examples/outline.c +examples/outline: examples/outline.o + $(LINK_EXE) $< lib/$(LIBRARY) + +tests/runtests.o: tests/runtests.c +tests/runtests: tests/runtests.o + $(LINK_EXE) $< lib/$(LIBRARY) + +.SUFFIXES: .c .lo .o + +.c.o: + $(COMPILE) -o $@ -c $< +.c.lo: + $(LTCOMPILE) -o $@ -c $< + +.PHONY: buildlib all \ clean distclean extraclean maintainer-clean \ dist distdir \ install uninstall diff --git a/expat/buildconf.sh b/expat/buildconf.sh index 362ff81c..3410a05a 100755 --- a/expat/buildconf.sh +++ b/expat/buildconf.sh @@ -41,5 +41,8 @@ echo "Creating configure ..." ### do some work to toss config.cache? autoconf +# toss this; it gets created by autoconf on some systems +rm -rf autom4te.cache + # exit with the right value, so any calling script can continue exit 0 diff --git a/expat/configure.in b/expat/configure.in index 436e3a35..a3f4eb75 100644 --- a/expat/configure.in +++ b/expat/configure.in @@ -79,27 +79,18 @@ AC_FUNC_MEMCMP AC_FUNC_MMAP if test "$ac_cv_func_mmap_fixed_mapped" = "yes"; then - FILEMAP_OBJ=unixfilemap.o + FILEMAP=unixfilemap else - FILEMAP_OBJ=readfilemap.o + FILEMAP=readfilemap fi -AC_SUBST(FILEMAP_OBJ) +AC_SUBST(FILEMAP) AC_CHECK_FUNCS(memmove bcopy) -dnl Generate makefiles only for the directories that are present; -dnl this allows this (and the generated configure script) to work -dnl in "embedded distributions", where only part of the Expat sources -dnl are included in the sources for another project. +AC_OUTPUT(Makefile) -OUTPUT="Makefile lib/Makefile" -if test -d ${srcdir}/xmlwf; then - OUTPUT="$OUTPUT xmlwf/Makefile" +abs_srcdir="`cd $srcdir && pwd`" +abs_builddir="`pwd`" +if test "$abs_srcdir" != "$abs_builddir"; then + make mkdir-init fi -if test -d ${srcdir}/examples; then - OUTPUT="$OUTPUT examples/Makefile" -fi -if test -d ${srcdir}/tests; then - OUTPUT="$OUTPUT tests/Makefile" -fi -AC_OUTPUT($OUTPUT) diff --git a/expat/examples/.gitignore b/expat/examples/.gitignore index f82d21ec..88a46969 100644 --- a/expat/examples/.gitignore +++ b/expat/examples/.gitignore @@ -5,3 +5,4 @@ outline outline.plg Debug Release +.libs diff --git a/expat/examples/Makefile.in b/expat/examples/Makefile.in deleted file mode 100644 index db9b9f79..00000000 --- a/expat/examples/Makefile.in +++ /dev/null @@ -1,39 +0,0 @@ -################################################################ -# Process this file with top-level configure script to produce Makefile -# -# Copyright 2000 Clark Cooper -# -# This file is part of EXPAT. -# -# EXPAT is free software; you can redistribute it and/or modify it -# under the terms of the License (based on the MIT/X license) contained -# in the file COPYING that comes with this distribution. -# -# EXPAT IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -# SOFTWARE OR THE USE OR OTHER DEALINGS IN EXPAT. -# - -LIBDIR = ../lib/.libs -INCDIR = ../lib - -CPPFLAGS = @CPPFLAGS@ -LDFLAGS = @LDFLAGS@ -static -LIBS = -L$(LIBDIR) -lexpat -CC = @CC@ -CFLAGS = @CFLAGS@ -I$(INCDIR) - -VPATH = @srcdir@ - - -all: elements outline - -elements: elements.o - $(CC) -o $@ $< $(LDFLAGS) $(LIBS) - -outline: outline.o - $(CC) -o $@ $< $(LDFLAGS) $(LIBS) diff --git a/expat/lib/Makefile.in b/expat/lib/Makefile.in deleted file mode 100644 index fd6635ec..00000000 --- a/expat/lib/Makefile.in +++ /dev/null @@ -1,80 +0,0 @@ -################################################################ -# Process this file with top-level configure script to produce Makefile -# -# Copyright 2000 Clark Cooper -# -# This file is part of EXPAT. -# -# EXPAT is free software; you can redistribute it and/or modify it -# under the terms of the License (based on the MIT/X license) contained -# in the file COPYING that comes with this distribution. -# -# EXPAT IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -# SOFTWARE OR THE USE OR OTHER DEALINGS IN EXPAT. -# - - -SHELL = @SHELL@ - -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ -VPATH = @srcdir@ -prefix = @prefix@ -exec_prefix = @exec_prefix@ - -libdir = @libdir@ - -top_builddir = .. - -CC = @CC@ -LIBTOOL = @LIBTOOL@ - -LIBRARY = libexpat.la -LTOBJECTS = xmlparse.lo xmltok.lo xmlrole.lo - -INCLUDES = -I$(srcdir) -I. -I.. -DEFS = @DEFS@ - -CPPFLAGS = @CPPFLAGS@ -LDFLAGS = @LDFLAGS@ -LIBS = @LIBS@ -CFLAGS = @CFLAGS@ - -LIBREVISION = @LIBREVISION@ -LIBCURRENT = @LIBCURRENT@ -LIBAGE = @LIBAGE@ - -COMPILE = $(CC) $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) -LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) -LINK = $(LIBTOOL) --mode=link $(CC) -version-info $(LIBCURRENT):$(LIBREVISION):$(LIBAGE) $(CFLAGS) $(LDFLAGS) -o $@ - - -all: $(LIBRARY) - -.SUFFIXES: .c .lo .o -.PHONY: all - -.c.o: - $(COMPILE) -c $< - -.c.lo: - $(LTCOMPILE) -c $< - -$(LIBRARY): $(LTOBJECTS) - $(LINK) -rpath $(libdir) $(LDFLAGS) $(LTOBJECTS) - -xmlparse.o \ -xmlparse.lo: xmlparse.c expat.h xmlrole.h xmltok.h $(top_builddir)/config.h - -xmlrole.o \ -xmlrole.lo: xmlrole.c ascii.h xmlrole.h $(top_builddir)/config.h - -xmltok.o \ -xmltok.lo: xmltok.c xmltok_impl.c xmltok_ns.c \ - ascii.h asciitab.h iasciitab.h latin1tab.h nametab.h utf8tab.h \ - xmltok.h xmltok_impl.h $(top_builddir)/config.h diff --git a/expat/tests/.gitignore b/expat/tests/.gitignore index 0099d7bb..337b6517 100644 --- a/expat/tests/.gitignore +++ b/expat/tests/.gitignore @@ -1,2 +1,3 @@ Makefile runtests +.libs diff --git a/expat/tests/Makefile.in b/expat/tests/Makefile.in deleted file mode 100644 index fc8c47f4..00000000 --- a/expat/tests/Makefile.in +++ /dev/null @@ -1,21 +0,0 @@ -SHELL = @SHELL@ - -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ -VPATH = @srcdir@ - -CC=@CC@ -CPPFLAGS = @CPPFLAGS@ -I../lib -LDFLAGS = @LDFLAGS@ -L../lib -LIBS = @LIBS@ -lexpat -lcheck -CFLAGS = @CFLAGS@ - - -check: runtests - @./runtests - -runtests.o: runtests.c - $(CC) $(CPPFLAGS) $(CFLAGS) -c $< -o $@ - -runtests: runtests.o - $(CC) $(LDFLAGS) $< -o $@ $(LIBS) diff --git a/expat/xmlwf/.gitignore b/expat/xmlwf/.gitignore index 5e2763da..90464b41 100755 --- a/expat/xmlwf/.gitignore +++ b/expat/xmlwf/.gitignore @@ -3,3 +3,4 @@ Release xmlwf.plg Makefile xmlwf +.libs diff --git a/expat/xmlwf/Makefile.in b/expat/xmlwf/Makefile.in deleted file mode 100644 index f17ab78e..00000000 --- a/expat/xmlwf/Makefile.in +++ /dev/null @@ -1,36 +0,0 @@ -################################################################ -# Process this file with top-level configure script to produce Makefile -# -# Copyright 2000 Clark Cooper -# -# This file is part of EXPAT. -# -# EXPAT is free software; you can redistribute it and/or modify it -# under the terms of the License (based on the MIT/X license) contained -# in the file COPYING that comes with this distribution. -# -# EXPAT IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -# SOFTWARE OR THE USE OR OTHER DEALINGS IN EXPAT. -# - -srcdir=@srcdir@ - -LIBDIR= ../lib/.libs -INCDIR= $(srcdir)/../lib - -LDFLAGS= @LDFLAGS@ -static -CFLAGS= @CFLAGS@ -I$(INCDIR) -CC = @CC@ - -OBJS= xmlwf.o xmlfile.o codepage.o @FILEMAP_OBJ@ -LIBS= -L$(LIBDIR) -lexpat - -VPATH = @srcdir@ - -xmlwf: $(OBJS) - $(CC) -o xmlwf $(LDFLAGS) $(OBJS) $(LIBS)