Makefile: move the release verification logic into a `make release-only` target
authorNathan Rajlich <nathan@tootallnate.net>
Sat, 4 Aug 2012 22:34:04 +0000 (15:34 -0700)
committerNathan Rajlich <nathan@tootallnate.net>
Mon, 6 Aug 2012 18:41:45 +0000 (11:41 -0700)
Makefile

index da07637..31a2dde 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -213,9 +213,31 @@ dist: doc $(TARBALL) $(PKG)
 
 PKGDIR=out/dist-osx
 
+release-only:
+       @if [ "$(shell git status --porcelain | egrep -v '^\?\? ')" = "" ]; then \
+               exit 0 ; \
+       else \
+         echo "" >&2 ; \
+               echo "The git repository is not clean." >&2 ; \
+               echo "Please commit changes before building release tarball." >&2 ; \
+               echo "" >&2 ; \
+               git status --porcelain | egrep -v '^\?\?' >&2 ; \
+               echo "" >&2 ; \
+               exit 1 ; \
+       fi
+       @if [ $(shell ./node --version) = "$(VERSION)" ]; then \
+               exit 0; \
+       else \
+         echo "" >&2 ; \
+               echo "$(shell ./node --version) doesn't match $(VERSION)." >&2 ; \
+         echo "Did you remember to update src/node_version.cc?" >&2 ; \
+         echo "" >&2 ; \
+               exit 1 ; \
+       fi
+
 pkg: $(PKG)
 
-$(PKG):
+$(PKG): release-only
        rm -rf $(PKGDIR)
        rm -rf out/deps out/Release
        ./configure --prefix=$(PKGDIR)/32/usr/local --without-snapshot --dest-cpu=ia32
@@ -236,27 +258,7 @@ $(PKG):
                --out $(PKG)
        SIGN="$(SIGN)" PKG="$(PKG)" bash tools/osx-productsign.sh
 
-$(TARBALL): node doc
-       @if [ "$(shell git status --porcelain | egrep -v '^\?\? ')" = "" ]; then \
-               exit 0 ; \
-       else \
-         echo "" >&2 ; \
-               echo "The git repository is not clean." >&2 ; \
-               echo "Please commit changes before building release tarball." >&2 ; \
-               echo "" >&2 ; \
-               git status --porcelain | egrep -v '^\?\?' >&2 ; \
-               echo "" >&2 ; \
-               exit 1 ; \
-       fi
-       @if [ $(shell ./node --version) = "$(VERSION)" ]; then \
-               exit 0; \
-       else \
-         echo "" >&2 ; \
-               echo "$(shell ./node --version) doesn't match $(VERSION)." >&2 ; \
-         echo "Did you remember to update src/node_version.cc?" >&2 ; \
-         echo "" >&2 ; \
-               exit 1 ; \
-       fi
+$(TARBALL): release-only node doc
        git archive --format=tar --prefix=$(TARNAME)/ HEAD | tar xf -
        mkdir -p $(TARNAME)/doc/api
        cp doc/node.1 $(TARNAME)/doc/node.1
@@ -270,7 +272,7 @@ $(TARBALL): node doc
 
 tar: $(TARBALL)
 
-$(BINARYTAR):
+$(BINARYTAR): release-only
        rm -rf $(BINARYNAME)
        rm -rf out/deps out/Release
        ./configure --prefix=/ --without-snapshot --dest-cpu=$(DESTCPU)
@@ -308,4 +310,4 @@ cpplint:
 
 lint: jslint cpplint
 
-.PHONY: lint cpplint jslint bench clean docopen docclean doc dist distclean check uninstall install install-includes install-bin all staticlib dynamiclib test test-all website-upload pkg blog blogclean tar binary
+.PHONY: lint cpplint jslint bench clean docopen docclean doc dist distclean check uninstall install install-includes install-bin all staticlib dynamiclib test test-all website-upload pkg blog blogclean tar binary release-only