Cleaned up makefile.

This commit is contained in:
Bruce Hill 2018-02-11 14:11:11 -08:00
parent 95306419d7
commit 139e214b1f

View File

@ -1,22 +1,14 @@
# makefile for immutable table library for Lua # makefile for immutable table library for Lua
# usage: make LUA=/path/to/lua
LUAINC= $(LUA)/src LUA_DIR=/opt/local
LUALIB= $(LUA)/src LUA_INC= $(LUA_DIR)/include
LUABIN= $(LUA)/src LUA_BIN= $(LUA_DIR)/bin
LUASUFFIX= LUA= lua
# 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 CC= gcc
CFLAGS= $(INCS) $(WARN) -O2 $G CFLAGS= $(INCS) $(WARN) -O2 $G
WARN= -std=c11 -pedantic -Wall -Wextra WARN= -std=c11 -pedantic -Wall -Wextra
INCS= -I$(LUAINC) INCS= -I$(LUA_INC)
#MAKESO= $(CC) -shared #MAKESO= $(CC) -shared
MAKESO= $(CC) -bundle -undefined dynamic_lookup MAKESO= $(CC) -bundle -undefined dynamic_lookup
@ -29,7 +21,7 @@ TEST= tests.lua
all: $T all: $T
test: $T test: $T
$(LUABIN)/lua$(LUASUFFIX) $(TEST) $(LUA_BIN)/$(LUA) $(TEST)
o: $(MYLIB).o o: $(MYLIB).o
@ -38,19 +30,9 @@ so: $T
$T: $(OBJS) $T: $(OBJS)
$(MAKESO) -o $@ $(OBJS) $(MAKESO) -o $@ $(OBJS)
$(OBJS): check-lua limmutable.c $(OBJS): limmutable.c
clean: clean:
rm -f $(OBJS) $T lua_path core core.* rm -f $(OBJS) $T
doc:
@echo "$(MYNAME) library:"
@fgrep '/**' $(MYLIB).c | cut -f2 -d/ | tr -d '*' | sort | column
check-lua:
@if [ "$(LUA)" = "" ]; then \
echo "usage: make LUA=/path/to/lua"; \
exit 1; \
fi
# eof # eof