aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc André Tanner <mat@brain-dump.org>2015-10-27 20:19:46 +0100
committerMarc André Tanner <mat@brain-dump.org>2015-10-29 13:35:45 +0100
commit3cbea071e181cd3fa1bd77be0ec586cf41735e60 (patch)
tree6220fb387176cdfe4befa256874db7fad6eb3767
parent1190302c13f2eac4ab9e9144c3980cb216879bb0 (diff)
downloadvis-3cbea071e181cd3fa1bd77be0ec586cf41735e60.tar.gz
vis-3cbea071e181cd3fa1bd77be0ec586cf41735e60.tar.xz
build: introduce make local Makefile target
This merges parts of the build system overhaul found in the lua branch.
-rw-r--r--.travis.yml10
-rw-r--r--Makefile43
2 files changed, 44 insertions, 9 deletions
diff --git a/.travis.yml b/.travis.yml
index bcfd5a3..d211d66 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -2,10 +2,6 @@ language: c
compiler:
- gcc
env:
- - DEBUG=
- - DEBUG=debug
-install:
- - export LIBTERMKEY=libtermkey-0.17 &&
- curl http://www.leonerd.org.uk/code/libtermkey/$LIBTERMKEY.tar.gz | tar xzf - &&
- make -C $LIBTERMKEY && make -C $LIBTERMKEY PREFIX=$(pwd)/build install
-script: CFLAGS=-I./build/include LDFLAGS=-L./build/lib make $DEBUG
+ - TARGET=
+ - TARGET=debug
+script: make local $TARGET
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