<p>George Joseph has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.asterisk.org/9030">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">Another attempt at making the product build process cleaner and faster<br><br>Change-Id: Ic7cf8156db30442310b338d6cdb4782928409531<br>---<br>M build_tools/Makefile.product_rules<br>1 file changed, 43 insertions(+), 30 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.asterisk.org:29418/repotools refs/changes/30/9030/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">diff --git a/build_tools/Makefile.product_rules b/build_tools/Makefile.product_rules<br>index f1d96ac..1a842ab 100644<br>--- a/build_tools/Makefile.product_rules<br>+++ b/build_tools/Makefile.product_rules<br>@@ -113,6 +113,8 @@<br> $(info $(help))<br> endif<br> <br>+.PRECIOUS: $(LIBS)<br>+<br> .PHONY: all<br> all:<br> @echo<br>@@ -128,7 +130,7 @@<br> echo " [MAKE PREREQ] $@ $(ARCH) with $(DEBUG_CFLAGS)";\<br> $(MAKE) INDENT="+ " --quiet --no-print-directory -C libcp clean;\<br> $(MAKE) INDENT="+ " --quiet --no-print-directory -j -C libcp ARCH=$(ARCH) OPT="$(CFLAGS)" DEBUG="$(DEBUG_CFLAGS)" libcp.a && \<br>- echo "$$currconfig" > last_libcp_build~;\<br>+ echo "$$currconfig" > last_$@~;\<br> else \<br> echo " [MAKE PREREQ] $@ $(ARCH) with $(DEBUG_CFLAGS) not needed";\<br> fi;<br>@@ -142,20 +144,28 @@<br> currconfig="$(ARCH) $(ASTERISK_CONFIGURE_FLAGS)";\<br> if [ "x$$lastconfig" != "x$$currconfig" ] ; then \<br> cd asterisk;\<br>- echo " [MAKE PREREQ] $@ $(ARCH) $(ASTERISK_CONFIGURE_FLAGS). This may take a minute or 2...";\<br>+ echo " [MAKE PREREQ] $@ $(ASTERISK_CONFIGURE_FLAGS) This may take a minute or 2...";\<br> $(MAKE) --quiet --no-print-directory distclean &>/dev/null;\<br>- ./configure $(ASTERISK_CONFIGURE_FLAGS) &>/dev/null || exit 1;\<br>+ ./configure $(ASTERISK_CONFIGURE_FLAGS) CFLAGS= &>/dev/null || exit 1;\<br>+ if [ "x$(AST_DEVMODE)" = "xyes" ] ; then \<br>+ $(MAKE) --quiet --no-print-directory -C menuselect ;\<br>+ $(MAKE) --quiet --no-print-directory menuselect-tree ;\<br>+ menuselect/menuselect --enable=DONT_OPTIMIZE menuselect.makeopts ;\<br>+ menuselect/menuselect --enable=BETTER_BACKTRACES menuselect.makeopts ;\<br>+ menuselect/menuselect --enable=MALLOC_DEBUG menuselect.makeopts ;\<br>+ menuselect/menuselect --enable=OPTIONAL_API menuselect.makeopts ;\<br>+ menuselect/menuselect --enable=TEST_FRAMEWORK menuselect.makeopts ;\<br>+ fi ;\<br> $(MAKE) --quiet --no-print-directory include/asterisk/buildopts.h &>/dev/null;\<br> sed -i -e /GCC_ATOMICS/d include/asterisk/autoconfig.h;\<br> cd ..;\<br>- echo "$$currconfig" > last_asterisk_build~;\<br>+ echo "$$currconfig" > last_$@~;\<br> else \<br>- echo " [MAKE PREREQ] $@ $(ARCH) $(ASTERISK_CONFIGURE_FLAGS). not needed";\<br>+ echo " [MAKE PREREQ] $@ $(ASTERISK_CONFIGURE_FLAGS) not needed";\<br> fi;<br> <br>-<br> PJPROJECT_BUNDLED_NEEDED=$(if $(PJPROJECT_BUNDLED),$(PJPROJECT_BUNDLED:no=),)<br>-ASTERISK_CONFIGURE_FLAGS=$(if $(PJPROJECT_BUNDLED_NEEDED),--with-pjproject-bundled) --host=$(BUILD_ARCH)-linux-gnu<br>+ASTERISK_CONFIGURE_FLAGS=$(if $(PJPROJECT_BUNDLED_NEEDED),--with-pjproject-bundled) --host=$(BUILD_ARCH)-linux-gnu --libdir=$(LIBDIR) $(if $(call yesonly,$(AST_DEVMODE)),--enable-dev-mode,)<br> PJPROJECT_INCLUDES=$(if $(PJPROJECT_BUNDLED_NEEDED),$(filter-out -O2,$(shell sed -n -r -e "s/PJPROJECT_INCLUDE=(.*)/\1/gp" asterisk/makeopts 2>/dev/null)))<br> <br> PRECHECKS=asterisk-configure libcp-build<br>@@ -165,35 +175,38 @@<br> @cmp -s $@.tmp $@ || mv $@.tmp $@<br> @rm -f $@.tmp<br> <br>-include repotools/build_tools/Makefile.dependencies<br>+#####include repotools/build_tools/Makefile.dependencies<br> <br> CFLAGS+=$(MODULE_SDK_CFLAGS)<br>-MODULE_OBJS=$(MODULE_NAME).o $(MODULE_EXTRA_OBJS)<br>-$(MODULE_OBJS): CFLAGS+=-I$(ASTINCDIR) -I/usr/include -I -Iinclude -DAST_MODULE=\"$(MODULE_NAME)\" -DAST_MODULE_SELF_SYM=__internal_$(MODULE_NAME)_self<br> <br>-$(sort $(MODULE_OBJS) $(MODULE_EXTRA_LIBRARY_OBJS)): %.o : %.c optarch.h version.h<br>- $(ECHO_PREFIX) echo " [CC] $@"<br>+%.o: CFLAGS+=-DAST_MODULE=\"$(LIBRARY_BASE_NAME)\" -DAST_MODULE_SELF_SYM=__internal_$(LIBRARY_BASE_NAME)_self -I$(ASTINCDIR)<br>+%.o: %.c optarch.h version.h<br>+ $(ECHO_PREFIX) echo " [CC] $(LIBRARY_BASE_NAME):$@"<br> $(CMD_PREFIX) $(CC) -c $< -o $@ $(PJPROJECT_INCLUDES) $(CFLAGS) $(DEBUG_CFLAGS) $(WARN) $(MAKE_DEPS) $(COPYPROTECT_CFLAGS)<br> <br>-<br>-$(MODULE_EXTRA_LIBRARIES): LIBRARY_NAME=$(@)<br>-$(MODULE_EXTRA_LIBRARIES): SOLINK=-shared -Wl,--version-script,$(subst .so,.exports,$(LIBRARY_NAME))<br>-$(MODULE_EXTRA_LIBRARIES): $(MODULE_EXTRA_LIBRARY_OBJS) $(MODULE_SDK_OBJS) $(MODULE_SDK_LIB)<br>+.%.exports: LIBRARY_BASE_NAME=$(basename $*)<br>+.%.exports:<br>+ @if [ ! -f $(LIBRARY_BASE_NAME).exports ] ; then \<br>+ echo " [EXPORTS] $(LIBRARY_BASE_NAME)" ;\<br>+ echo -e "{\n\tglobal:\n\t\t_IO_stdin_used;\n\tlocal:\n\t\t*;\n};" > $@ ;\<br>+ else \<br>+ echo " [EXPORTS CP] $(LIBRARY_BASE_NAME)" ;\<br>+ cp $(LIBRARY_BASE_NAME).exports $@ ;\<br>+ fi ;<br>+ <br>+$(MODULE_LIBS): LIBRARY_NAME=$(@)<br>+$(MODULE_LIBS): LIBRARY_BASE_NAME=$(basename $(LIBRARY_NAME))<br>+$(MODULE_LIBS): LINKER_SCRIPT=-Wl,--version-script,.$(basename $(LIBRARY_NAME)).exports<br>+$(MODULE_LIBS): SOLINK=-shared $(LINKER_SCRIPT)<br>+$(MODULE_LIBS): %.so: $(MODULE_SDK_OBJS) $(MODULE_SDK_LIB) | .%.exports<br>+ $(CMD_PREFIX) $(MAKE) --no-print-directory $(OBJS) LIBRARY_BASE_NAME=$(LIBRARY_BASE_NAME) NOISY_BUILD=$(NOISY_BUILD) PJPROJECT_INCLUDES="$(PJPROJECT_INCLUDES)"<br> $(ECHO_PREFIX) echo " [LD] $(LIBRARY_NAME) $(ARCH)"<br>- $(CMD_PREFIX) $(CC) $(CFLAGS) $(DEBUG_CFLAGS) $(SOLINK) -o .$(LIBRARY_NAME) $^ $(LDFLAGS) $(LIBS) $(COPYPROTECT_LIBS)<br>+ $(CMD_PREFIX) $(CC) $(CFLAGS) $(DEBUG_CFLAGS) $(SOLINK) -o .$(LIBRARY_NAME) $(OBJS) $^ $(LDFLAGS) $(LIBS) $(COPYPROTECT_LIBS)<br> $(CMD_PREFIX) echo "$(MODULE_NAME),$(VARIANT),$(PRODUCT_VERSION)" >.$(LIBRARY_NAME).ast_manifest<br> $(CMD_PREFIX) $(OBJCOPY) --add-section .ast_manifest=.$(LIBRARY_NAME).ast_manifest --set-section-flags .ast_manifest=noload,readonly .$(LIBRARY_NAME) $(LIBRARY_NAME)<br>- $(CMD_PREFIX) rm .$(LIBRARY_NAME) .$(LIBRARY_NAME).ast_manifest *.o 2>/dev/null || :<br>+ $(CMD_PREFIX) rm .$(LIBRARY_NAME) .$(LIBRARY_NAME).ast_manifest .*.exports 2>/dev/null || :<br> <br>-$(MODULE_NAME).so: LIBRARY_NAME=$(MODULE_NAME).so<br>-$(MODULE_NAME).so: SOLINK=-shared -Wl,--version-script,$(subst .so,.exports,$(LIBRARY_NAME))<br>-$(MODULE_NAME).so: $(MODULE_OBJS) $(MODULE_SDK_OBJS) $(MODULE_SDK_LIB)<br>- $(ECHO_PREFIX) echo " [LD] $(LIBRARY_NAME) $(ARCH)"<br>- $(CMD_PREFIX) $(CC) $(CFLAGS) $(DEBUG_CFLAGS) $(SOLINK) -o .$(LIBRARY_NAME) $^ $(LDFLAGS) $(LIBS) $(COPYPROTECT_LIBS)<br>- $(CMD_PREFIX) echo "$(LIBRARY_NAME),$(VARIANT),$(PRODUCT_VERSION)" >.$(LIBRARY_NAME).ast_manifest<br>- $(CMD_PREFIX) $(OBJCOPY) --add-section .ast_manifest=.$(LIBRARY_NAME).ast_manifest --set-section-flags .ast_manifest=noload,readonly .$(LIBRARY_NAME) $(LIBRARY_NAME)<br>- $(CMD_PREFIX) rm .$(LIBRARY_NAME) .$(LIBRARY_NAME).ast_manifest *.o 2>/dev/null || :<br>-<br>+ <br> .PHONY: base nocp debug<br> <br> base: COPYPROTECT=yes<br>@@ -234,7 +247,7 @@<br> # we also don't want them in the $^ variable. The "::" rules enforce both<br> # conditions,<br> $(VARIANTS):: clean $(PRECHECKS)<br>- $(VARIANTS):: $(MODULE_NAME).so $(MODULE_EXTRA_LIBRARIES)<br>+ $(VARIANTS):: $(MODULE_LIBS)<br> $(ECHO_PREFIX) echo " [TAR] $(PRODUCT_DIR)"<br> $(CMD_PREFIX)repotools/build_tools/make_tarball $(call setflag,$(DEBUG),--no-strip) --version=$(PRODUCT_VERSION) \<br> --arch=$(ARCH) --package-name=$(MODULE_NAME) --variant=$(TAR_VARIANT) --manifest-in=$(MANIFEST_IN) --manifest-out=$(MANIFEST) $(PRODUCT_DIR).tar.gz $^<br>@@ -344,11 +357,11 @@<br> .PHONY: clean distclean superclean<br> clean::<br> $(ECHO_PREFIX) echo " [CLEAN]"<br>- @rm -f *.o *.so manifest*.xml *~<br>+ @rm -f *.o *.so manifest*.xml .*.exports<br> <br> distclean:: clean<br> $(ECHO_PREFIX) echo " [DISTCLEAN]"<br>- -@rm -f optarch.h version.h<br>+ -@rm -f optarch.h version.h *~<br> <br> superclean:: distclean<br> $(ECHO_PREFIX) echo " [SUPERCLEAN]"<br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/9030">change 9030</a>. To unsubscribe, visit <a href="https://gerrit.asterisk.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.asterisk.org/9030"/><meta itemprop="name" content="View Change"/></div></div>
<div style="display:none"> Gerrit-Project: repotools </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>
<div style="display:none"> Gerrit-Change-Id: Ic7cf8156db30442310b338d6cdb4782928409531 </div>
<div style="display:none"> Gerrit-Change-Number: 9030 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: George Joseph <gjoseph@digium.com> </div>