Updated UCI in contrib
[project/luci.git] / contrib / uci / Makefile
1 include ../../build/config.mk
2 include ../../build/gccconfig.mk
3
4 UCI_VERSION  = 0.6.0
5 UCI_APPEND   = +luci1
6 #UCI_SITE    = http://mirror2.openwrt.org/sources
7 #UCI_DIR     = uci-$(UCI_VERSION)
8 #UCI_FILE    = $(UCI_DIR).tar.gz
9 #UCI_URL     = $(UCI_SITE)/$(UCI_FILE)
10 UCI_GITREV   = 12c5b22102873e303e540f886489831461d54ea9
11 UCI_SITE     = http://nbd.name
12 UCI_DIR      = uci.git
13 UCI_FILE     = uci-$(UCI_VERSION)$(UCI_APPEND).tar.gz
14 UCI_URL      = $(UCI_SITE)/gitweb.cgi?p=uci.git;a=snapshot;h=$(UCI_GITREV)
15 UCI_PATCHDIR = patches
16
17 all: compile
18
19 include ../../build/module.mk
20
21 $(UCI_FILE):
22         wget -O $@ "$(UCI_URL)" || rm -f $@
23
24 $(UCI_PATCHDIR)/series:
25         (cd $(UCI_PATCHDIR); ls *.patch | sort > series)
26
27 $(UCI_DIR)/.prepared: $(UCI_FILE)
28         rm -rf $(UCI_DIR)
29         tar xvfz $(UCI_FILE)
30         ln -s ../$(UCI_PATCHDIR) $(UCI_DIR)/patches
31         touch $@
32
33 $(UCI_DIR)/.patched: $(UCI_DIR)/.prepared $(UCI_PATCHDIR)/series
34         (cd $(UCI_DIR); \
35                 if [ -x "$$(which quilt 2>/dev/null)" ]; then \
36                         quilt push -a; \
37                 else \
38                         cat patches/*.patch | patch -p1; \
39                 fi; \
40         )
41         touch $@
42
43 refresh: $(UCI_DIR)/.patched
44         (cd $(UCI_DIR); \
45                 for i in $$(quilt series); do \
46                         quilt refresh $$i; \
47                 done; \
48         )
49
50 compile: $(UCI_DIR)/.patched
51         $(MAKE) -C $(UCI_DIR) CC=$(CC) CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" OS="$(OS)"
52         mkdir -p dist/usr/lib dist/usr/bin
53         $(MAKE) -C $(UCI_DIR) install DESTDIR=../dist prefix=/usr
54         $(MAKE) -C $(UCI_DIR)/lua CC=$(CC) CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" OS="$(OS)"
55         $(MAKE) -C $(UCI_DIR)/lua install DESTDIR=../../dist luadir=$(LUA_LIBRARYDIR)
56
57
58 compile-all: compile
59
60 clean:
61         rm -rf $(UCI_DIR) $(UCI_FILE)