From 830a726cff0fbf66d94d8f684adb6a9fb8bdf9ce Mon Sep 17 00:00:00 2001 From: Richard Lau Date: Wed, 20 Apr 2016 13:12:14 -0400 Subject: [PATCH] build: fix DESTCPU detection for binary target MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `make binary` attempts to auto detect DESTCPU if not set, but was assuming being on an Intel architecture. PR-URL: https://github.com/nodejs/node/pull/6310 Reviewed-By: Johan Bergström Reviewed-By: Myles Borins Reviewed-By: Michael Dawson --- Makefile | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 348d4ccf0e..86120556eb 100644 --- a/Makefile +++ b/Makefile @@ -331,11 +331,40 @@ RELEASE=$(shell sed -ne 's/\#define NODE_VERSION_IS_RELEASE \([01]\)/\1/p' src/n PLATFORM=$(shell uname | tr '[:upper:]' '[:lower:]') NPMVERSION=v$(shell cat deps/npm/package.json | grep '"version"' | sed 's/^[^:]*: "\([^"]*\)",.*/\1/') -ifeq ($(findstring x86_64,$(shell uname -m)),x86_64) +UNAME_M=$(shell uname -m) +ifeq ($(findstring x86_64,$(UNAME_M)),x86_64) DESTCPU ?= x64 else +ifeq ($(findstring ppc64,$(UNAME_M)),ppc64) +DESTCPU ?= ppc64 +else +ifeq ($(findstring ppc,$(UNAME_M)),ppc) +DESTCPU ?= ppc +else +ifeq ($(findstring s390x,$(UNAME_M)),s390x) +DESTCPU ?= s390x +else +ifeq ($(findstring s390,$(UNAME_M)),s390) +DESTCPU ?= s390 +else +ifeq ($(findstring arm,$(UNAME_M)),arm) +DESTCPU ?= arm +else +ifeq ($(findstring aarch64,$(UNAME_M)),aarch64) +DESTCPU ?= aarch64 +else +ifeq ($(findstring powerpc,$(shell uname -p)),powerpc) +DESTCPU ?= ppc64 +else DESTCPU ?= x86 endif +endif +endif +endif +endif +endif +endif +endif ifeq ($(DESTCPU),x64) ARCH=x64 else