* 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
This commit is contained in:
Greg Stein 2001-12-07 10:19:31 +00:00
parent 5ca5c566a6
commit a13d856e8f
10 changed files with 90 additions and 212 deletions

View file

@ -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

View file

@ -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

View file

@ -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)

View file

@ -5,3 +5,4 @@ outline
outline.plg
Debug
Release
.libs

View file

@ -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)

View file

@ -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

View file

@ -1,2 +1,3 @@
Makefile
runtests
.libs

View file

@ -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)

View file

@ -3,3 +3,4 @@ Release
xmlwf.plg
Makefile
xmlwf
.libs

View file

@ -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)