aboutsummaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile43
1 files changed, 41 insertions, 2 deletions
diff --git a/Makefile b/Makefile
index 142ec01..8c1aca7 100644
--- a/Makefile
+++ b/Makefile
@@ -1,6 +1,17 @@
include config.mk
-ALL = *.c *.h config.mk Makefile LICENSE README vis.1
+SRCDIR = $(realpath $(dir $(firstword $(MAKEFILE_LIST))))
+
+ALL = *.c *.h config.mk Makefile LICENSE README.md vis.1
+
+DEPS_ROOT = $(SRCDIR)/dependency/install
+DEPS_PREFIX = $(DEPS_ROOT)/usr
+DEPS_BIN = $(DEPS_PREFIX)/bin
+DEPS_LIB = $(DEPS_PREFIX)/lib
+DEPS_INC = $(DEPS_PREFIX)/include
+
+LIBTERMKEY = libtermkey-0.18
+LIBTERMKEY_SHA1 = 0a78ba7aaa2f3b53f2273268366fef349c9be4ab
all: vis
@@ -53,4 +64,32 @@ uninstall:
release:
@git archive --prefix=vis-$(RELEASE)/ -o vis-$(RELEASE).tar.gz $(RELEASE)
-.PHONY: all clean dist install uninstall debug
+dependency/sources:
+ mkdir -p $@
+
+dependency/sources/libtermkey-%: | dependency/sources
+ wget -c -O $@.part http://www.leonerd.org.uk/code/libtermkey/$(LIBTERMKEY).tar.gz
+ mv $@.part $@
+ [ -z $(LIBTERMKEY_SHA1) ] || (echo '$(LIBTERMKEY_SHA1) $@' | sha1sum -c)
+
+dependency/sources/extract-libtermkey: dependency/sources/$(LIBTERMKEY).tar.gz
+ tar xzf $< -C $(dir $<)
+ touch $@
+
+dependency/sources/build-libtermkey: dependency/sources/extract-libtermkey
+ # TODO no sane way to avoid pkg-config and specify LDFLAGS?
+ sed -i 's/LDFLAGS+=-lncurses$$/LDFLAGS+=-lncursesw/g' $(dir $<)/$(LIBTERMKEY)/Makefile
+ make -C $(dir $<)/$(LIBTERMKEY) PREFIX=$(DEPS_PREFIX) termkey.h libtermkey.la
+ touch $@
+
+dependency/sources/install-libtermkey: dependency/sources/build-libtermkey
+ make -C $(dir $<)/$(LIBTERMKEY) PREFIX=$(DEPS_PREFIX) install
+ touch $@
+
+dependencies: dependency/sources/install-libtermkey
+
+local: dependencies
+ CFLAGS="$(CFLAGS) -I$(DEPS_INC)" LDFLAGS="$(LDFLAGS) -L$(DEPS_LIB)" make CFLAGS_TERMKEY= LDFLAGS_TERMKEY=-ltermkey
+ @echo Run with: LD_LIBRARY_PATH=$(DEPS_LIB) ./vis
+
+.PHONY: all clean dist install uninstall debug profile dependencies local