Skip to content

Commit

Permalink
use gcc -dumpmachine to detect target OS, istead of uname -m
Browse files Browse the repository at this point in the history
  • Loading branch information
k-okada committed Feb 24, 2022
1 parent 317c29c commit 2b10a87
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 4 deletions.
8 changes: 7 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@ ifneq ($(GCC_MACHINE),)
ifeq ($(GCC_MACHINE),i686-linux-gnu)
MACHINE=x86
endif
ifeq ($(GCC_MACHINE),aarch64-linux-gnu)
MACHINE=aarch64
endif
ifeq ($(GCC_MACHINE),arm-linux-gnueabihf)
MACHINE=arm
endif
endif
ifeq ($(MACHINE),)
MACHINE=$(shell uname -m)
Expand All @@ -26,7 +32,7 @@ ifeq ($(OS),Linux)
export ARCHDIR=Linux64
export MAKEFILE=Makefile.Linux64
else
ifneq (, $(findstring armv,$(MACHINE)))
ifneq (, $(findstring arm,$(MACHINE)))
export ARCHDIR=LinuxARM
export MAKEFILE=Makefile.LinuxARM
else ifneq (, $(findstring aarch,$(MACHINE)))
Expand Down
2 changes: 1 addition & 1 deletion irteus/Makefile.Linux
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ CXXFLAGS=$(CFLAGS)
CFLAGS+= -g -falign-functions=4
CXXFLAGS+=-g -falign-functions=4

ifeq ($(shell /bin/uname -m), x86_64)
ifeq ($(shell gcc -dumpmachine), x86_64-linux-gnu)
CC += -m32
CXX += -m32
LD += -m32
Expand Down
3 changes: 2 additions & 1 deletion irteus/Makefile.LinuxARM
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@ FFTW=-L/usr/local/lib -lfftw -lrfftw

SVNVERSION=\"$(shell git rev-parse --short HEAD)\"

MACHINE=$(shell uname -m | sed 's/\(armv[0-9]\).*/\1/')
# gcc -dumpmachine retruns target triplet consists of three fields separated by a hyphen (-).
MACHINE=$(shell gcc -dumpmachine | sed 's/\(.*\)-.*-.*/\1/')
THREAD= -DTHREADED -DPTHREAD

CFLAGS=-O2 -D$(MACHINE) -D$(ARCH) -DLinux -DARM -D_REENTRANT -DGCC -I$(EUSDIR)/include $(THREAD) -DSVNVERSION=$(SVNVERSION) -fPIC
Expand Down
2 changes: 1 addition & 1 deletion irteus/PQP/Makefile.Linux
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ LPFX = lib
LIBS = -L$(ARCHDIR) -lRAPID


ifeq ($(shell /bin/uname -m), x86_64)
ifeq ($(shell gcc -dumpmachine), x86_64-linux-gnu)
CC += -m32
LD += -m32
EXELD += -m32
Expand Down

0 comments on commit 2b10a87

Please sign in to comment.