X-Git-Url: https://git.archive.openwrt.org/?p=project%2Fuci.git;a=blobdiff_plain;f=Makefile;h=edbdc4effcccc8e8bb42475432cbb818048b9c88;hp=db690e75a68fef38e645239273bdf2c57229cbf3;hb=8dd3eb50025224bd2aa286c0e5c27d230efb7bde;hpb=818f7b8433ae369c20fc56cccbb55b22043b9024 diff --git a/Makefile b/Makefile index db690e7..edbdc4e 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,9 @@ -VERSION=0.1 +VERSION=0.3 + +# optional features +PLUGIN_SUPPORT=1 +DEBUG=0 +DEBUG_TYPECAST=0 COPTS=-O2 WOPTS=-pedantic -Wno-unused -Werror @@ -11,9 +16,9 @@ CC=gcc LIBS=-lc RANLIB=ranlib -ifneq ($(DEBUG),) +ifeq ($(DEBUG),1) COPTS = -O0 - CFLAGS += -g3 -DDEBUG_ALL + CFLAGS += -g3 endif OS=$(shell uname) ifeq ($(OS),Darwin) @@ -27,11 +32,26 @@ else endif SHLIB_FILE=libuci.$(SHLIB_EXT).$(VERSION) -LIBUCI_DEPS=file.c history.c list.c util.c err.h uci.h +define add_feature + @echo "$(if $(findstring 1,$($(1))),#define UCI_$(1) 1,#undef UCI_$(1))" >> $@.tmp +endef + +LIBUCI_DEPS=file.c history.c list.c util.c uci.h uci_config.h uci_internal.h all: uci-static uci libuci.$(SHLIB_EXT) -cli.o: cli.c uci.h +cli.o: cli.c uci.h uci_config.h + +uci_config.h: FORCE + @rm -f "$@.tmp" + $(call add_feature,PLUGIN_SUPPORT) + $(call add_feature,DEBUG) + $(call add_feature,DEBUG_TYPECAST) + @if [ \! -f "$@" ] || ! cmp "$@.tmp" "$@" >/dev/null; then \ + mv "$@.tmp" "$@"; \ + else \ + rm -f "$@.tmp"; \ + fi uci: cli.o libuci.$(SHLIB_EXT) $(CC) -o $@ $< -L. -luci @@ -55,4 +75,7 @@ libuci.$(SHLIB_EXT): libuci-shared.o ln -sf $(SHLIB_FILE) $@ clean: - rm -f uci uci-static *.[oa] *.so* *.dylib* + rm -f uci uci-static *.[oa] *.so* *.dylib* uci_config.h + +FORCE: ; +.PHONY: FORCE