From 34e60841a44ee688792e87863aa67db469d39fa8 Mon Sep 17 00:00:00 2001 From: Trygve Laugstøl Date: Tue, 22 Oct 2013 20:40:50 +0200 Subject: wip --- Makefile | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 Makefile (limited to 'Makefile') diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..49538be --- /dev/null +++ b/Makefile @@ -0,0 +1,41 @@ +all: test docs + +BINS=$(wildcard bin/*) $(wildcard libexec/*) + +BATS=$(sort $(patsubst test/%,%,$(filter-out test/X-%,$(wildcard test/*.bats)))) +TESTS=$(addprefix test-,$(BATS)) + +test-%: + @echo === $@ + @bats $(patsubst test-%,test/%,$@) + +show-tests: + @echo BATS=$(BATS) + @echo TESTS=$(TESTS) + @echo $(addprefix set_header-,$(BINS)) + +test: $(TESTS) +.PHONY: test + +docs: + @make -C docs +.PHONY: docs + +define set_header +set_header-$(1): + @count=`wc -l $(2)|cut -f 1 -d ' '`; \ + cat $(2) > x; \ + echo "# HEADER END" >> x; \ + sed '1,/HEADER END/d' $(1) >> x; \ + if [ `md5sum $(1)|cut -f 1 -d ' '` != `md5sum x|cut -f 1 -d ' '` ]; then echo Updated: $(1); cp x $(1); fi; \ + rm x +endef + $(wildcard hooks/*) + +$(foreach f,$(BINS),$(eval $(call set_header,$(f),lib/header))) +set-headers: set-hook-headers $(addprefix set_header-,$(BINS)) + +$(foreach f,$(wildcard hooks/*),$(eval $(call set_header,$(f),lib/hook-header))) +set-headers: $(addprefix set_header-,$(BINS)) + +.PHONY: set-headers -- cgit v1.2.3