From 2c56a79c6b9a65bf3a624b35604fb8a11de5a7ef Mon Sep 17 00:00:00 2001 From: John Mark Bell Date: Tue, 24 Mar 2009 17:48:46 +0000 Subject: Port to new buildsystem svn path=/trunk/libparserutils/; revision=6854 --- Makefile | 60 ++++++--------- Makefile-riscos | 53 ------------- Makefile-ronative | 57 -------------- Makefile.config | 7 ++ build/Makefile.common | 170 ----------------------------------------- build/Makefile.config | 7 -- src/Makefile | 49 +----------- src/charset/Makefile | 49 +----------- src/charset/codecs/Makefile | 47 +----------- src/charset/encodings/Makefile | 46 +---------- src/input/Makefile | 46 +---------- src/utils/Makefile | 49 +----------- test/Makefile | 109 ++------------------------ 13 files changed, 50 insertions(+), 699 deletions(-) delete mode 100644 Makefile-riscos delete mode 100644 Makefile-ronative create mode 100644 Makefile.config delete mode 100644 build/Makefile.common delete mode 100644 build/Makefile.config diff --git a/Makefile b/Makefile index aef1980..670ffb9 100644 --- a/Makefile +++ b/Makefile @@ -1,46 +1,34 @@ -# Toolchain definitions for building on the destination platform -CC := gcc -AR := ar -LD := gcc - -CP := cp -RM := rm -MKDIR := mkdir -MV := mv -ECHO := echo -MAKE := make -PERL := perl -PKGCONFIG := pkg-config -INSTALL := install -SED := sed -TOUCH := touch -LCOV := lcov -GENHTML := genhtml -DOXYGEN := doxygen +# Component settings +COMPONENT := parserutils +# Default to a static library +COMPONENT_TYPE ?= lib-static + +# Setup the tooling +include build/makefiles/Makefile.tools + +TESTRUNNER := $(PERL) build/testtools/testrunner.pl # Toolchain flags WARNFLAGS := -Wall -Wextra -Wundef -Wpointer-arith -Wcast-align \ -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes \ -Wmissing-declarations -Wnested-externs -Werror -pedantic -CFLAGS = -std=c99 -D_BSD_SOURCE -I$(TOP)/include/ $(WARNFLAGS) -RELEASECFLAGS = $(CFLAGS) -DNDEBUG -O2 -DEBUGCFLAGS = $(CFLAGS) -O0 -g -ARFLAGS := -cru -LDFLAGS = -L$(TOP)/ +CFLAGS := $(CFLAGS) -std=c99 -D_BSD_SOURCE -I$(CURDIR)/include/ \ + -I$(CURDIR)/src $(WARNFLAGS) + +include build/makefiles/Makefile.top -CPFLAGS := -RMFLAGS := -f -MKDIRFLAGS := -p -MVFLAGS := -ECHOFLAGS := -MAKEFLAGS := -PKGCONFIGFLAGS := -TOUCHFLAGS := +# Extra installation rules +I := include/parserutils +INSTALL_ITEMS := $(INSTALL_ITEMS) /$(I):$(I)/errors.h;$(I)/functypes.h;$(I)/parserutils.h;$(I)/types.h -EXEEXT := +I := include/parserutils/charset +INSTALL_ITEMS := $(INSTALL_ITEMS) /$(I):$(I)/codec.h;$(I)/mibenum.h;$(I)utf16.h;$(I)/utf8.h -# Default installation prefix -PREFIX ?= /usr/local +I := include/parserutils/inputstream +INSTALL_ITEMS := $(INSTALL_ITEMS) /$(I):$(I)/inputstream.h +I := include/parserutils/utils +INSTALL_ITEMS := $(INSTALL_ITEMS) /$(I):$(I)/buffer.h;$(I)/stack.h;$(I)/vector.h -include build/Makefile.common +INSTALL_ITEMS := $(INSTALL_ITEMS) /lib/pkgconfig:lib$(COMPONENT).pc.in +INSTALL_ITEMS := $(INSTALL_ITEMS) /lib:$(BUILDDIR)/lib$(COMPONENT)$(LIBEXT) diff --git a/Makefile-riscos b/Makefile-riscos deleted file mode 100644 index 1f05f28..0000000 --- a/Makefile-riscos +++ /dev/null @@ -1,53 +0,0 @@ -# Toolchain definitions for building for RISC OS using the GCCSDK cross-compiler -GCCSDK_INSTALL_CROSSBIN ?= /home/riscos/cross/bin -GCCSDK_INSTALL_ENV ?= /home/riscos/env - -CC := $(wildcard $(GCCSDK_INSTALL_CROSSBIN)/*gcc) -AR := $(wildcard $(GCCSDK_INSTALL_CROSSBIN)/*ar) -LD := $(CC) - -CP := cp -RM := rm -MKDIR := mkdir -MV := mv -ECHO := echo -MAKE := make -PERL := perl -PKGCONFIG := $(GCCSDK_INSTALL_ENV)/ro-pkg-config -INSTALL := install -SED := sed -TOUCH := touch -LCOV := echo -GENHTML := echo -DOXYGEN := doxygen - -# Toolchain flags -WARNFLAGS := -Wall -Wextra -Wundef -Wpointer-arith -Wcast-align \ - -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes \ - -Wmissing-declarations -Wnested-externs -Werror -pedantic -CFLAGS = -std=c99 -D_BSD_SOURCE -I$(TOP)/include/ $(WARNFLAGS) \ - -mpoke-function-name -RELEASECFLAGS = $(CFLAGS) -DNDEBUG -O2 -DEBUGCFLAGS = $(CFLAGS) -O0 -g -ARFLAGS := -cru -LDFLAGS = -L$(TOP)/ - -CPFLAGS := -RMFLAGS := -f -MKDIRFLAGS := -p -MVFLAGS := -ECHOFLAGS := -MAKEFLAGS := -PKGCONFIGFLAGS := -TOUCHFLAGS := - -ifneq (,$(findstring arm-unknown-riscos-gcc,$(CC))) - EXEEXT := ,e1f -else - EXEEXT := ,ff8 -endif - -# Default installation prefix -PREFIX ?= $(GCCSDK_INSTALL_ENV) - -include build/Makefile.common diff --git a/Makefile-ronative b/Makefile-ronative deleted file mode 100644 index cf38a3e..0000000 --- a/Makefile-ronative +++ /dev/null @@ -1,57 +0,0 @@ -# Toolchain definitions for building on RISC OS -GCCSDK_INSTALL_ENV ?= - -CC := gcc -AR := ar -LD := gcc - -CP := cp -RM := rm -MKDIR := mkdir -MV := mv -ECHO := echo -MAKE := make -PERL := perl -PKGCONFIG := echo -INSTALL := echo -SED := sed -TOUCH := touch -LCOV := echo -GENHTML := echo -DOXYGEN := doxygen - -# Toolchain flags -WARNFLAGS := -Wall -Wextra -Wundef -Wpointer-arith -Wcast-align \ - -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes \ - -Wmissing-declarations -Wnested-externs -Werror -pedantic -CFLAGS = -std=c99 -D_BSD_SOURCE -I$(TOP)/include/ $(WARNFLAGS) \ - -mpoke-function-name -RELEASECFLAGS = $(CFLAGS) -DNDEBUG -O2 -DEBUGCFLAGS = $(CFLAGS) -O0 -g -ARFLAGS := -cru -LDFLAGS = -L$(TOP)/ - -CPFLAGS := -RMFLAGS := -f -MKDIRFLAGS := -p -MVFLAGS := -ECHOFLAGS := -MAKEFLAGS := -PKGCONFIGFLAGS := -TOUCHFLAGS := - -EXEEXT := - -# Default installation prefix -PREFIX ?= $(GCCSDK_INSTALL_ENV) - -# This is nasty, but needed because $(CURDIR) will -# contain colons, and thus confuse make mightily -$(shell SetMacro Alias$$LPUpwd Set %0 :|$$CSD>|mUnset Alias$$LPUpwd) -$(shell LPUpwd LibParserUtils$$Dir) -TOP := - -# Tell everyone that we're building on RISC OS, so they can work around things. -HOST := riscos - -include build/Makefile.common diff --git a/Makefile.config b/Makefile.config new file mode 100644 index 0000000..5bedbd3 --- /dev/null +++ b/Makefile.config @@ -0,0 +1,7 @@ +# Configuration Makefile fragment + +# Use iconv directly in the input filter +# CFLAGS += -DWITH_ICONV_FILTER + +# Cater for local configuration changes +-include build/Makefile.config.override diff --git a/build/Makefile.common b/build/Makefile.common deleted file mode 100644 index f1e2f93..0000000 --- a/build/Makefile.common +++ /dev/null @@ -1,170 +0,0 @@ -# Top-level Makefile fragment - -# Default target -all: release - -# Name of component -COMPONENT := libparserutils - -# Environment -TOP ?= $(CURDIR) -EXPORT := $(TOP)/dist -RELEASEDIR := build/Release -DEBUGDIR := build/Debug -COVERAGEDIR := build/coverage -DOCDIR := build/docs - -# List of items to delete on clean -ITEMS_CLEAN := -# List of items to delete on distclean -ITEMS_DISTCLEAN := - -# List of targets to run for testing -TARGET_TESTS := - -# Source files -SOURCES := - -# Include configuration Makefile fragment -include build/Makefile.config - -# Include Makefile fragments in subdirectories - -define do_include -DIR := $$(dir $(1)) -include $(1) - -endef - -MAKE_INCLUDES := $(wildcard */Makefile) -$(eval $(foreach INC, $(MAKE_INCLUDES), $(call do_include,$(INC)))) - -# Calculate objects to build -OBJECTS := $(subst /,_,$(subst .c,.o,$(SOURCES))) - -.PHONY: release debug test coverage profile docs \ - clean distclean setup export install uninstall - -# Rules -release: setup $(addprefix $(RELEASEDIR)/,$(OBJECTS)) - @$(AR) $(ARFLAGS) $(COMPONENT).a $(addprefix $(RELEASEDIR)/,$(OBJECTS)) - -debug: setup $(addprefix $(DEBUGDIR)/,$(OBJECTS)) - @$(AR) $(ARFLAGS) $(COMPONENT)-debug.a \ - $(addprefix $(DEBUGDIR)/,$(OBJECTS)) - -test: debug $(TARGET_TESTS) - -coverage: clean - @$(LCOV) --directory . --zerocounters - @$(MAKE) test CFLAGS="$(CFLAGS) -fprofile-arcs -ftest-coverage" \ - LDFLAGS="$(LDFLAGS) -lgcov" - @$(LCOV) --directory $(DEBUGDIR) --base-directory $(TOP) \ - --capture --output-file $(COVERAGEDIR)/$(COMPONENT)_tmp.info - @$(LCOV) --extract $(COVERAGEDIR)/$(COMPONENT)_tmp.info "$(TOP)/src*" \ - -o $(COVERAGEDIR)/$(COMPONENT).info - @$(RM) $(RMFLAGS) $(COVERAGEDIR)/$(COMPONENT)_tmp.info - @$(GENHTML) -o $(COVERAGEDIR) --num-spaces 2 \ - $(COVERAGEDIR)/$(COMPONENT).info - -profile: clean - @$(MAKE) test CFLAGS="$(CFLAGS) -pg" LDFLAGS="-pg $(LDFLAGS)" - -docs: setup - @$(DOXYGEN) build/Doxyfile - -clean: - -@$(RM) $(RMFLAGS) $(ITEMS_CLEAN) - -@$(RM) $(RMFLAGS) gmon.out - -@$(RM) $(RMFLAGS) -r $(DOCDIR) - -@$(RM) $(RMFLAGS) -r $(COVERAGEDIR) - -@$(RM) $(RMFLAGS) -r $(RELEASEDIR) - -@$(RM) $(RMFLAGS) -r $(DEBUGDIR) - -@$(RM) $(RMFLAGS) $(COMPONENT).a - -@$(RM) $(RMFLAGS) $(COMPONENT)-debug.a - -@$(RM) $(RMFLAGS) $(COMPONENT).pc - -distclean: clean - -@$(RM) $(RMFLAGS) $(ITEMS_DISTCLEAN) - -@$(RM) $(RMFLAGS) -r $(TOP)/dist - -setup: - @$(MKDIR) $(MKDIRFLAGS) $(RELEASEDIR)/deps - @$(MKDIR) $(MKDIRFLAGS) $(DEBUGDIR)/deps - @$(MKDIR) $(MKDIRFLAGS) $(COVERAGEDIR) - @$(MKDIR) $(MKDIRFLAGS) $(DOCDIR) - -export: - @$(MKDIR) $(MKDIRFLAGS) -p $(TOP)/dist - @$(MAKE) install PREFIX="$(TOP)/dist" - -install: release - @$(MKDIR) $(MKDIRFLAGS) -p $(DESTDIR)$(PREFIX)/lib/pkgconfig - @$(MKDIR) $(MKDIRFLAGS) -p $(DESTDIR)$(PREFIX)/include/parserutils - @$(MKDIR) $(MKDIRFLAGS) -p $(DESTDIR)$(PREFIX)/include/parserutils/charset - @$(MKDIR) $(MKDIRFLAGS) -p $(DESTDIR)$(PREFIX)/include/parserutils/input - @$(MKDIR) $(MKDIRFLAGS) -p $(DESTDIR)$(PREFIX)/include/parserutils/utils - @$(SED) -e 's#PREFIX#$(PREFIX)#' $(COMPONENT).pc.in >$(COMPONENT).pc - $(INSTALL) -m 644 $(COMPONENT).a $(DESTDIR)$(PREFIX)/lib - $(INSTALL) -m 644 $(COMPONENT).pc $(DESTDIR)$(PREFIX)/lib/pkgconfig - $(INSTALL) -m 644 $(filter %.h, $(wildcard include/parserutils/*)) $(DESTDIR)$(PREFIX)/include/parserutils - $(INSTALL) -m 644 $(filter %.h, $(wildcard include/parserutils/charset/*)) $(DESTDIR)$(PREFIX)/include/parserutils/charset - $(INSTALL) -m 644 $(filter %.h, $(wildcard include/parserutils/input/*)) $(DESTDIR)$(PREFIX)/include/parserutils/input - $(INSTALL) -m 644 $(filter %.h, $(wildcard include/parserutils/utils/*)) $(DESTDIR)$(PREFIX)/include/parserutils/utils - -uninstall: - $(RM) $(RMFLAGS) $(DESTDIR)$(PREFIX)/lib/$(COMPONENT).a - $(RM) $(RMFLAGS) $(DESTDIR)$(PREFIX)/lib/pkgconfig/$(COMPONENT).pc - $(RM) $(RMFLAGS) -r $(DESTDIR)$(PREFIX)/include/parserutils - -$(RELEASEDIR)/deps/created: - @$(MKDIR) $(MKDIRFLAGS) $(RELEASEDIR)/deps - @$(TOUCH) $(TOUCHFLAGS) $(RELEASEDIR)/deps/created - -$(DEBUGDIR)/deps/created: - @$(MKDIR) $(MKDIRFLAGS) $(DEBUGDIR)/deps - @$(TOUCH) $(TOUCHFLAGS) $(DEBUGDIR)/deps/created - -DEPFILES := - -define do_dep -DEPFILES += $(2) -$$(RELEASEDIR)/deps/$(2): $$(RELEASEDIR)/deps/created $(1) - @$$(ECHO) $$(ECHOFLAGS) "DEP $(1)" - @$$(RM) $$(RMFLAGS) $$(RELEASEDIR)/deps/$(2) - @$$(CC) $$(RELEASECFLAGS) -MM -MT \ - '$$(RELEASEDIR)/deps/$(2) $$(RELEASEDIR)/$(3)' \ - -MF $$(RELEASEDIR)/deps/$(2) $(1) - -$$(DEBUGDIR)/deps/$(2): $$(DEBUGDIR)/deps/created $(1) - @$$(ECHO) $$(ECHOFLAGS) "DEP $(1)" - @$$(RM) $$(RMFLAGS) $$(DEBUGDIR)/deps/$(2) - @$$(CC) $$(DEBUGCFLAGS) -MM -MT \ - '$$(DEBUGDIR)/deps/$(2) $$(DEBUGDIR)/$(3)' \ - -MF $$(DEBUGDIR)/deps/$(2) $(1) - -endef - -# Finally, build rules for compilation -define do_compile -$$(RELEASEDIR)/$(2): $(1) - @$$(ECHO) $$(ECHOFLAGS) "==> $(1)" - @$$(CC) -c $$(RELEASECFLAGS) -o $$@ $(1) - -$$(DEBUGDIR)/$(2): $(1) - @$$(ECHO) $$(ECHOFLAGS) "==> $(1)" - @$$(CC) -c $$(DEBUGCFLAGS) -o $$@ $(1) - -endef - -$(eval $(foreach SOURCE,$(filter %.c,$(SOURCES)), \ - $(call do_dep,$(SOURCE),$(subst /,_,$(SOURCE:.c=.d)),$(subst /,_,$(SOURCE:.c=.o))))) - -ifneq ($(findstring clean,$(MAKECMDGOALS)),clean) --include $(sort $(addprefix $(RELEASEDIR)/deps/,$(DEPFILES))) --include $(sort $(addprefix $(DEBUGDIR)/deps/,$(DEPFILES))) -endif - -$(eval $(foreach SOURCE,$(filter %.c,$(SOURCES)), \ - $(call do_compile,$(SOURCE),$(subst /,_,$(SOURCE:.c=.o))))) - diff --git a/build/Makefile.config b/build/Makefile.config deleted file mode 100644 index 5bedbd3..0000000 --- a/build/Makefile.config +++ /dev/null @@ -1,7 +0,0 @@ -# Configuration Makefile fragment - -# Use iconv directly in the input filter -# CFLAGS += -DWITH_ICONV_FILTER - -# Cater for local configuration changes --include build/Makefile.config.override diff --git a/src/Makefile b/src/Makefile index 8d037e6..334dd43 100644 --- a/src/Makefile +++ b/src/Makefile @@ -1,49 +1,4 @@ -# Child makefile fragment -# -# Toolchain is provided by top-level makefile -# -# Variables provided by top-level makefile -# -# COMPONENT The name of the component -# EXPORT The location of the export directory -# TOP The location of the source tree root -# RELEASEDIR The place to put release objects -# DEBUGDIR The place to put debug objects -# -# do_include Canned command sequence to include a child makefile -# -# Variables provided by parent makefile: -# -# DIR The name of the directory we're in, relative to $(TOP) -# -# Variables we can manipulate: -# -# ITEMS_CLEAN The list of items to remove for "make clean" -# ITEMS_DISTCLEAN The list of items to remove for "make distclean" -# TARGET_TESTS The list of target names to run for "make test" -# -# SOURCES The list of sources to build for $(COMPONENT) -# -# Plus anything from the toolchain - -# Push parent directory onto the directory stack -sp := $(sp).x -dirstack_$(sp) := $(d) -d := $(DIR) - -# Manipulate include paths -CFLAGS := $(CFLAGS) -I$(d) - # Sources -SRCS_$(d) := parserutils.c - -# Append to sources for component -SOURCES += $(addprefix $(d), $(SRCS_$(d))) - -# Now include any children we may have -MAKE_INCLUDES := $(wildcard $(d)*/Makefile) -$(eval $(foreach INC, $(MAKE_INCLUDES), $(call do_include,$(INC)))) +DIR_SOURCES := parserutils.c -# Finally, pop off the directory stack -d := $(dirstack_$(sp)) -sp := $(basename $(sp)) +include build/makefiles/Makefile.subdir diff --git a/src/charset/Makefile b/src/charset/Makefile index 1312d19..a4c8f64 100644 --- a/src/charset/Makefile +++ b/src/charset/Makefile @@ -1,49 +1,4 @@ -# Child makefile fragment -# -# Toolchain is provided by top-level makefile -# -# Variables provided by top-level makefile -# -# COMPONENT The name of the component -# EXPORT The location of the export directory -# TOP The location of the source tree root -# RELEASEDIR The place to put release objects -# DEBUGDIR The place to put debug objects -# -# do_include Canned command sequence to include a child makefile -# -# Variables provided by parent makefile: -# -# DIR The name of the directory we're in, relative to $(TOP) -# -# Variables we can manipulate: -# -# ITEMS_CLEAN The list of items to remove for "make clean" -# ITEMS_DISTCLEAN The list of items to remove for "make distclean" -# TARGET_TESTS The list of target names to run for "make test" -# -# SOURCES The list of sources to build for $(COMPONENT) -# -# Plus anything from the toolchain - -# Push parent directory onto the directory stack -sp := $(sp).x -dirstack_$(sp) := $(d) -d := $(DIR) - -# Manipulate include paths -CFLAGS := $(CFLAGS) -I$(d) - # Sources -SRCS_$(d) := aliases.c charset.c codec.c - -# Append to sources for component -SOURCES += $(addprefix $(d), $(SRCS_$(d))) - -# Now include any children we may have -MAKE_INCLUDES := $(wildcard $(d)*/Makefile) -$(eval $(foreach INC, $(MAKE_INCLUDES), $(call do_include,$(INC)))) +DIR_SOURCES := aliases.c charset.c codec.c -# Finally, pop off the directory stack -d := $(dirstack_$(sp)) -sp := $(basename $(sp)) +include build/makefiles/Makefile.subdir diff --git a/src/charset/codecs/Makefile b/src/charset/codecs/Makefile index 7286ccd..c9b920e 100644 --- a/src/charset/codecs/Makefile +++ b/src/charset/codecs/Makefile @@ -1,46 +1,5 @@ -# Child makefile fragment -# -# Toolchain is provided by top-level makefile -# -# Variables provided by top-level makefile -# -# COMPONENT The name of the component -# EXPORT The location of the export directory -# TOP The location of the source tree root -# RELEASEDIR The place to put release objects -# DEBUGDIR The place to put debug objects -# -# do_include Canned command sequence to include a child makefile -# -# Variables provided by parent makefile: -# -# DIR The name of the directory we're in, relative to $(TOP) -# -# Variables we can manipulate: -# -# ITEMS_CLEAN The list of items to remove for "make clean" -# ITEMS_DISTCLEAN The list of items to remove for "make distclean" -# TARGET_TESTS The list of target names to run for "make test" -# -# SOURCES The list of sources to build for $(COMPONENT) -# -# Plus anything from the toolchain - -# Push parent directory onto the directory stack -sp := $(sp).x -dirstack_$(sp) := $(d) -d := $(DIR) - # Sources -SRCS_$(d) := codec_ascii.c codec_8859.c codec_ext8.c codec_utf8.c codec_utf16.c - -# Append to sources for component -SOURCES += $(addprefix $(d), $(SRCS_$(d))) - -# Now include any children we may have -MAKE_INCLUDES := $(wildcard $(d)*/Makefile) -$(eval $(foreach INC, $(MAKE_INCLUDES), $(call do_include,$(INC)))) +DIR_SOURCES := codec_ascii.c codec_8859.c codec_ext8.c \ + codec_utf8.c codec_utf16.c -# Finally, pop off the directory stack -d := $(dirstack_$(sp)) -sp := $(basename $(sp)) +include build/makefiles/Makefile.subdir diff --git a/src/charset/encodings/Makefile b/src/charset/encodings/Makefile index 47d9210..75fbfeb 100644 --- a/src/charset/encodings/Makefile +++ b/src/charset/encodings/Makefile @@ -1,46 +1,4 @@ -# Child makefile fragment -# -# Toolchain is provided by top-level makefile -# -# Variables provided by top-level makefile -# -# COMPONENT The name of the component -# EXPORT The location of the export directory -# TOP The location of the source tree root -# RELEASEDIR The place to put release objects -# DEBUGDIR The place to put debug objects -# -# do_include Canned command sequence to include a child makefile -# -# Variables provided by parent makefile: -# -# DIR The name of the directory we're in, relative to $(TOP) -# -# Variables we can manipulate: -# -# ITEMS_CLEAN The list of items to remove for "make clean" -# ITEMS_DISTCLEAN The list of items to remove for "make distclean" -# TARGET_TESTS The list of target names to run for "make test" -# -# SOURCES The list of sources to build for $(COMPONENT) -# -# Plus anything from the toolchain - -# Push parent directory onto the directory stack -sp := $(sp).x -dirstack_$(sp) := $(d) -d := $(DIR) - # Sources -SRCS_$(d) := utf8.c utf16.c - -# Append to sources for component -SOURCES += $(addprefix $(d), $(SRCS_$(d))) - -# Now include any children we may have -MAKE_INCLUDES := $(wildcard $(d)*/Makefile) -$(eval $(foreach INC, $(MAKE_INCLUDES), $(call do_include,$(INC)))) +DIR_SOURCES := utf8.c utf16.c -# Finally, pop off the directory stack -d := $(dirstack_$(sp)) -sp := $(basename $(sp)) +include build/makefiles/Makefile.subdir diff --git a/src/input/Makefile b/src/input/Makefile index d62740e..fc7a7ff 100644 --- a/src/input/Makefile +++ b/src/input/Makefile @@ -1,46 +1,4 @@ -# Child makefile fragment -# -# Toolchain is provided by top-level makefile -# -# Variables provided by top-level makefile -# -# COMPONENT The name of the component -# EXPORT The location of the export directory -# TOP The location of the source tree root -# RELEASEDIR The place to put release objects -# DEBUGDIR The place to put debug objects -# -# do_include Canned command sequence to include a child makefile -# -# Variables provided by parent makefile: -# -# DIR The name of the directory we're in, relative to $(TOP) -# -# Variables we can manipulate: -# -# ITEMS_CLEAN The list of items to remove for "make clean" -# ITEMS_DISTCLEAN The list of items to remove for "make distclean" -# TARGET_TESTS The list of target names to run for "make test" -# -# SOURCES The list of sources to build for $(COMPONENT) -# -# Plus anything from the toolchain - -# Push parent directory onto the directory stack -sp := $(sp).x -dirstack_$(sp) := $(d) -d := $(DIR) - # Sources -SRCS_$(d) := filter.c inputstream.c - -# Append to sources for component -SOURCES += $(addprefix $(d), $(SRCS_$(d))) - -# Now include any children we may have -MAKE_INCLUDES := $(wildcard $(d)*/Makefile) -$(eval $(foreach INC, $(MAKE_INCLUDES), $(call do_include,$(INC)))) +DIR_SOURCES := filter.c inputstream.c -# Finally, pop off the directory stack -d := $(dirstack_$(sp)) -sp := $(basename $(sp)) +include build/makefiles/Makefile.subdir diff --git a/src/utils/Makefile b/src/utils/Makefile index ba978be..ad78422 100644 --- a/src/utils/Makefile +++ b/src/utils/Makefile @@ -1,49 +1,4 @@ -# Child makefile fragment -# -# Toolchain is provided by top-level makefile -# -# Variables provided by top-level makefile -# -# COMPONENT The name of the component -# EXPORT The location of the export directory -# TOP The location of the source tree root -# RELEASEDIR The place to put release objects -# DEBUGDIR The place to put debug objects -# -# do_include Canned command sequence to include a child makefile -# -# Variables provided by parent makefile: -# -# DIR The name of the directory we're in, relative to $(TOP) -# -# Variables we can manipulate: -# -# ITEMS_CLEAN The list of items to remove for "make clean" -# ITEMS_DISTCLEAN The list of items to remove for "make distclean" -# TARGET_TESTS The list of target names to run for "make test" -# -# SOURCES The list of sources to build for $(COMPONENT) -# -# Plus anything from the toolchain - -# Push parent directory onto the directory stack -sp := $(sp).x -dirstack_$(sp) := $(d) -d := $(DIR) - -# Manipulate include paths -CFLAGS := $(CFLAGS) -I$(d) - # Sources -SRCS_$(d) := chunkarray.c buffer.c errors.c stack.c vector.c - -# Append to sources for component -SOURCES += $(addprefix $(d), $(SRCS_$(d))) - -# Now include any children we may have -MAKE_INCLUDES := $(wildcard $(d)*/Makefile) -$(eval $(foreach INC, $(MAKE_INCLUDES), $(call do_include,$(INC)))) +DIR_SOURCES := chunkarray.c buffer.c errors.c stack.c vector.c -# Finally, pop off the directory stack -d := $(dirstack_$(sp)) -sp := $(basename $(sp)) +include build/makefiles/Makefile.subdir diff --git a/test/Makefile b/test/Makefile index e864cb3..48ba2e7 100644 --- a/test/Makefile +++ b/test/Makefile @@ -1,105 +1,8 @@ -# Child makefile fragment -# -# Toolchain is provided by top-level makefile -# -# Variables provided by top-level makefile -# -# COMPONENT The name of the component -# EXPORT The location of the export directory -# TOP The location of the source tree root -# RELEASEDIR The place to put release objects -# DEBUGDIR The place to put debug objects -# -# do_include Canned command sequence to include a child makefile -# -# Variables provided by parent makefile: -# -# DIR The name of the directory we're in, relative to $(TOP) -# -# Variables we can manipulate: -# -# ITEMS_CLEAN The list of items to remove for "make clean" -# ITEMS_DISTCLEAN The list of items to remove for "make distclean" -# TARGET_TESTS The list of target names to run for "make test" -# -# SOURCES The list of sources to build for $(COMPONENT) -# -# Plus anything from the toolchain - -# Push parent directory onto the directory stack -sp := $(sp).x -dirstack_$(sp) := $(d) -d := $(DIR) - -# Extend toolchain settings -CFLAGS := $(CFLAGS) -I$(TOP)/src/ -I$(d) - # Tests -TESTS_$(d) := aliases cscodec-8859 cscodec-ext8 cscodec-utf8 cscodec-utf16 \ - charset filter inputstream parserutils -TESTS_$(d) := $(TESTS_$(d)) regression/cscodec-segv regression/filter-segv \ - regression/stream-nomem regression/filter-badenc-segv - -# Items for top-level makefile to use -ITEMS_CLEAN := $(ITEMS_CLEAN) \ - $(addprefix $(d), $(addsuffix $(EXEEXT), $(TESTS_$(d)))) \ - $(addprefix $(d), $(addsuffix .gcda, $(TESTS_$(d)))) \ - $(addprefix $(d), $(addsuffix .gcno, $(TESTS_$(d)))) \ - $(addprefix $(d), $(addsuffix .d, $(TESTS_$(d)))) -ITEMS_DISTCLEAN := $(ITEMS_DISTCLEAN) $(d)log - -# Targets for top-level makefile to run -TARGET_TESTS := $(TARGET_TESTS) test_$(d) - -# Now we get to hack around so that we know what directory we're in. -# $(d) no longer exists when running the commands for a target, so we can't -# simply use it verbatim. Assigning to a variable doesn't really help, as -# there's no guarantee that someone else hasn't overridden that variable. -# So, what we do is make the target depend on $(d), then pick it out of the -# dependency list when running commands. This isn't pretty, but is effective. -test_$(d): $(d) $(addprefix $(d), $(TESTS_$(d))) - @$(PERL) $(TOP)/$ $(1)" - @$$(CC) -c -g $$(DEBUGCFLAGS) -o $$@.o $(1) - @$$(LD) -g -o $$@ $$@.o $$(LDFLAGS) -lparserutils-debug - @$$(RM) $$(RMFLAGS) $$@.o - -endef - -$(eval $(foreach TEST,$(addprefix $(d), $(TESTS_$(d))), \ - $(call dep_test,$(addsuffix .c, $(TEST)),$(addsuffix .d, $(TEST)),$(TEST)))) - -ifneq ($(findstring clean,$(MAKECMDGOALS)),clean) --include $(sort $(DEP_$(d))) -endif - -$(eval $(foreach TEST,$(addprefix $(d), $(TESTS_$(d))), \ - $(call compile_test,$(addsuffix .c, $(TEST)),$(TEST)))) - -# Now include any children we may have -MAKE_INCLUDES := $(wildcard $(d)*/Makefile) -$(eval $(foreach INC, $(MAKE_INCLUDES), $(call do_include,$(INC)))) +DIR_TEST_SOURCES := aliases cscodec-8859 cscodec-ext8 cscodec-utf8 \ + cscodec-utf16 charset filter inputstream parserutils +DIR_TEST_SOURCES := $(DIR_TEST_SOURCES) regression/cscodec-segv \ + regression/filter-segv regression/stream-nomem \ + regression/filter-badenc-segv -# Finally, pop off the directory stack -d := $(dirstack_$(sp)) -sp := $(basename $(sp)) +include build/makefiles/Makefile.subdir -- cgit v1.2.3