diff options
author | John Mark Bell <jmb@netsurf-browser.org> | 2009-03-26 12:11:12 +0000 |
---|---|---|
committer | John Mark Bell <jmb@netsurf-browser.org> | 2009-03-26 12:11:12 +0000 |
commit | efa2584f3052c520e12f91cb74090735ae75e9be (patch) | |
tree | 08b8374ace3f1a191b63c48c318fcc0a40e442cd /module | |
parent | ce231ac3f456d2e92730d344cda1578eaf1d8add (diff) | |
download | iconv-efa2584f3052c520e12f91cb74090735ae75e9be.tar.gz iconv-efa2584f3052c520e12f91cb74090735ae75e9be.tar.bz2 |
First attempt at using the core buildsystem
svn path=/trunk/iconv/; revision=6897
Diffstat (limited to 'module')
-rw-r--r-- | module/Makefile | 104 |
1 files changed, 4 insertions, 100 deletions
diff --git a/module/Makefile b/module/Makefile index 0b1ef05..04c515e 100644 --- a/module/Makefile +++ b/module/Makefile @@ -1,103 +1,7 @@ -# 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) - -# Module filename -MODULE := Iconv$(EXEEXT) -HEADER := $(addprefix $(d), header.o) - -# Sources for module -SRCS_$(d) := module.c menu.c wrapper.c - -# Objects for module -OBJS_$(d) := $(HEADER) $(addprefix $(d), $(subst .c,.o,$(SRCS_$(d)))) - -# Items for top-level makefile to use -ITEMS_CLEAN := $(ITEMS_CLEAN) \ - $(OBJS_$(d)) \ - $(addprefix $(d), $(subst .c,.d,$(SRCS_$(d)))) - -ITEMS_DISTCLEAN := $(ITEMS_DISTCLEAN) $(MODULE) - -# Target for building module -# Please excuse the sick use of wordlist to get hold of the objects to link -# We can't use $(OBJS_$(d)), as $(d) will be different when the rule is run -module: release $(OBJS_$(d)) - @$(LD) -o $(MODULE) $(wordlist 2,$(words $^),$^) $(LDFLAGS) -liconv -lunicode - -# Target for building module header (mildly hacky) -$(HEADER): $(addprefix $(d), header.cmhg) ifeq ($(TARGET),riscos) - @$(CMHG) $(CMHGFLAGS) $< -o $@ -d $(subst .o,.h,$@) -else - @$(TOUCH) $@ + ifeq ($(COMPONENT_TYPE),binary) + DIR_SOURCES := header.cmhg module.c menu.c wrapper.c + endif endif -DEP_$(d) := - -define dep_module -DEP_$(d) += $(2) -$(2): $(1) - @$$(ECHO) $$(ECHOFLAGS) "DEP $(1)" - @$$(RM) $$(RMFLAGS) $(2) - @$$(CC) $$(DEBUGCFLAGS) -MM -MT '$(2) $(3)' -MF $(2) $(1) - -endef - -# Build rules for each module object -define compile_module -$(2): aliases $(1) - @$$(ECHO) $$(ECHOFLAGS) "==> $(1)" - @$$(CC) -c $$(RELEASECFLAGS) -o $$@ $(1) - -endef - -$(eval $(foreach SOURCE,$(addprefix $(d), $(SRCS_$(d))), \ - $(call dep_module,$(SOURCE),$(SOURCE:.c=.d),$(SOURCE:.c=.o)))) - -ifneq ($(findstring clean,$(MAKECMDGOALS)),clean) --include $(sort $(DEP_$(d))) -endif - -$(eval $(foreach SOURCE,$(addprefix $(d), $(SRCS_$(d))), \ - $(call compile_module,$(SOURCE),$(SOURCE:.c=.o)))) - -# 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 |