From 774b8900abb913ea63dff8f90a8812eb41fef1d2 Mon Sep 17 00:00:00 2001 From: Jackson Benete Date: Sun, 20 Feb 2022 12:29:15 -0300 Subject: [PATCH 1/2] detect OS and apply mac configuration requirements --- config.mk.def | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/config.mk.def b/config.mk.def index edfcf4c..da2550e 100644 --- a/config.mk.def +++ b/config.mk.def @@ -1,6 +1,9 @@ # config.mk - makefile configuration for sam # copyright 2015 Rob King +# Get OS for specific dependencies +UNAME := $(shell uname) + # CC is the C compiler to use CC=gcc CFLAGS?= @@ -9,10 +12,12 @@ CFLAGS+=-std=c99 # STANDARDS names the C preprocessor defines that need to # be present to get a more-or-less standard compilation # environment. -# -# Mac OS X users need to add -D_DARWIN_C_SOURCE here. STANDARDS=-D_POSIX_C_SOURCE=200809L -D_XOPEN_SOURCE=500 +ifeq ($(UNAME), Darwin) + STANDARDS+=-D_DARWIN_C_SOURCE +endif + # DESTDIR is the root of the installation tree DESTDIR?=/usr/local @@ -23,11 +28,15 @@ BINDIR?=$(DESTDIR)/bin MANDIR?=$(DESTDIR)/share/man/ # Add additional include and library directories -# BSD/Mac OS X users might need to add something like -# INCLUDES=-I/usr/X11R6/include -I/usr/X11R6/include/freetype2 -# LDFLAGS=-L/usr/X11R6/lib -INCLUDES=-I/usr/include/freetype2 +INCLUDES= LDFLAGS= +ifeq ($(UNAME), Darwin) + INCLUDES+=-I/usr/X11R6/include -I/usr/X11R6/include/freetype2 + LDFLAGS+=-L/usr/X11R6/lib +else + INCLUDES+=-I/usr/include/freetype2 +endif + # Set this to your default remote shell. RXPATH=/usr/bin/ssh From 1e1df584d9c8d32c31614571a71a8e91620bfea0 Mon Sep 17 00:00:00 2001 From: Jackson Benete Date: Sun, 20 Feb 2022 18:32:28 -0300 Subject: [PATCH 2/2] target mac os x versions before 10.7 release --- config.mk.def | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/config.mk.def b/config.mk.def index da2550e..1f54e82 100644 --- a/config.mk.def +++ b/config.mk.def @@ -15,7 +15,8 @@ CFLAGS+=-std=c99 STANDARDS=-D_POSIX_C_SOURCE=200809L -D_XOPEN_SOURCE=500 ifeq ($(UNAME), Darwin) - STANDARDS+=-D_DARWIN_C_SOURCE + OSVERSION := $(shell sw_vers | awk '($$1 = /ProductVersion:/){ ($$2 < 10.7) ? source = "-D_ANSI_SOURCE" : source = "-D_DARWIN_C_SOURCE"; print source }') + STANDARDS+=$(OSVERSION) endif # DESTDIR is the root of the installation tree