diff options
author | Corey Farrell <git@cfware.com> | 2015-04-13 06:28:32 -0400 |
---|---|---|
committer | Corey Farrell <git@cfware.com> | 2015-04-14 12:53:03 -0400 |
commit | 62508d6891f22d01fd9494676951008764ef9ead (patch) | |
tree | 5e07039b0fa81f46865696375141551f6cb436be /Makefile.moddir_rules | |
parent | 9f5ba58332119dd283eed3d202b0a64aa0394f12 (diff) |
Build System: Create Makefile macro MOD_ADD_SOURCE.
This new macro allows a single line to add all additional
sources to a module. This helps prevent modules from
missing steps, and makes future changes easier since
they can be made in a single place.
ASTERISK-24960 #close
Reported by: Corey Farrell
Change-Id: I38f12d8b72c5e7bb37a879b2fb51761a2855eb4b
Diffstat (limited to 'Makefile.moddir_rules')
-rw-r--r-- | Makefile.moddir_rules | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/Makefile.moddir_rules b/Makefile.moddir_rules index 939e79f80..673580db1 100644 --- a/Makefile.moddir_rules +++ b/Makefile.moddir_rules @@ -62,6 +62,21 @@ endif MOD_ASTCFLAGS=-DAST_MODULE=\"$(1)\" $(MENUSELECT_OPTS_$(1):%=-D%) $(foreach dep,$(MENUSELECT_DEPENDS_$(1)),$(value $(dep)_INCLUDE)) +define MOD_ADD_SOURCE +$$(if $$(filter $(1),$$(EMBEDDED_MODS)),modules.link,$(1).so): $$(subst $(3),$(5),$(2)) +$$(subst $(3),$(5),$(2)): _ASTCFLAGS+=$$(call MOD_ASTCFLAGS,$(1)) +.$(1).moduleinfo: MODULEINFO_EXTRA_OUTPUT=" $$(addprefix $$(SUBDIR)/,$$(subst $(3),$(5),$(2)) $$(subst $(3),$(4),$(2)))" + +clean:: clean-$(1)$(3) + +clean-$(1)$(3): + rm -f $$(subst $(3),$(5),$(2)) $$(subst $(3),$(4),$(2)) + +endef + +MOD_ADD_C=$(eval $(call MOD_ADD_SOURCE,$(1),$(2),.c,.i,.o)) +MOD_ADD_CC=$(eval $(call MOD_ADD_SOURCE,$(1),$(2),.cc,.ii,.oo)) + $(addsuffix .oo,$(CC_MODS)) $(addsuffix .o,$(C_MODS)): \ _ASTCFLAGS+=$(call MOD_ASTCFLAGS,$*) @@ -132,12 +147,12 @@ dist-clean:: rm -f *.exports .%.moduleinfo: %.c - @echo "<member name=\"$*\" displayname=\"$(shell $(GREP) -e AST_MODULE_INFO $< | head -n 1 | cut -d '"' -f 2)\" remove_on_change=\"$(SUBDIR)/$*.o $(SUBDIR)/$*.so\">" > $@ + @echo "<member name=\"$*\" displayname=\"$(shell $(GREP) -e AST_MODULE_INFO $< | head -n 1 | cut -d '"' -f 2)\" remove_on_change=\"$(SUBDIR)/$*.o $(SUBDIR)/$*.i $(SUBDIR)/$*.so$(MODULEINFO_EXTRA_OUTPUT)\">" > $@ $(AWK) -f $(ASTTOPDIR)/build_tools/get_moduleinfo $< >> $@ echo "</member>" >> $@ .%.moduleinfo: %.cc - @echo "<member name=\"$*\" displayname=\"$(shell $(GREP) -e AST_MODULE_INFO $< | head -n 1 | cut -d '"' -f 2)\" remove_on_change=\"$(SUBDIR)/$*.oo $(SUBDIR)/$*.so\">" > $@ + @echo "<member name=\"$*\" displayname=\"$(shell $(GREP) -e AST_MODULE_INFO $< | head -n 1 | cut -d '"' -f 2)\" remove_on_change=\"$(SUBDIR)/$*.oo $(SUBDIR)/$*.ii $(SUBDIR)/$*.so$(MODULEINFO_EXTRA_OUTPUT)\">" > $@ $(AWK) -f $(ASTTOPDIR)/build_tools/get_moduleinfo $< >> $@ echo "</member>" >> $@ |