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
--- /dev/null
+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
+
-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