summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile68
-rw-r--r--Makefile.config (renamed from build/Makefile.config)0
-rw-r--r--examples/makefile (renamed from examples/Mkfile)0
-rw-r--r--src/Makefile50
-rw-r--r--src/charset/Makefile47
-rw-r--r--src/tokeniser/Makefile46
-rw-r--r--src/treebuilder/Makefile46
-rw-r--r--src/utils/Makefile46
-rw-r--r--test/Makefile118
9 files changed, 38 insertions, 383 deletions
diff --git a/Makefile b/Makefile
index 72eaeec..53f1381 100644
--- a/Makefile
+++ b/Makefile
@@ -1,55 +1,35 @@
-# Toolchain definitions for building on the destination platform
-CC := gcc
-AR := ar
-LD := gcc
+# Component settings
+COMPONENT := hubbub
+COMPONENT_TYPE := lib-static
-CP := cp
-RM := rm
-MKDIR := mkdir
-MV := mv
-ECHO := echo
-MAKE := make
-PERL := perl
-PKGCONFIG := pkg-config
-INSTALL := install
-SED := sed
-LCOV := lcov
-GENHTML := genhtml
-TOUCH := touch
-DOXYGEN := doxygen
+# Build settings
+TARGET := nix
+LIBEXT := .a
# 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) $(CSHAREDFLAGS)
-RELEASECFLAGS = $(CFLAGS) -DNDEBUG -O2
-DEBUGCFLAGS = $(CFLAGS) -O0 -g
-ARFLAGS := -cru
-LDFLAGS = -L$(TOP)/ $(LDSHAREDFLAGS)
-
-CPFLAGS :=
-RMFLAGS := -f
-MKDIRFLAGS := -p
-MVFLAGS :=
-ECHOFLAGS :=
-MAKEFLAGS :=
-PKGCONFIGFLAGS :=
-TOUCHFLAGS :=
-
-EXEEXT :=
-
-# Default installation prefix
-PREFIX ?= /usr/local
-
-TARGET := nix
+CFLAGS := $(CFLAGS) -std=c99 -D_BSD_SOURCE -I$(CURDIR)/include/ $(WARNFLAGS)
-ifeq ($(BUILD_SHARED),yes)
+include build/makefiles/Makefile.top
-TARGET := nix-shared
-CSHAREDFLAGS := -fPIC -DPIC
-LDSHAREDFLAGS := -Wl,-shared
+# Further toolchain settings which rely on Makefile.top
+CFLAGS := $(CFLAGS) $(shell $(PKGCONFIG) libparserutils --cflags)
+LDFLAGS := $(LDFLAGS) $(shell $(PKGCONFIG) libparserutils --libs)
+ifeq ($(BUILD),release)
+ CFLAGS := $(CFLAGS) -DNDEBUG -O2
+else
+ CFLAGS := $(CFLAGS) -g -O0
endif
-include build/Makefile.common
+# Extra installation rules
+INSTALL_ITEMS := $(INSTALL_ITEMS) /include/hubbub:include/hubbub/errors.h
+INSTALL_ITEMS := $(INSTALL_ITEMS) /include/hubbub:include/hubbub/functypes.h
+INSTALL_ITEMS := $(INSTALL_ITEMS) /include/hubbub:include/hubbub/hubbub.h
+INSTALL_ITEMS := $(INSTALL_ITEMS) /include/hubbub:include/hubbub/parser.h
+INSTALL_ITEMS := $(INSTALL_ITEMS) /include/hubbub:include/hubbub/tree.h
+INSTALL_ITEMS := $(INSTALL_ITEMS) /include/hubbub:include/hubbub/types.h
+INSTALL_ITEMS := $(INSTALL_ITEMS) /lib/pkgconfig:lib$(COMPONENT).pc.in
+INSTALL_ITEMS := $(INSTALL_ITEMS) /lib:$(BUILDDIR)/lib$(COMPONENT)$(LIBEXT)
diff --git a/build/Makefile.config b/Makefile.config
index 1d27350..1d27350 100644
--- a/build/Makefile.config
+++ b/Makefile.config
diff --git a/examples/Mkfile b/examples/makefile
index 8c5d828..8c5d828 100644
--- a/examples/Mkfile
+++ b/examples/makefile
diff --git a/src/Makefile b/src/Makefile
index 14c6d8b..a939c8b 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -1,50 +1,4 @@
-# Child makefile fragment for libhubbub
-#
-# 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) $(shell $(PKGCONFIG) libparserutils --cflags)
-LDFLAGS := $(LDFLAGS) $(shell $(PKGCONFIG) libparserutils --libs)
-
# Sources
-SRCS_$(d) := hubbub.c parser.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 := hubbub.c parser.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 3bdb77f..c97d758 100644
--- a/src/charset/Makefile
+++ b/src/charset/Makefile
@@ -1,46 +1,3 @@
-# Child makefile fragment for libhubbub
-#
-# 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
+DIR_SOURCES := detect.c
-# Push parent directory onto the directory stack
-sp := $(sp).x
-dirstack_$(sp) := $(d)
-d := $(DIR)
-
-# Sources
-SRCS_$(d) := detect.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))))
-
-# Finally, pop off the directory stack
-d := $(dirstack_$(sp))
-sp := $(basename $(sp))
+include build/makefiles/Makefile.subdir
diff --git a/src/tokeniser/Makefile b/src/tokeniser/Makefile
index be0699c..1dcb100 100644
--- a/src/tokeniser/Makefile
+++ b/src/tokeniser/Makefile
@@ -1,46 +1,4 @@
-# Child makefile fragment for libhubbub
-#
-# 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) := entities.c tokeniser.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 := entities.c tokeniser.c
-# Finally, pop off the directory stack
-d := $(dirstack_$(sp))
-sp := $(basename $(sp))
+include build/makefiles/Makefile.subdir
diff --git a/src/treebuilder/Makefile b/src/treebuilder/Makefile
index 28be92a..0bc8c25 100644
--- a/src/treebuilder/Makefile
+++ b/src/treebuilder/Makefile
@@ -1,38 +1,5 @@
-# Child makefile fragment for libhubbub
-#
-# 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) := treebuilder.c \
+DIR_SOURCES := treebuilder.c \
initial.c before_html.c before_head.c in_head.c \
in_head_noscript.c after_head.c in_body.c in_table.c \
in_caption.c in_column_group.c in_table_body.c in_row.c \
@@ -41,13 +8,4 @@ SRCS_$(d) := treebuilder.c \
after_frameset.c after_after_body.c after_after_frameset.c \
generic_rcdata.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))))
-
-# 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 0678442..3918256 100644
--- a/src/utils/Makefile
+++ b/src/utils/Makefile
@@ -1,46 +1,4 @@
-# Child makefile fragment for libhubbub
-#
-# 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) := dict.c errors.c string.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 := dict.c errors.c string.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 cb01a62..a592c56 100644
--- a/test/Makefile
+++ b/test/Makefile
@@ -1,123 +1,13 @@
-# Child makefile fragment for libhubbub
-#
-# 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
-# TESTTYPE The type of test to build (release/debug)
-#
-# 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)
-
ifeq ($(MAKECMDGOALS),test)
# Extend toolchain settings
# We require the presence of libjson -- http://oss.metaparadigm.com/json-c/
-CFLAGS := $(CFLAGS) -I$(TOP)/src/ -I$(d) \
- $(shell $(PKGCONFIG) $(PKGCONFIGFLAGS) --cflags json) \
+CFLAGS := $(CFLAGS) $(shell $(PKGCONFIG) $(PKGCONFIGFLAGS) --cflags json) \
-Wno-unused-parameter
LDFLAGS := $(LDFLAGS) $(shell $(PKGCONFIG) $(PKGCONFIGFLAGS) --libs json)
endif
-ifeq ($(TESTTYPE),release)
-TESTCFLAGS := $(RELEASECFLAGS)
-TESTLIB := libhubbub.a
-else
-TESTCFLAGS := $(DEBUGCFLAGS)
-TESTLIB := libhubbub-debug.a
-endif
-
-ifdef PROFILE
- CFLAGS := $(CFLAGS) -pg -fno-omit-frame-pointer
- LDFLAGS := $(LDFLAGS) -pg
-endif
-
# Tests
-TESTS_$(d) := csdetect dict entities hubbub parser \
- tokeniser tokeniser2 tokeniser3 tree tree2 tree-buf
-
-# 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)/$<testrunner.pl $(TOP)/$< $(EXEEXT)
-
-DEP_$(d) :=
-
-define dep_test
-DEP_$(d) += $(2)
-$(2): $(1)
- @$$(RM) $$(RMFLAGS) $(2)
- @$$(CC) $$(TESTCFLAGS) -MM -MT '$(2) $(3)' -MF $(2) $(1)
-
-endef
-
-# Build rules for each test binary -- they all depend on the debug library
-# Except when building on RISC OS, of course because then make utterly fails to
-# detect that the debug library exists.
-define compile_test
-ifeq ($(HOST),riscos)
-$(2): $(3)
-else
-$(2): $(3) $(TOP)/$(TESTLIB)
-endif
- @$$(ECHO) $$(ECHOFLAGS) "==> $(1)"
- @$$(CC) -c -g $$(TESTCFLAGS) -o $$@.o $(1)
- @$$(LD) -g -o $$@ $$@.o $$(TOP)/$$(TESTLIB) $$(LDFLAGS) -lgcov
- @$$(RM) $$(RMFLAGS) $$@.o
-
-endef
-
-$(eval $(foreach TEST,$(addprefix $(d), $(TESTS_$(d))), \
- $(call dep_test,$(addsuffix .c, $(TEST)),$(addsuffix .d, $(TEST)),$(TEST))))
-
-ifeq ($(MAKECMDGOALS),test)
--include $(sort $(DEP_$(d)))
-endif
-
-$(eval $(foreach TEST,$(addprefix $(d), $(TESTS_$(d))), \
- $(call compile_test,$(addsuffix .c, $(TEST)),$(TEST),$(addsuffix .d, $(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 := csdetect.c dict.c entities.c hubbub.c parser.c \
+ tokeniser.c tokeniser2.c tokeniser3.c tree.c tree2.c tree-buf.c
-# Finally, pop off the directory stack
-d := $(dirstack_$(sp))
-sp := $(basename $(sp))
+include build/makefiles/Makefile.subdir