]> pilppa.com Git - uci.git/commitdiff
build variable sharing between uci and uci-lua, proper installation for lua plugin
authorFelix Fietkau <nbd@openwrt.org>
Sun, 13 Apr 2008 13:28:29 +0000 (15:28 +0200)
committerFelix Fietkau <nbd@openwrt.org>
Sun, 13 Apr 2008 13:28:29 +0000 (15:28 +0200)
Makefile
Makefile.inc [new file with mode: 0644]
lua/Makefile

index 421c2d9c27f7141015c205e860f6e83eadd28f5a..34b8fb554572ec76e66efb2181e0795b5dcf86b7 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -5,35 +5,9 @@ PLUGIN_SUPPORT=1
 DEBUG=0
 DEBUG_TYPECAST=0
 
-prefix=/usr
-DESTDIR=
+include Makefile.inc
 
-COPTS=-O2
-WOPTS=-pedantic -Wno-unused -Werror
-FPIC=-fPIC
-CFLAGS=$(COPTS) $(WOPTS) -Wall -std=gnu99
-
-AR=ar
-LD=ld
-CC=gcc
 LIBS=-lc
-RANLIB=ranlib
-INSTALL=install
-
-ifeq ($(DEBUG),1)
-  COPTS = -O0
-  CFLAGS += -g3
-endif
-OS=$(shell uname)
-ifeq ($(OS),Darwin)
-  LINK=$(LD)
-  SHLIB_EXT=dylib
-  SHLIB_FLAGS=-dylib
-else
-  LINK=$(CC)
-  SHLIB_EXT=so
-  SHLIB_FLAGS=-shared -Wl,-soname,$(SHLIB_FILE)
-endif
 SHLIB_FILE=libuci.$(SHLIB_EXT).$(VERSION)
 
 define add_feature
diff --git a/Makefile.inc b/Makefile.inc
new file mode 100644 (file)
index 0000000..2578c72
--- /dev/null
@@ -0,0 +1,29 @@
+prefix=/usr
+DESTDIR=
+
+COPTS=-O2
+WOPTS=-pedantic -Werror -Wall
+FPIC=-fPIC
+CFLAGS=$(COPTS) $(WOPTS) -std=gnu99
+
+AR=ar
+LD=ld
+CC=gcc
+RANLIB=ranlib
+INSTALL=install
+
+ifeq ($(DEBUG),1)
+  COPTS = -O0
+  CFLAGS += -g3
+endif
+OS=$(shell uname)
+ifeq ($(OS),Darwin)
+  LINK=$(LD)
+  SHLIB_EXT=dylib
+  SHLIB_FLAGS=-dylib
+else
+  LINK=$(CC)
+  SHLIB_EXT=so
+  SHLIB_FLAGS=-shared -Wl,-soname,$(SHLIB_FILE)
+endif
+
index 29d7fbd02bb53bd5b48a8c859e022ed35684f506..9cc6c397696aa10452cc75a0ff41e07ebeac3576 100644 (file)
@@ -1,27 +1,26 @@
-CC=gcc
-LD=ld
-CFLAGS=-O2 -Wall -Werror -pedantic --std=gnu99 -Wno-unused
+include ../Makefile.inc
+
 CPPFLAGS=-I..
 LIBS=-L.. -luci
-OS=$(shell uname)
-LINK=$(CC)
+
+PLUGIN_LD=$(CC)
 ifeq ($(OS),Darwin)
-  SHLIB_FLAGS=-bundle -undefined dynamic_lookup
+  PLUGIN_LDFLAGS=-bundle -undefined dynamic_lookup
 else
-  SHLIB_FLAGS=-shared -Wl,-soname,$(SHLIB_FILE)
+  PLUGIN_LDFLAGS=-shared -Wl,-soname,$(SHLIB_FILE)
 endif
 
 all: uci.so
 
 uci.so: uci.o
-       $(LINK) $(SHLIB_FLAGS) -o $@ $^ $(LIBS)
+       $(PLUGIN_LD) $(PLUGIN_LDFLAGS) -o $@ $^ $(LIBS)
 
 %.o: %.c
        $(CC) $(CPPFLAGS) $(CFLAGS) -c -o $@ $<
 
 install:
-       mkdir -p $(DESTDIR)/usr/lib/lua
-       install -m0644 uci.so $(DESTDIR)/usr/lib/lua/
+       mkdir -p $(DESTDIR)$(prefix)/lib/lua/5.1
+       $(INSTALL) -m0644 uci.so $(DESTDIR)$(prefix)/lib/lua/5.1/
 
 clean:
        rm -f *.so *.o uci.so