Skip to content

Commit

Permalink
dj64.mk: use CC -dumpmachune instead of uname
Browse files Browse the repository at this point in the history
Helps when cross-compiling.
  • Loading branch information
stsp committed Dec 26, 2024
1 parent 3472f8d commit ce6b963
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions dj64.mk
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
ifeq ($(filter clean install,$(MAKECMDGOALS)),)
MACH = $(subst -, ,$(shell $(CC) -dumpmachine))
ifeq ($(MACH),)
$(error unknown target architecture)
endif
# find the suitable cross-assembler
DJ64AS = $(CROSS_PREFIX)as
DJ64ASFLAGS = --32 --defsym _DJ64=1
Expand All @@ -12,7 +16,7 @@ CROSS_PREFIX := x86_64-linux-gnu-
endif
ifeq ($(shell $(DJ64AS) --version 2>/dev/null),)
CROSS_PREFIX :=
ifneq ($(filter x86_64 amd64 i686 i386,$(shell uname -m)),)
ifneq ($(filter x86_64 amd64 i686 i386,$(MACH)),)
ifeq ($(shell $(DJ64AS) --version 2>/dev/null),)
# found nothing, try built-in assembler
DJ64AS = $(CC) -x assembler
Expand Down Expand Up @@ -47,10 +51,10 @@ LD = $(CC)
DJ64_XLDFLAGS = -V 5
# freebsd's dlopen() ignores link order and binds to libc the symbols
# defined in libdj64.so. Use static linking as a work-around.
ifeq ($(shell uname -s),FreeBSD)
ifneq ($(filter freebsd%,$(MACH)),)
DJ64STATIC = 1
endif
ifeq ($(shell uname -o),Android)
ifneq ($(filter android%,$(MACH)),)
DJ64STATIC = 1
endif
ifeq ($(DJ64STATIC),0)
Expand Down

0 comments on commit ce6b963

Please sign in to comment.