fix lua plugin linking
[project/uci.git] / lua / Makefile
1 include ../Makefile.inc
2
3 CPPFLAGS=-I.. $(shell pkg-config --silence-errors --cflags lua5.1)
4 LIBS=-L.. -luci $(shell pkg-config --silence-errors --libs lua5.1)
5
6 PLUGIN_LD=$(CC)
7 ifeq ($(OS),Darwin)
8 PLUGIN_LDFLAGS=-bundle -undefined dynamic_lookup
9 else
10 PLUGIN_LDFLAGS=-shared -Wl,-soname,$(SHLIB_FILE)
11 endif
12
13 all: uci.so
14
15 uci.so: uci.o
16 $(PLUGIN_LD) $(PLUGIN_LDFLAGS) -o $@ $^ $(LIBS)
17
18 %.o: %.c
19 $(CC) $(CPPFLAGS) $(CFLAGS) $(FPIC) -c -o $@ $<
20
21 install:
22 mkdir -p $(DESTDIR)$(prefix)/lib/lua/5.1
23 $(INSTALL) -m0644 uci.so $(DESTDIR)$(prefix)/lib/lua/5.1/
24
25 clean:
26 rm -f *.so *.o uci.so