diff --git a/client/Makefile b/client/Makefile index 490716eda..a1109a497 100644 --- a/client/Makefile +++ b/client/Makefile @@ -31,7 +31,12 @@ platform = $(shell uname) VPATH = ../common ../zlib ../uart OBJDIR = obj -LDLIBS = -L/opt/local/lib -L/usr/local/lib -lreadline -lpthread -lm +LDLIBS = +ifneq ($(platform),Darwin) + LDLIBS += -L/opt/local/lib +endif +LDLIBS += -L/usr/local/lib -lreadline -lpthread -lm + # RPi Zero gcc requires -latomic # but MacOSX /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld # doesn't recognize option --as-needed diff --git a/client/jansson/Makefile b/client/jansson/Makefile index 323d26216..1a60613d0 100644 --- a/client/jansson/Makefile +++ b/client/jansson/Makefile @@ -36,15 +36,26 @@ CFILES = $(filter %.c, $(libjansson_la_SOURCES)) CMDOBJS = $(CFILES:%.c=%.o) CLEAN = $(CMDOBJS) +platform = $(shell uname) + CC= gcc -CFLAGS= -O2 -Wall -Wno-unused-variable -Wno-unused-function -Wno-format-truncation +CFLAGS= -O2 -Wall -Wno-unused-variable -Wno-unused-function +ifneq ($(platform),Darwin) +CFLAGS += -Wno-format-truncation +endif + LDFLAGS= $(SYSLDFLAGS) $(libjansson_la_LDFLAGS) LIBS= $(SYSLIBS) $(MYLIBS) DEFAULT_INCLUDES = -I. DEFS = -DHAVE_STDINT_H +ifeq ($(platform),Darwin) +AR= /usr/bin/ar rcs +RANLIB= /usr/bin/ranlib +else AR= ar rcs RANLIB= ranlib +endif RM= rm -f TST= echo diff --git a/client/tinycbor/Makefile b/client/tinycbor/Makefile index 8124196eb..af22846e9 100644 --- a/client/tinycbor/Makefile +++ b/client/tinycbor/Makefile @@ -19,14 +19,21 @@ CFILES = $(filter %.c, $(tinycbor_SOURCES)) CMDOBJS = $(CFILES:%.c=%.o) CLEAN = $(CMDOBJS) +platform = $(shell uname) + CC= gcc CFLAGS= -O2 -Wall -Wno-unused-variable -Wno-unused-function LIBS= $(SYSLIBS) $(MYLIBS) DEFAULT_INCLUDES = -I. -I.. DEFS = -DHAVE_STDINT_H +ifeq ($(platform),Darwin) +AR= /usr/bin/ar rcs +RANLIB= /usr/bin/ranlib +else AR= ar rcs RANLIB= ranlib +endif RM= rm -f TST= echo diff --git a/common/Makefile.common b/common/Makefile.common index 132507547..2ab434562 100644 --- a/common/Makefile.common +++ b/common/Makefile.common @@ -43,15 +43,13 @@ TARFLAGS = -C .. -rvf # amount of shell command line parsing going on. echo "" on # Windows yields literal "", on Linux yields an empty line ifeq ($(shell echo ""),) - -# This is probably a proper system, so we can use uname -UNAME := $(shell uname) DELETE=rm -rf MOVE=mv COPY=cp PATHSEP=/ FLASH_TOOL=client/flasher -DETECTED_OS=$(UNAME) +# This is probably a proper system, so we can use uname +DETECTED_OS=$(platform) else # Assume that we are running on Windows. diff --git a/common/mbedtls/Makefile b/common/mbedtls/Makefile index fa0dff05f..a16b2cfd9 100644 --- a/common/mbedtls/Makefile +++ b/common/mbedtls/Makefile @@ -59,6 +59,8 @@ CFILES = $(filter %.c, $(mbedtls_SOURCES)) CMDOBJS = $(CFILES:%.c=%.o) CLEAN = $(CMDOBJS) +platform = $(shell uname) + CC= gcc CFLAGS= -O2 -Wall -Wno-unused-variable -Wno-unused-function LDFLAGS= $(SYSLDFLAGS) $(mbedtls_LDFLAGS) @@ -66,8 +68,13 @@ LIBS= $(SYSLIBS) $(MYLIBS) DEFAULT_INCLUDES = -I. -I.. DEFS = -DHAVE_STDINT_H +ifeq ($(platform),Darwin) +AR= /usr/bin/ar rcs +RANLIB= /usr/bin/ranlib +else AR= ar rcs RANLIB= ranlib +endif RM= rm -f TST= echo diff --git a/liblua/Makefile b/liblua/Makefile index bf2a4fa3c..2b3d7614f 100644 --- a/liblua/Makefile +++ b/liblua/Makefile @@ -12,13 +12,20 @@ endif # Your platform. See PLATS for possible values. PLAT= none +platform= $(shell uname) + CC= gcc CFLAGS= -O3 -Wall -DLUA_COMPAT_ALL $(SYSCFLAGS) $(MYCFLAGS) LDFLAGS= $(SYSLDFLAGS) $(MYLDFLAGS) LIBS= -lm $(SYSLIBS) $(MYLIBS) +ifeq ($(platform),Darwin) +AR= /usr/bin/ar rc +RANLIB= /usr/bin/ranlib +else AR= ar rc RANLIB= ranlib +endif RM= rm -f SYSCFLAGS=