summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlfred E. Heggestad <aeh@db.org>2015-08-01 18:21:04 +0200
committerAlfred E. Heggestad <aeh@db.org>2015-08-01 18:21:04 +0200
commit306bc87410c5411892a14491c096cb335bd4c89b (patch)
tree6697f0d56446049be44f0ce6514af3f7d190c996
parent056f6e68811a3e3c0d9af86bc86e0257148aa25d (diff)
parentc52ccb703de3265f36daa8a6336298e8bc63f7c9 (diff)
Merge pull request #58 from alfredh/modules_mk
Modules mk
-rw-r--r--mk/mod.mk24
-rw-r--r--modules/speex/module.mk2
2 files changed, 18 insertions, 8 deletions
diff --git a/mk/mod.mk b/mk/mod.mk
index 64ec23c..2736946 100644
--- a/mk/mod.mk
+++ b/mk/mod.mk
@@ -19,6 +19,12 @@ $(MOD)_OBJS += $(patsubst %.S,$(BUILD)/modules/$(MOD)/%.o,\
$(MOD)_NAME := $(MOD)
+#
+# function to extract the name of the module from the file/dir path
+#
+modulename = $(lastword $(subst /, ,$(dir $1)))
+
+
ifeq ($(STATIC),)
#
@@ -34,19 +40,21 @@ $(BUILD)/modules/$(MOD)/%.o: modules/$(MOD)/%.c $(BUILD) Makefile mk/mod.mk \
modules/$(MOD)/module.mk mk/modules.mk
@echo " CC [M] $@"
@mkdir -p $(dir $@)
- @$(CC) $(CFLAGS) -c $< -o $@ $(DFLAGS)
+ @$(CC) $(CFLAGS) $($(call modulename,$@)_CFLAGS) -c $< -o $@ $(DFLAGS)
$(BUILD)/modules/$(MOD)/%.o: modules/$(MOD)/%.m $(BUILD) Makefile mk/mod.mk \
modules/$(MOD)/module.mk mk/modules.mk
@echo " OC [M] $@"
@mkdir -p $(dir $@)
- @$(CC) $(CFLAGS) $(OBJCFLAGS) -c $< -o $@ $(DFLAGS)
+ @$(CC) $(CFLAGS) $($(call modulename,$@)_CFLAGS) $(OBJCFLAGS) \
+ -c $< -o $@ $(DFLAGS)
$(BUILD)/modules/$(MOD)/%.o: modules/$(MOD)/%.cpp $(BUILD) Makefile mk/mod.mk \
modules/$(MOD)/module.mk mk/modules.mk
@echo " CXX [M] $@"
@mkdir -p $(dir $@)
- @$(CXX) $(CXXFLAGS) -c $< -o $@ $(DFLAGS)
+ @$(CXX) $(CXXFLAGS) $($(call modulename,$@)_CXXFLAGS) \
+ -c $< -o $@ $(DFLAGS)
$(BUILD)/modules/$(MOD)/%.o: modules/$(MOD)/%.S $(BUILD) Makefile mk/mod.mk \
modules/$(MOD)/module.mk mk/modules.mk
@@ -68,21 +76,23 @@ $(BUILD)/modules/$(MOD)/%.o: modules/$(MOD)/%.c $(BUILD) Makefile mk/mod.mk \
modules/$(MOD)/module.mk mk/modules.mk
@echo " CC [m] $@"
@mkdir -p $(dir $@)
- @$(CC) $(CFLAGS) -DMOD_NAME=\"$(MOD)\" -c $< -o $@ $(DFLAGS)
+ @$(CC) $(CFLAGS) $($(call modulename,$@)_CFLAGS) \
+ -DMOD_NAME=\"$(MOD)\" -c $< -o $@ $(DFLAGS)
$(BUILD)/modules/$(MOD)/%.o: modules/$(MOD)/%.m $(BUILD) Makefile mk/mod.mk \
modules/$(MOD)/module.mk mk/modules.mk
@echo " OC [m] $@"
@mkdir -p $(dir $@)
- @$(CC) $(CFLAGS) $(OBJCFLAGS) -DMOD_NAME=\"$(MOD)\" -c $< -o $@ \
- $(DFLAGS)
+ @$(CC) $(CFLAGS) $($(call modulename,$@)_CFLAGS) $(OBJCFLAGS) \
+ -DMOD_NAME=\"$(MOD)\" -c $< -o $@ $(DFLAGS)
$(BUILD)/modules/$(MOD)/%.o: modules/$(MOD)/%.cpp $(BUILD) Makefile mk/mod.mk \
modules/$(MOD)/module.mk mk/modules.mk
@echo " CXX [m] $@"
@mkdir -p $(dir $@)
- @$(CXX) $(CXXFLAGS) -DMOD_NAME=\"$(MOD)\" -c $< -o $@ $(DFLAGS)
+ @$(CXX) $(CXXFLAGS) $($(call modulename,$@)_CXXFLAGS) \
+ -DMOD_NAME=\"$(MOD)\" -c $< -o $@ $(DFLAGS)
$(BUILD)/modules/$(MOD)/%.o: modules/$(MOD)/%.S $(BUILD) Makefile mk/mod.mk \
modules/$(MOD)/module.mk mk/modules.mk
diff --git a/modules/speex/module.mk b/modules/speex/module.mk
index c8d0015..81c8b18 100644
--- a/modules/speex/module.mk
+++ b/modules/speex/module.mk
@@ -7,6 +7,6 @@
MOD := speex
$(MOD)_SRCS += speex.c
$(MOD)_LFLAGS += -lspeex
-CFLAGS += -Wno-strict-prototypes
+$(MOD)_CFLAGS += -Wno-strict-prototypes
include mk/mod.mk