Skip to content
This repository
Browse code

Makefile: add a better check to ensure a node "release"

Closes #3841.
Closes #3842.
  • Loading branch information...
commit 64ac54a64d68c1fffd352d0453d81b6c3c0455b0 1 parent c82e288
Nathan Rajlich authored August 09, 2012
18  Makefile
@@ -192,15 +192,17 @@ docclean:
192 192
 	-rm -rf out/doc
193 193
 
194 194
 VERSION=v$(shell $(PYTHON) tools/getnodeversion.py)
  195
+RELEASE=$(shell $(PYTHON) tools/getnodeisrelease.py)
195 196
 PLATFORM=$(shell uname | tr '[:upper:]' '[:lower:]')
196  
-ifeq ($(DESTCPU),x64)
197  
-ARCH=x86_64
198  
-else
199  
-ifeq ($(DESTCPU),ia32)
200  
-ARCH=i386
  197
+ifeq ($(findstring x86_64,$(shell uname -m)),x86_64)
  198
+DESTCPU ?= x64
201 199
 else
202  
-ARCH=$(shell uname -m)
  200
+DESTCPU ?= ia32
203 201
 endif
  202
+ifeq ($(DESTCPU),x64)
  203
+ARCH=x64
  204
+else
  205
+ARCH=x86
204 206
 endif
205 207
 TARNAME=node-$(VERSION)
206 208
 TARBALL=$(TARNAME).tar.gz
@@ -225,11 +227,11 @@ release-only:
225 227
 		echo "" >&2 ; \
226 228
 		exit 1 ; \
227 229
 	fi
228  
-	@if [ $(shell ./node --version) = "$(VERSION)" ]; then \
  230
+	@if [ "$(RELEASE)" = "1" ]; then \
229 231
 		exit 0; \
230 232
 	else \
231 233
 	  echo "" >&2 ; \
232  
-		echo "$(shell ./node --version) doesn't match $(VERSION)." >&2 ; \
  234
+		echo "#NODE_VERSION_IS_RELEASE is set to $(RELEASE)." >&2 ; \
233 235
 	  echo "Did you remember to update src/node_version.cc?" >&2 ; \
234 236
 	  echo "" >&2 ; \
235 237
 		exit 1 ; \
11  tools/getnodeisrelease.py
... ...
@@ -0,0 +1,11 @@
  1
+import sys,os,re
  2
+
  3
+node_version_h = os.path.join(os.path.dirname(__file__), '..', 'src',
  4
+    'node_version.h')
  5
+
  6
+f = open(node_version_h)
  7
+
  8
+for line in f:
  9
+  if re.match('#define NODE_VERSION_IS_RELEASE', line):
  10
+    release = int(line.split()[2])
  11
+    print release

0 notes on commit 64ac54a

Please sign in to comment.
Something went wrong with that request. Please try again.