fix(build): handle portable detection edge cases

This commit is contained in:
RonitBStudent
2026-07-15 22:19:25 -05:00
parent c82593ad87
commit 53324fdcf0
2 changed files with 3 additions and 3 deletions
+2 -3
View File
@@ -14,7 +14,6 @@ TRIPLET := $(shell $(DETECT_CC) -dumpmachine 2>/dev/null)
MINGW := $(findstring mingw,$(TRIPLET))
CYGWIN := $(findstring cygwin,$(TRIPLET))
DARWIN := $(findstring darwin,$(TRIPLET))
PPC64 := $(findstring powerpc64,$(TRIPLET))
LINUX := $(findstring linux,$(TRIPLET))
IS_WIN := $(MINGW)$(CYGWIN)
@@ -27,7 +26,6 @@ ifeq ($(IS_WIN),)
UNAME_S := $(shell uname -s)
UNAME_M := $(shell uname -m)
DARWIN := $(findstring Darwin,$(UNAME_S))
PPC64 := $(findstring ppc64,$(UNAME_M))
endif
endif
@@ -37,6 +35,7 @@ TARGET_CPU := $(UNAME_M)
endif
X86_64 := $(filter x86_64 amd64,$(TARGET_CPU))
AARCH64 := $(filter aarch64 arm64,$(TARGET_CPU))
PPC64 := $(filter powerpc64% ppc64%,$(TARGET_CPU))
ifneq (,$(DARWIN))
# --- macOS / Apple Silicon ---
@@ -47,7 +46,7 @@ CC = clang
OMPDIR := $(shell brew --prefix libomp 2>/dev/null)
# `brew --prefix libomp` can print the formula's prospective path even when it
# is not installed, so verify both artifacts before adding unusable flags.
ifneq ($(and $(wildcard $(OMPDIR)/include/omp.h),$(wildcard $(OMPDIR)/lib/libomp.*)),)
ifneq ($(and $(OMPDIR),$(wildcard $(OMPDIR)/include/omp.h),$(wildcard $(OMPDIR)/lib/libomp.*)),)
OMPC = -Xclang -fopenmp -I$(OMPDIR)/include
OMPL = -L$(OMPDIR)/lib -lomp
else
+1
View File
@@ -52,6 +52,7 @@ class MakefilePlatformTests(unittest.TestCase):
("x86_64-unknown-linux-gnu", "-march=x86-64-v3"),
("aarch64-unknown-linux-gnu", "-march=armv8-a"),
("powerpc64le-unknown-linux-gnu", "-mcpu=power8"),
("ppc64le-unknown-linux-gnu", "-mcpu=power8"),
)
for triplet, expected_flag in cases: