Skip to content

Commit bcefcc3

Browse files
committed
do ARCH autodetection based upon compiler instead of host
1 parent 13cc579 commit bcefcc3

1 file changed

Lines changed: 8 additions & 6 deletions

File tree

Make.inc

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,13 @@
11
# -*- mode: makefile-gmake -*-
22

3-
OS = $(shell uname)
4-
ARCH = $(shell uname -m)
3+
OS := $(shell uname)
54

65
FC = gfortran
76
FFLAGS += -O3
87

98
USEGCC = 1
109
USECLANG = 0
1110

12-
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
1311

1412
ifeq ($(USECLANG),1)
1513
USEGCC = 0
@@ -23,6 +21,10 @@ CFLAGS_add += -fno-gnu89-inline
2321
endif
2422
AR = ar
2523

24+
ARCH := $(shell $(CC) -dumpmachine | sed "s/\([^-]*\).*$$/\1/")
25+
26+
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
27+
2628
default: all
2729

2830
%.c.o: %.c
@@ -39,15 +41,15 @@ clean:
3941

4042
# OS-specific stuff
4143
ifeq ($(ARCH),i386)
42-
override ARCH = i387
44+
override ARCH := i387
4345
endif
4446

4547
ifeq ($(ARCH),x86_64)
46-
override ARCH = amd64
48+
override ARCH := amd64
4749
endif
4850

4951
ifeq ($(ARCH),i686)
50-
override ARCH = i387
52+
override ARCH := i387
5153
endif
5254

5355
ifneq (,$(findstring MINGW,$(OS)))

0 commit comments

Comments
 (0)