Squashed commit of the following:
[project/luci.git] / contrib / luaposix / Makefile
1 include ../../build/config.mk
2
3 LUAPOSIX_VERSION = 5.1.2
4 LUAPOSIX_SITE = http://luaforge.net/frs/download.php/3063/
5 LUAPOSIX_DIR = luaposix-$(LUAPOSIX_VERSION)
6 LUAPOSIX_FILE = $(LUAPOSIX_DIR).tar.gz
7 LUAPOSIX_URL = $(LUAPOSIX_SITE)/$(LUAPOSIX_FILE)
8 LUAPOSIX_PATCHDIR = patches
9
10 all: compile
11
12 $(LUAPOSIX_FILE):
13 wget -O $@ $(LUAPOSIX_URL) || rm -f $@
14
15 $(LUAPOSIX_PATCHDIR)/series:
16 (cd $(LUAPOSIX_PATCHDIR); ls *.patch | sort > series)
17
18 $(LUAPOSIX_DIR)/.prepared: $(LUAPOSIX_FILE)
19 rm -rf $(LUAPOSIX_DIR)
20 tar xvfz $(LUAPOSIX_FILE)
21 ln -s ../$(LUAPOSIX_PATCHDIR) $(LUAPOSIX_DIR)/patches
22 touch $@
23
24 $(LUAPOSIX_DIR)/.patched: $(LUAPOSIX_DIR)/.prepared $(LUAPOSIX_PATCHDIR)/series
25 (cd $(LUAPOSIX_DIR); \
26 if [ -x "$$(which quilt 2>/dev/null)" ]; then \
27 quilt push -a; \
28 else \
29 cat patches/*.patch | patch -p1; \
30 fi; \
31 )
32 touch $@
33
34 compile: $(LUAPOSIX_DIR)/.patched
35 $(MAKE) -C $(LUAPOSIX_DIR) CC=$(CC) CFLAGS="$(CFLAGS)" OS="$(OS)"
36 mkdir -p dist/usr/lib/lua
37 cp $(LUAPOSIX_DIR)/posix.so dist/usr/lib/lua/
38
39 compile-all: compile
40
41 clean:
42 rm -rf $(LUAPOSIX_DIR) $(LUAPOSIX_FILE)
43 rm -f $(LUAPOSIX_PATCHDIR)/series