Skip to content

Commit ce6b963

Browse files
committed
dj64.mk: use CC -dumpmachune instead of uname
Helps when cross-compiling.
1 parent 3472f8d commit ce6b963

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

dj64.mk

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
ifeq ($(filter clean install,$(MAKECMDGOALS)),)
2+
MACH = $(subst -, ,$(shell $(CC) -dumpmachine))
3+
ifeq ($(MACH),)
4+
$(error unknown target architecture)
5+
endif
26
# find the suitable cross-assembler
37
DJ64AS = $(CROSS_PREFIX)as
48
DJ64ASFLAGS = --32 --defsym _DJ64=1
@@ -12,7 +16,7 @@ CROSS_PREFIX := x86_64-linux-gnu-
1216
endif
1317
ifeq ($(shell $(DJ64AS) --version 2>/dev/null),)
1418
CROSS_PREFIX :=
15-
ifneq ($(filter x86_64 amd64 i686 i386,$(shell uname -m)),)
19+
ifneq ($(filter x86_64 amd64 i686 i386,$(MACH)),)
1620
ifeq ($(shell $(DJ64AS) --version 2>/dev/null),)
1721
# found nothing, try built-in assembler
1822
DJ64AS = $(CC) -x assembler
@@ -47,10 +51,10 @@ LD = $(CC)
4751
DJ64_XLDFLAGS = -V 5
4852
# freebsd's dlopen() ignores link order and binds to libc the symbols
4953
# defined in libdj64.so. Use static linking as a work-around.
50-
ifeq ($(shell uname -s),FreeBSD)
54+
ifneq ($(filter freebsd%,$(MACH)),)
5155
DJ64STATIC = 1
5256
endif
53-
ifeq ($(shell uname -o),Android)
57+
ifneq ($(filter android%,$(MACH)),)
5458
DJ64STATIC = 1
5559
endif
5660
ifeq ($(DJ64STATIC),0)

0 commit comments

Comments
 (0)