From e047d223e4b1a68e24f8b2fc615df3a848809c8b Mon Sep 17 00:00:00 2001 From: Philippe Teuwen Date: Sat, 6 Jul 2019 10:06:04 +0200 Subject: [PATCH] Fix #216: skip --as-needed linker options under MacOSX --- client/Makefile | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/client/Makefile b/client/Makefile index 135b143e4..490716eda 100644 --- a/client/Makefile +++ b/client/Makefile @@ -31,7 +31,14 @@ platform = $(shell uname) VPATH = ../common ../zlib ../uart OBJDIR = obj -LDLIBS = -L/opt/local/lib -L/usr/local/lib -lreadline -lpthread -lm -Wl,--as-needed -latomic -Wl,--no-as-needed +LDLIBS = -L/opt/local/lib -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 +ifneq ($(platform),Darwin) + LDLIBS += -Wl,--as-needed -latomic -Wl,--no-as-needed +endif + LUALIB = ../liblua/liblua.a JANSSONLIBPATH = ./jansson JANSSONLIB = $(JANSSONLIBPATH)/libjansson.a