diff options
author | Trygve Laugstøl <trygvis@inamo.no> | 2013-10-22 20:40:50 +0200 |
---|---|---|
committer | Trygve Laugstøl <trygvis@inamo.no> | 2013-10-22 20:40:50 +0200 |
commit | 34e60841a44ee688792e87863aa67db469d39fa8 (patch) | |
tree | d4ec57728121d87b029d8b729c98494356015061 /Makefile | |
parent | 4452df33f080c314f9b4c6a6504f254edc500282 (diff) | |
download | appstore-34e60841a44ee688792e87863aa67db469d39fa8.tar.gz appstore-34e60841a44ee688792e87863aa67db469d39fa8.tar.bz2 appstore-34e60841a44ee688792e87863aa67db469d39fa8.tar.xz appstore-34e60841a44ee688792e87863aa67db469d39fa8.zip |
wip
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 41 |
1 files changed, 41 insertions, 0 deletions
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 |