diff options
author | Felix Fietkau <nbd@openwrt.org> | 2008-08-31 18:46:31 +0200 |
---|---|---|
committer | Felix Fietkau <nbd@openwrt.org> | 2008-08-31 18:46:31 +0200 |
commit | c7430fd3578af03d9fe998f3195756603295ce2f (patch) | |
tree | 1f0e481644e82dfa7bbab2d401fcb01c4f14b6f1 | |
parent | 213d8d8934f797849eb80b7ac06b6d37f3090e40 (diff) | |
download | uci-c7430fd3578af03d9fe998f3195756603295ce2f.tar.gz |
properly search for lua includes and the library directory
-rw-r--r-- | lua/Makefile | 25 |
1 files changed, 20 insertions, 5 deletions
diff --git a/lua/Makefile b/lua/Makefile index 2861d21..7dbe696 100644 --- a/lua/Makefile +++ b/lua/Makefile @@ -1,10 +1,25 @@ include ../Makefile.inc -prefix=/usr/local -libdir=$(prefix)/lib -luadir=$(libdir)/lua/5.1 +LUA_VERSION=5.1 +PREFIX_SEARCH=/usr /usr/local /opt/local +LUA_PLUGINDIR=$(firstword \ + $(foreach ldir,$(subst ;, ,$(shell lua -e 'print(package.cpath)')), \ + $(if $(findstring lib/lua/,$(ldir)),$(patsubst %/?.so,%,$(ldir))) \ + ) \ +) -CPPFLAGS=-I.. $(shell pkg-config --silence-errors --cflags lua5.1) -LIBS=-L.. -luci $(shell pkg-config --silence-errors --libs lua5.1) +# find lua prefix +LUA_PREFIX=$(firstword \ + $(foreach prefix,$(PREFIX_SEARCH),\ + $(if $(wildcard $(prefix)/include/lua.h),$(prefix)) \ + ) \ +) + +libdir=$(prefix)/libs +luadir=$(if $(LUA_PLUGINDIR),$(LUA_PLUGINDIR),$(libdir)/lua/$(LUA_VERSION)) +luainc=$(shell pkg-config --silence-errors --cflags lua$(LUA_VERSION)) + +CPPFLAGS=-I.. -I$(if $(luainc),$(luainc),$(LUA_PREFIX)/include) +LIBS=-L.. -luci $(shell pkg-config --silence-errors --libs lua$(LUA_VERSION)) PLUGIN_LD=$(CC) ifeq ($(OS),Darwin) |