1 include ../Makefile.inc
3 PREFIX_SEARCH=/usr /usr/local /opt/local
4 LUA_PLUGINDIR=$(firstword \
5 $(foreach ldir,$(subst ;, ,$(shell lua -e 'print(package.cpath)')), \
6 $(if $(findstring lib/lua/,$(ldir)),$(patsubst %/?.so,%,$(ldir))) \
11 LUA_PREFIX=$(firstword \
12 $(foreach prefix,$(PREFIX_SEARCH),\
13 $(if $(wildcard $(prefix)/include/lua.h),$(prefix)) \
18 luadir=$(if $(LUA_PLUGINDIR),$(LUA_PLUGINDIR),$(libdir)/lua/$(LUA_VERSION))
19 luainc=$(shell pkg-config --silence-errors --cflags lua$(LUA_VERSION))
21 CPPFLAGS=-I.. $(if $(luainc),$(luainc), -I$(LUA_PREFIX)/include)
22 LIBS=-L.. -luci $(shell pkg-config --silence-errors --libs lua$(LUA_VERSION))
26 PLUGIN_LDFLAGS=-bundle -undefined dynamic_lookup
28 PLUGIN_LDFLAGS=-shared -Wl,-soname,$(SHLIB_FILE)
34 $(PLUGIN_LD) $(PLUGIN_LDFLAGS) -o $@ $^ $(LIBS)
37 $(CC) $(CPPFLAGS) $(CFLAGS) $(FPIC) -c -o $@ $<
40 mkdir -p $(DESTDIR)$(luadir)
41 $(INSTALL) -m0644 uci.so $(DESTDIR)$(luadir)/