22
33CC = gcc
44LDFLAGS ?= $(if $(ISDARWIN ) , -bundle -undefined dynamic_lookup, -shared)
5- XLDFLAGS += -Wl,--no-as-needed
5+ XLDFLAGS += $(if $(ISUBUNTU ) , $(NOASNEEDED ) )
6+ NOASNEEDED = -Wl,--no-as-needed
67PKGCONFIG ?= pkg-config --silence-errors 2>/dev/null
78EQUAL = $(and $(findstring $(1 ) ,$(2 ) ) ,$(findstring $(2 ) ,$(1 ) ) )
89MKDIR ?= mkdir -p
@@ -14,7 +15,11 @@ LUA_FOUND = $(firstword $(shell which $(_LUA_PC) $(LUA_NAMES) 2>/dev/null))
1415LUA ?= $(or $(LUA_FOUND ) , $(error No Lua interpreter found) )
1516PC_EXISTS = $(shell $(PKGCONFIG ) --exists '$(1 ) ' && echo 1)
1617USE_IF = $(if $(call $(1 ) , $(2 ) $(3 ) ) , $(2 ) )
17- ISDARWIN = $(call EQUAL, $(shell uname) , Darwin)
18+ UNAME = $(shell uname)
19+ RELEASEID = $(shell awk '/^ID=/ {print substr($$0, 4) }' /etc/os-release)
20+ ISDARWIN = $(call EQUAL, $(UNAME ) , Darwin)
21+ ISLINUX = $(call EQUAL, $(UNAME ) , Linux)
22+ ISUBUNTU = $(and $(ISLINUX ) , $(call EQUAL, $(RELEASEID ) , ubuntu) )
1823
1924CCOPTIONS = $(XCFLAGS ) $(CPPFLAGS ) $(CFLAGS )
2025LDOPTIONS = $(XLDFLAGS ) $(LDFLAGS ) $(LDLIBS )
0 commit comments