From 7ac498c2a2ad00e0a9c850f22a1012a9a3240fb7 Mon Sep 17 00:00:00 2001 From: Marti Bolivar Date: Thu, 14 Jun 2012 23:43:48 -0400 Subject: Tweak build system to allow out-of-tree projects. It's very annoying to have to build libmaple projects in-tree. Users are just copying the repository everywhere. That's stupid. So I made this: https://github.com/mbolivar/example-libmaple-project It needs these patches to work. Add a header and footer for rules.mk files, so we can change them around and things will continue to work for the users, who just include them. In Makefile, add USER_MODULES to LIBMAPLE_MODULES if it's nonempty. This is the hook you use to get your code compiled and linked correctly. Hack build-targets.mk for stupid reasons I hope to fix later. For now, you'll need an empty main.cpp in BOTH the libmaple directory and your directory if you want things to work the way you'd expect. Signed-off-by: Marti Bolivar --- support/make/footer.mk | 18 ++++++++++++++++++ support/make/header.mk | 4 ++++ 2 files changed, 22 insertions(+) create mode 100644 support/make/footer.mk create mode 100644 support/make/header.mk (limited to 'support/make') diff --git a/support/make/footer.mk b/support/make/footer.mk new file mode 100644 index 0000000..2242416 --- /dev/null +++ b/support/make/footer.mk @@ -0,0 +1,18 @@ +sFILES_$(d) := $(sSRCS_$(d):%=$(d)/%) +cFILES_$(d) := $(cSRCS_$(d):%=$(d)/%) +cppFILES_$(d) := $(cppSRCS_$(d):%=$(d)/%) + +OBJS_$(d) := $(sFILES_$(d):%.S=$(BUILD_PATH)/%.o) \ + $(cFILES_$(d):%.c=$(BUILD_PATH)/%.o) \ + $(cppFILES_$(d):%.cpp=$(BUILD_PATH)/%.o) +DEPS_$(d) := $(OBJS_$(d):%.o=%.d) + +$(OBJS_$(d)): TGT_CFLAGS := $(CFLAGS_$(d)) +$(OBJS_$(d)): TGT_CXXFLAGS := $(CXXFLAGS_$(d)) +$(OBJS_$(d)): TGT_ASFLAGS := $(ASFLAGS_$(d)) + +TGT_BIN += $(OBJS_$(d)) + +-include $(DEPS_$(d)) +d := $(dirstack_$(sp)) +sp := $(basename $(sp)) diff --git a/support/make/header.mk b/support/make/header.mk new file mode 100644 index 0000000..c85594a --- /dev/null +++ b/support/make/header.mk @@ -0,0 +1,4 @@ +sp := $(sp).x +dirstack_$(sp) := $(d) +d := $(dir) +BUILDDIRS += $(BUILD_PATH)/$(d) -- cgit v1.2.3