From 7f7c7bd68a065b5e680075c49b6b541271462a1f Mon Sep 17 00:00:00 2001 From: Victor Varenik <38311102+kotleni@users.noreply.github.com> Date: Mon, 8 Aug 2022 11:49:17 +0300 Subject: Added building support on arm macOS Arm version of brew tool use custom directory for libs/includes files. Tested on M1 --- source/Makefile | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/source/Makefile b/source/Makefile index aad42c4..289994d 100644 --- a/source/Makefile +++ b/source/Makefile @@ -8,6 +8,21 @@ COMMIT := COMMIT_INFO = commit.h EXTRA_CFLAGS ?= -O2 -Wall -Wno-restrict -Wno-unknown-warning-option + +IS_MACARM := 0 + +# build on macos(arm) support +ifneq ($(OS),Windows_NT) + UNAME_S := $(shell uname -s) + ifeq ($(UNAME_S),Darwin) + UNAME_P := $(shell uname -p) + ifneq ($(filter arm%,$(UNAME_P)),) + EXTRA_CFLAGS += -I$(shell brew --prefix)/include + IS_MACARM = 1 + endif + endif +endif + CFLAGS += ${EXTRA_CFLAGS} -I. EXEDIR ?= .. @@ -33,6 +48,11 @@ else UNAME_S := $(shell uname -s) ifeq ($(UNAME_S),Darwin) LDFLAGS += -largp + + # build on macos(arm) support + ifeq ($(IS_MACARM), 1) + LDFLAGS += -L$(shell brew --prefix)/lib + endif endif endif -- cgit v1.2.3