Auto-detect platform in makefiles and test runner
Use uname -s to select Linux vs macOS build flags instead of hardcoding. Add -undefined dynamic_lookup for test shared libs on macOS. Set _port=true automatically on non-Linux in ./all.
This commit is contained in:
14
makefile
14
makefile
@@ -71,9 +71,18 @@ LOCAL = $(TESTS) $(CWARNS)
|
||||
# To enable Linux goodies, -DLUA_USE_LINUX
|
||||
# For C89, "-std=c89 -DLUA_USE_C89"
|
||||
# Note that Linux/Posix options are not compatible with C89
|
||||
#
|
||||
# Platform detection
|
||||
UNAME= $(shell uname -s)
|
||||
ifeq ($(UNAME),Darwin)
|
||||
MYCFLAGS= $(LOCAL) -std=c99 -DLUA_USE_MACOSX
|
||||
MYLDFLAGS=
|
||||
MYLIBS=
|
||||
else
|
||||
MYCFLAGS= $(LOCAL) -std=c99 -DLUA_USE_LINUX
|
||||
MYLDFLAGS= -Wl,-E
|
||||
MYLIBS= -ldl
|
||||
endif
|
||||
|
||||
|
||||
CC= gcc
|
||||
@@ -95,7 +104,7 @@ CORE_O= lapi.o lcode.o lctype.o ldebug.o ldo.o ldump.o lfunc.o lgc.o llex.o \
|
||||
ltm.o lundump.o lvm.o lzio.o ltests.o
|
||||
AUX_O= lauxlib.o
|
||||
LIB_O= lbaselib.o ldblib.o liolib.o lmathlib.o loslib.o ltablib.o lstrlib.o \
|
||||
lutf8lib.o loadlib.o lcorolib.o linit.o
|
||||
lutf8lib.o loadlib.o lcorolib.o lcmd.o linit.o
|
||||
|
||||
LUA_T= lua
|
||||
LUA_O= lua.o
|
||||
@@ -148,6 +157,7 @@ lapi.o: lapi.c lprefix.h lua.h luaconf.h lapi.h llimits.h lstate.h \
|
||||
lauxlib.o: lauxlib.c lprefix.h lua.h luaconf.h lauxlib.h llimits.h
|
||||
lbaselib.o: lbaselib.c lprefix.h lua.h luaconf.h lauxlib.h lualib.h \
|
||||
llimits.h
|
||||
lcmd.o: lcmd.c lprefix.h lua.h luaconf.h lauxlib.h lcmd.h
|
||||
lcode.o: lcode.c lprefix.h lua.h luaconf.h lcode.h llex.h lobject.h \
|
||||
llimits.h lzio.h lmem.h lopcodes.h lparser.h ldebug.h lstate.h ltm.h \
|
||||
ldo.h lgc.h lstring.h ltable.h lvm.h lopnames.h
|
||||
@@ -167,7 +177,7 @@ lfunc.o: lfunc.c lprefix.h lua.h luaconf.h ldebug.h lstate.h lobject.h \
|
||||
llimits.h ltm.h lzio.h lmem.h ldo.h lfunc.h lgc.h
|
||||
lgc.o: lgc.c lprefix.h lua.h luaconf.h ldebug.h lstate.h lobject.h \
|
||||
llimits.h ltm.h lzio.h lmem.h ldo.h lfunc.h lgc.h lstring.h ltable.h
|
||||
linit.o: linit.c lprefix.h lua.h luaconf.h lualib.h lauxlib.h llimits.h
|
||||
linit.o: linit.c lprefix.h lua.h luaconf.h lualib.h lauxlib.h llimits.h lcmd.h
|
||||
liolib.o: liolib.c lprefix.h lua.h luaconf.h lauxlib.h lualib.h llimits.h
|
||||
llex.o: llex.c lprefix.h lua.h luaconf.h lctype.h llimits.h ldebug.h \
|
||||
lstate.h lobject.h ltm.h lzio.h lmem.h ldo.h lgc.h llex.h lparser.h \
|
||||
|
||||
Reference in New Issue
Block a user