2018-02-09 02:13:07 -08:00
|
|
|
# makefile for immutable table library for Lua
|
2018-02-09 03:45:17 -08:00
|
|
|
# usage: make LUA=/path/to/lua
|
2018-02-09 02:13:07 -08:00
|
|
|
|
|
|
|
LUAINC= $(LUA)/src
|
|
|
|
LUALIB= $(LUA)/src
|
|
|
|
LUABIN= $(LUA)/src
|
2018-02-09 05:22:27 -08:00
|
|
|
LUASUFFIX= ""
|
2018-02-09 02:13:07 -08:00
|
|
|
|
|
|
|
# these will probably work if Lua has been installed globally
|
|
|
|
#LUA= /usr/local
|
|
|
|
#LUAINC= $(LUA)/include
|
|
|
|
#LUALIB= $(LUA)/lib
|
|
|
|
#LUABIN= $(LUA)/bin
|
|
|
|
|
|
|
|
# probably no need to change anything below here
|
|
|
|
CC= gcc
|
|
|
|
CFLAGS= $(INCS) $(WARN) -O2 $G
|
2018-02-09 05:22:27 -08:00
|
|
|
WARN= -std=c11 -pedantic -Wall -Wextra
|
2018-02-09 02:13:07 -08:00
|
|
|
INCS= -I$(LUAINC)
|
|
|
|
#MAKESO= $(CC) -shared
|
|
|
|
MAKESO= $(CC) -bundle -undefined dynamic_lookup
|
|
|
|
|
|
|
|
MYNAME= immutable
|
|
|
|
MYLIB= l$(MYNAME)
|
|
|
|
T= $(MYNAME).so
|
|
|
|
OBJS= $(MYLIB).o
|
|
|
|
TEST= test.lua
|
|
|
|
|
|
|
|
all: test
|
|
|
|
|
|
|
|
test: $T
|
2018-02-09 05:22:27 -08:00
|
|
|
$(LUABIN)/lua$(LUASUFFIX) $(TEST)
|
2018-02-09 02:13:07 -08:00
|
|
|
|
|
|
|
o: $(MYLIB).o
|
|
|
|
|
|
|
|
so: $T
|
|
|
|
|
|
|
|
$T: $(OBJS)
|
|
|
|
$(MAKESO) -o $@ $(OBJS)
|
|
|
|
|
2018-02-09 03:45:17 -08:00
|
|
|
$(OBJS): check-lua limmutable.c
|
2018-02-09 02:13:07 -08:00
|
|
|
|
|
|
|
clean:
|
2018-02-09 03:45:17 -08:00
|
|
|
rm -f $(OBJS) $T lua_path core core.*
|
2018-02-09 02:13:07 -08:00
|
|
|
|
|
|
|
doc:
|
|
|
|
@echo "$(MYNAME) library:"
|
|
|
|
@fgrep '/**' $(MYLIB).c | cut -f2 -d/ | tr -d '*' | sort | column
|
|
|
|
|
2018-02-09 03:45:17 -08:00
|
|
|
check-lua:
|
|
|
|
@if [ "$(LUA)" = "" ]; then \
|
|
|
|
echo "usage: make LUA=/path/to/lua"; \
|
|
|
|
exit 1; \
|
|
|
|
fi
|
|
|
|
|
2018-02-09 02:13:07 -08:00
|
|
|
# eof
|