aboutsummaryrefslogtreecommitdiff
path: root/mk/lib.mk
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2013-11-25 09:50:35 +0000
committerEelco Dolstra <eelco.dolstra@logicblox.com>2013-11-25 09:50:35 +0000
commitf980755766e7cd74c0c959eaa2a6d4655980e2ea (patch)
tree56452922b75f19a707cdecc4cee936f8fe7e372c /mk/lib.mk
parente9b6397d2f902eb4f5bf0fd513013d92af074cfc (diff)
Split Makefile.lib into several *.mk files
Diffstat (limited to 'mk/lib.mk')
-rw-r--r--mk/lib.mk52
1 files changed, 52 insertions, 0 deletions
diff --git a/mk/lib.mk b/mk/lib.mk
new file mode 100644
index 000000000..212336cad
--- /dev/null
+++ b/mk/lib.mk
@@ -0,0 +1,52 @@
+default: all
+
+
+# Include Autoconf variables.
+Makefile.config: Makefile.config.in
+ ./config.status --file $@
+
+include Makefile.config
+
+
+# Initialise some variables.
+QUIET = @
+
+
+# Pass -fPIC if we're building dynamic libraries.
+ifeq ($(BUILD_SHARED_LIBS), 1)
+ GLOBAL_CFLAGS += -fPIC
+ GLOBAL_CXXFLAGS += -fPIC
+ GLOBAL_LDFLAGS += -Wl,--no-copy-dt-needed-entries
+endif
+
+
+# Pass -g if we want debug info.
+ifeq ($(BUILD_DEBUG), 1)
+ GLOBAL_CFLAGS += -g
+ GLOBAL_CXXFLAGS += -g
+endif
+
+
+include mk/clean.mk
+include mk/dist.mk
+include mk/install.mk
+include mk/libraries.mk
+include mk/programs.mk
+include mk/patterns.mk
+
+
+# Include all sub-Makefiles.
+define include-sub-makefile =
+ d := $$(patsubst %/, %, $$(dir $(1)))
+ include $(1)
+endef
+
+$(foreach mf, $(SUBS), $(eval $(call include-sub-makefile, $(mf))))
+
+
+# Instantiate libraries and programs.
+$(foreach lib, $(LIBS), $(eval $(call build-library,$(lib))))
+$(foreach prog, $(PROGRAMS), $(eval $(call build-program,$(prog))))
+
+
+all: $(programs_list)