Browse Source

do ARCH autodetection based upon compiler instead of host

Jameson Nash 11 years ago
parent
commit
bcefcc3d58
1 changed files with 8 additions and 6 deletions
  1. 8 6
      Make.inc

+ 8 - 6
Make.inc

@@ -1,7 +1,6 @@
 # -*- mode: makefile-gmake -*-
 
-OS = $(shell uname)
-ARCH = $(shell uname -m)
+OS := $(shell uname)
 
 FC = gfortran
 FFLAGS += -O3
@@ -9,7 +8,6 @@ FFLAGS += -O3
 USEGCC = 1
 USECLANG = 0
 
-CFLAGS_add += -std=c99 -Wall -O3 -I$(OPENLIBM_HOME) -I$(OPENLIBM_HOME)/include -I$(OPENLIBM_HOME)/ld80 -I$(OPENLIBM_HOME)/$(ARCH) -I$(OPENLIBM_HOME)/src -DASSEMBLER -D__BSD_VISIBLE -Wno-implicit-function-declaration
 
 ifeq ($(USECLANG),1)
 USEGCC = 0
@@ -23,6 +21,10 @@ CFLAGS_add += -fno-gnu89-inline
 endif
 AR = ar
 
+ARCH := $(shell $(CC) -dumpmachine | sed "s/\([^-]*\).*$$/\1/")
+
+CFLAGS_add += -std=c99 -Wall -O3 -I$(OPENLIBM_HOME) -I$(OPENLIBM_HOME)/include -I$(OPENLIBM_HOME)/ld80 -I$(OPENLIBM_HOME)/$(ARCH) -I$(OPENLIBM_HOME)/src -DASSEMBLER -D__BSD_VISIBLE -Wno-implicit-function-declaration
+
 default: all
 
 %.c.o: %.c
@@ -39,15 +41,15 @@ clean:
 
 # OS-specific stuff
 ifeq ($(ARCH),i386)
-override ARCH = i387
+override ARCH := i387
 endif
 
 ifeq ($(ARCH),x86_64)
-override ARCH = amd64
+override ARCH := amd64
 endif 
 
 ifeq ($(ARCH),i686)
-override ARCH = i387
+override ARCH := i387
 endif
 
 ifneq (,$(findstring MINGW,$(OS)))