Skip to content

Commit

Permalink
fix: check uname first in case sysctl is installed but not configured
Browse files Browse the repository at this point in the history
  • Loading branch information
JamesPiechota committed Nov 12, 2024
1 parent 74c956d commit f25a120
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions c_src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@ ifeq ($(UNAME_SYS), Darwin)
OSX_CPU_ARCH ?= x86_64
# nix systems may not have sysctl where uname -m will return the correct arch
SYSCTL_EXISTS := $(shell which sysctl 2>/dev/null)
ifdef SYSCTL_EXISTS
ifneq ($(shell sysctl -n machdep.cpu.brand_string | egrep "M(1|2)"),)
OSX_CPU_ARCH = arm64
ifneq ($(shell uname -m | egrep "arm64"),)
OSX_CPU_ARCH = arm64
else
ifdef SYSCTL_EXISTS
ifneq ($(shell sysctl -n machdep.cpu.brand_string | egrep "M(1|2)"),)
OSX_CPU_ARCH = arm64
endif
endif
else
ifneq ($(shell uname -m | egrep "arm64"),)
OSX_CPU_ARCH = arm64
endif
endif
endif
CC ?= cc
CFLAGS ?= -O3 -std=c99 -arch $(OSX_CPU_ARCH) -Wall -Wmissing-prototypes
CXXFLAGS ?= -O3 -arch $(OSX_CPU_ARCH) -Wall
Expand Down

0 comments on commit f25a120

Please sign in to comment.