Skip to content

Commit

Permalink
Only add "-Wl,--no-as-needed" to XLDFLAGS if building on Ubuntu
Browse files Browse the repository at this point in the history
  • Loading branch information
craigbarnes committed Nov 26, 2014
1 parent 5c77759 commit 2d5473c
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions lualib.mk
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

CC = gcc
LDFLAGS ?= $(if $(ISDARWIN), -bundle -undefined dynamic_lookup, -shared)
XLDFLAGS += -Wl,--no-as-needed
XLDFLAGS += $(if $(ISUBUNTU), $(NOASNEEDED))
NOASNEEDED = -Wl,--no-as-needed
PKGCONFIG ?= pkg-config --silence-errors 2>/dev/null
EQUAL = $(and $(findstring $(1),$(2)),$(findstring $(2),$(1)))
MKDIR ?= mkdir -p
Expand All @@ -14,7 +15,11 @@ LUA_FOUND = $(firstword $(shell which $(_LUA_PC) $(LUA_NAMES) 2>/dev/null))
LUA ?= $(or $(LUA_FOUND), $(error No Lua interpreter found))
PC_EXISTS = $(shell $(PKGCONFIG) --exists '$(1)' && echo 1)
USE_IF = $(if $(call $(1), $(2) $(3)), $(2))
ISDARWIN = $(call EQUAL, $(shell uname), Darwin)
UNAME = $(shell uname)
RELEASEID = $(shell awk '/^ID=/ {print substr($$0, 4)}' /etc/os-release)
ISDARWIN = $(call EQUAL, $(UNAME), Darwin)
ISLINUX = $(call EQUAL, $(UNAME), Linux)
ISUBUNTU = $(and $(ISLINUX), $(call EQUAL, $(RELEASEID), ubuntu))

CCOPTIONS = $(XCFLAGS) $(CPPFLAGS) $(CFLAGS)
LDOPTIONS = $(XLDFLAGS) $(LDFLAGS) $(LDLIBS)
Expand Down

0 comments on commit 2d5473c

Please sign in to comment.