filetype: Set "groovy" for Jenkinsfile
[vis.git] / GNUmakefile
blob76821ad71a3d679aeb642a7adf81ac658c30a68d
1 include Makefile
3 LIBTERMKEY = libtermkey-0.22
4 LIBTERMKEY_SHA256 = 6945bd3c4aaa83da83d80a045c5563da4edd7d0374c62c0d35aec09eb3014600
6 LIBLUA = lua-5.3.4
7 LIBLUA_SHA256 = f681aa518233bc407e23acf0f5887c884f17436f000d453b2491a9f11a52400c
8 #LIBLUA = lua-5.2.4
9 #LIBLUA_SHA256 = b9e2e4aad6789b3b63a056d442f7b39f0ecfca3ae0f1fc0ae4e9614401b69f4b
10 #LIBLUA = lua-5.1.5
11 #LIBLUA_SHA256 = 2640fc56a795f29d28ef15e13c34a47e223960b0240e8cb0a82d9b0738695333
13 LIBLPEG = lpeg-1.0.2
14 LIBLPEG_SHA256 = 48d66576051b6c78388faad09b70493093264588fcd0f258ddaab1cdd4a15ffe
16 SRCDIR = $(realpath $(dir $(firstword $(MAKEFILE_LIST))))
18 DEPS_ROOT = $(SRCDIR)/dependency/install
19 DEPS_PREFIX = $(DEPS_ROOT)/usr
20 DEPS_BIN = $(DEPS_PREFIX)/bin
21 DEPS_LIB = $(DEPS_PREFIX)/lib
22 DEPS_INC = $(DEPS_PREFIX)/include
24 dependency/build:
25 mkdir -p "$@"
27 dependency/sources:
28 mkdir -p "$@"
30 # LIBTERMKEY
32 dependency/sources/libtermkey-%: | dependency/sources
33 wget -c -O $@.part http://www.leonerd.org.uk/code/libtermkey/$(LIBTERMKEY).tar.gz
34 mv $@.part $@
35 [ -z $(LIBTERMKEY_SHA256) ] || (echo '$(LIBTERMKEY_SHA256) $@' | sha256sum -c)
37 dependency/build/libtermkey-extract: dependency/sources/$(LIBTERMKEY).tar.gz | dependency/build
38 tar xzf $< -C $(dir $@)
39 touch $@
41 dependency/build/libtermkey-build: dependency/build/libtermkey-extract
42 # TODO no sane way to avoid pkg-config and specify LDFLAGS?
43 sed -i 's/LDFLAGS+=-lncurses$$/LDFLAGS+=-lncursesw/g' $(dir $<)/$(LIBTERMKEY)/Makefile
44 $(MAKE) -C $(dir $<)/$(LIBTERMKEY) PREFIX=/usr termkey.h libtermkey.la
45 touch $@
47 dependency/build/libtermkey-install: dependency/build/libtermkey-build
48 $(MAKE) -C $(dir $<)/$(LIBTERMKEY) PREFIX=/usr DESTDIR=$(DEPS_ROOT) install-inc install-lib
49 touch $@
51 # LIBLUA
53 dependency/sources/lua-%.tar.gz: | dependency/sources
54 wget -c -O $@.part http://www.lua.org/ftp/$(LIBLUA).tar.gz
55 mv $@.part $@
56 [ -z $(LIBLUA_SHA256) ] || (echo '$(LIBLUA_SHA256) $@' | sha256sum -c)
58 dependency/build/liblua-extract: dependency/sources/$(LIBLUA).tar.gz | dependency/build
59 tar xzf $< -C $(dir $@)
60 touch $@
62 dependency/build/liblua-build: dependency/build/liblua-extract
63 $(MAKE) -C $(dir $<)/$(LIBLUA)/src all CC=$(CC) MYCFLAGS="-DLUA_COMPAT_5_1 -DLUA_COMPAT_5_2 -DLUA_COMPAT_ALL -DLUA_USE_POSIX -DLUA_USE_DLOPEN -fPIC" MYLIBS="-Wl,-E -ldl -lm"
64 #$(MAKE) -C $(dir $<)/$(LIBLUA) posix CC=$(CC)
65 touch $@
67 dependency/build/liblua-install: dependency/build/liblua-build
68 $(MAKE) -C $(dir $<)/$(LIBLUA) INSTALL_TOP=$(DEPS_PREFIX) install
69 touch $@
71 # LIBLPEG
73 dependency/sources/lpeg-%: | dependency/sources
74 wget -c -O $@.part http://www.inf.puc-rio.br/~roberto/lpeg/$(LIBLPEG).tar.gz
75 mv $@.part $@
76 [ -z $(LIBLPEG_SHA256) ] || (echo '$(LIBLPEG_SHA256) $@' | sha256sum -c)
78 dependency/build/liblpeg-extract: dependency/sources/$(LIBLPEG).tar.gz | dependency/build
79 tar xzf $< -C $(dir $@)
80 touch $@
82 dependency/build/liblpeg-build: dependency/build/liblpeg-extract dependency/build/liblua-extract
83 # creating a shared object fails in Cygwin, we do not need it thus ignore the error
84 cd $(dir $<)/$(LIBLPEG) && $(MAKE) LUADIR="../$(LIBLUA)/src" || true
85 cd $(dir $<)/$(LIBLPEG) && ar rcu liblpeg.a lpvm.o lpcap.o lptree.o lpcode.o lpprint.o && ranlib liblpeg.a
86 touch $@
88 dependency/build/liblpeg-install: dependency/build/liblpeg-build
89 cd $(dir $<)/$(LIBLPEG) && cp liblpeg.a $(DEPS_LIB)
90 touch $@
92 dependency/build/local: dependency/build/libtermkey-install dependency/build/liblua-install dependency/build/liblpeg-install
93 touch $@
95 local: clean
96 ./configure --environment-only
97 $(MAKE) dependency/build/local
98 ./configure CFLAGS="-I$(DEPS_INC)" LDFLAGS="-L$(DEPS_LIB)" LD_LIBRARY_PATH="$(DEPS_LIB)"
99 $(MAKE)
100 @echo Run with: LD_LIBRARY_PATH=$(DEPS_LIB) ./vis
102 .PHONY: local