]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Don't unnecessarily rebuild things on every run of 'make'.
authorJason Parker <jparker@digium.com>
Mon, 15 Apr 2013 17:07:45 +0000 (17:07 +0000)
committerJason Parker <jparker@digium.com>
Mon, 15 Apr 2013 17:07:45 +0000 (17:07 +0000)
Review: https://reviewboard.asterisk.org/r/2449/

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.8@385745 65c4cc65-6c06-0410-ace0-fbb531ad65f3

Makefile

index 69b811acaf3c9cca9a14cbefc4fdc8f141c03599..41f2761f6222512d1e61e59304db27fa97f7064c 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -289,7 +289,7 @@ all: _all
        @echo " +               $(mK) install               +"  
        @echo " +-------------------------------------------+"  
 
-_all: cleantest makeopts $(SUBDIRS) doc/core-en_US.xml
+_all: .lastclean makeopts $(SUBDIRS) doc/core-en_US.xml
 
 makeopts: configure
        @echo "****"
@@ -350,31 +350,30 @@ $(MOD_SUBDIRS):
 $(OTHER_SUBDIRS):
        +@_ASTCFLAGS="$(OTHER_SUBDIR_CFLAGS) $(_ASTCFLAGS)" ASTCFLAGS="$(ASTCFLAGS)" _ASTLDFLAGS="$(_ASTLDFLAGS)" ASTLDFLAGS="$(ASTLDFLAGS)" $(SUBMAKE) --no-builtin-rules -C $@ SUBDIR=$@ all
 
-defaults.h: makeopts cleantest
+defaults.h: makeopts .lastclean
        @build_tools/make_defaults_h > $@.tmp
        @cmp -s $@.tmp $@ || mv $@.tmp $@
        @rm -f $@.tmp
 
-main/version.c: FORCE cleantest
+main/version.c: FORCE .lastclean
        @build_tools/make_version_c > $@.tmp
        @cmp -s $@.tmp $@ || mv $@.tmp $@
        @rm -f $@.tmp
 
-include/asterisk/version.h: FORCE cleantest
+include/asterisk/version.h: FORCE .lastclean
        @build_tools/make_version_h > $@.tmp
        @cmp -s $@.tmp $@ || mv $@.tmp $@
        @rm -f $@.tmp
 
-include/asterisk/buildopts.h: menuselect.makeopts cleantest
+include/asterisk/buildopts.h: menuselect.makeopts .lastclean
        @build_tools/make_buildopts_h > $@.tmp
        @cmp -s $@.tmp $@ || mv $@.tmp $@
        @rm -f $@.tmp
 
-# build.h must depend on cleantest, or parallel make may wipe it out after it's
-# been created. But since build.h contains a timestamp, the cmp trick used above
-# won't work. Just testing for existence is good enough.
-include/asterisk/build.h: cleantest
-       @test -f $@ || build_tools/make_build_h > $@
+# build.h must depend on .lastclean, or parallel make may wipe it out after it's
+# been created.
+include/asterisk/build.h: .lastclean
+       @build_tools/make_build_h > $@
 
 $(SUBDIRS_CLEAN):
        +@$(SUBMAKE) -C $(@:-clean=) clean
@@ -421,7 +420,7 @@ datafiles: _all doc/core-en_US.xml
        done
        $(MAKE) -C sounds install
 
-doc/core-en_US.xml: cleantest $(foreach dir,$(MOD_SUBDIRS),$(shell $(GREP) -l "language=\"en_US\"" $(dir)/*.c $(dir)/*.cc 2>/dev/null))
+doc/core-en_US.xml: .lastclean $(foreach dir,$(MOD_SUBDIRS),$(shell $(GREP) -l "language=\"en_US\"" $(dir)/*.c $(dir)/*.cc 2>/dev/null))
        @printf "Building Documentation For: "
        @echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" > $@
        @echo "<!DOCTYPE docs SYSTEM \"appdocsxml.dtd\">" >> $@
@@ -762,8 +761,8 @@ sounds:
 # .cleancount is the global clean count, and .lastclean is the 
 # last clean count we had
 
-cleantest:
-       @cmp -s .cleancount .lastclean || $(MAKE) clean
+.lastclean: .cleancount
+       @$(MAKE) clean
 
 $(SUBDIRS_UNINSTALL):
        +@$(SUBMAKE) -C $(@:-uninstall=) uninstall
@@ -876,7 +875,6 @@ menuselect-tree: $(foreach dir,$(filter-out main,$(MOD_SUBDIRS)),$(wildcard $(di
 .PHONY: distclean
 .PHONY: all
 .PHONY: prereqs
-.PHONY: cleantest
 .PHONY: uninstall
 .PHONY: _uninstall
 .PHONY: uninstall-all