summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorWalter Doekes <walter+asterisk@wjd.nu>2012-01-17 19:45:19 +0000
committerWalter Doekes <walter+asterisk@wjd.nu>2012-01-17 19:45:19 +0000
commita9698d02418ad6c8043170985cf70a8ce20cbad6 (patch)
tree34b5b01225a70683436f8af40f29e46949e99183 /Makefile
parentf5dd17e558db4572c08bb7d14bb990a40c8446ff (diff)
Fix support for parallel building with make (-j).
Previously make -j <N> would cause a race between doing cleanup of certain files (defaults.h, menuselect, ...) and creating them anew. Add a new target that depends on cleanup only and has a submake doing the rest as command string. This way the cleanup goes first. (closes issue ASTERISK-18751) Tested by: Jeremy Kister Reviewed by: Paul Belanger Review: https://reviewboard.asterisk.org/r/1660 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@351360 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile15
1 files changed, 11 insertions, 4 deletions
diff --git a/Makefile b/Makefile
index f0fbad7fe..dfa1757f4 100644
--- a/Makefile
+++ b/Makefile
@@ -338,7 +338,7 @@ else
mK=" make"
endif
-all: _all
+all: _cleantest_all
@echo " +--------- Asterisk Build Complete ---------+"
@echo " + Asterisk has successfully been built, and +"
@echo " + can be installed by running: +"
@@ -346,7 +346,12 @@ all: _all
@echo " + $(mK) install +"
@echo " +-------------------------------------------+"
-_all: cleantest makeopts $(SUBDIRS) doc/core-en_US.xml $(ADDL_TARGETS)
+# For parallel builds, we must call cleantest *before* running the
+# other dependencies on _all.
+_cleantest_all: cleantest
+ @$(MAKE) _all
+
+_all: makeopts $(SUBDIRS) doc/core-en_US.xml $(ADDL_TARGETS)
makeopts: configure
@echo "****"
@@ -462,7 +467,7 @@ distclean: $(SUBDIRS_DIST_CLEAN) _clean
rm -rf doc/api
rm -f build_tools/menuselect-deps
-datafiles: _all doc/core-en_US.xml
+datafiles: _cleantest_all doc/core-en_US.xml
CFLAGS="$(_ASTCFLAGS) $(ASTCFLAGS)" build_tools/mkpkgconfig "$(DESTDIR)$(libdir)/pkgconfig";
# Should static HTTP be installed during make samples or even with its own target ala
# webvoicemail? There are portions here that *could* be customized but might also be
@@ -563,7 +568,7 @@ installdirs:
$(INSTALL) -d "$(DESTDIR)$(AGI_DIR)"
$(INSTALL) -d "$(DESTDIR)$(ASTDBDIR)"
-bininstall: _all installdirs $(SUBDIRS_INSTALL)
+bininstall: _cleantest_all installdirs $(SUBDIRS_INSTALL)
$(INSTALL) -m 755 main/asterisk "$(DESTDIR)$(ASTSBINDIR)/"
$(LN) -sf asterisk "$(DESTDIR)$(ASTSBINDIR)/rasterisk"
$(INSTALL) -m 755 contrib/scripts/astgenkey "$(DESTDIR)$(ASTSBINDIR)/"
@@ -954,6 +959,8 @@ menuselect-tree: $(foreach dir,$(filter-out main,$(MOD_SUBDIRS)),$(wildcard $(di
.PHONY: dist-clean
.PHONY: distclean
.PHONY: all
+.PHONY: _all
+.PHONY: _cleantest_all
.PHONY: prereqs
.PHONY: cleantest
.PHONY: uninstall