File: Makefile

package info (click to toggle)
adr-tools 3.0.0-2
  • links: PTS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 840 kB
  • sloc: sh: 580; makefile: 42
file content (35 lines) | stat: -rw-r--r-- 871 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35

TESTS:=$(wildcard tests/*.sh)
SRC:=$(wildcard src/*)

# Run tests outside the project directory so that they cannot interfere with the project's
# own ADR directory
BUILDDIR:=/tmp/adr-tools-build

check: $(TESTS:tests/%.sh=$(BUILDDIR)/tests/%.diff)
	@echo SUCCESS

$(BUILDDIR)/tests/%.diff: $(BUILDDIR)/tests/%.output tests/%.expected
	@diff --side-by-side $^ > $@ || ! cat $@

$(BUILDDIR)/tests/%.output: tests/%.sh tests/%.expected $(SRC)
	@echo TEST: $*
	@rm -rf $(dir $@)/$*
	@mkdir -p $(dir $@)/$*
	@(cd $(dir $@)/$* && \
	  PATH=$(PATH):/usr/libexec/adr-tools:$(abspath tests) \
	  ADR_DATE=1992-01-12 \
	  VISUAL= \
	  EDITOR= \
	  PS4='+ ' \
	    /bin/sh -v $(abspath $<) > $(abspath $@) 2>&1) || ! cat $@

clean:
	rm -rf /tmp/adr-tools-build

show-%:
	@echo "$* ($(flavor $*)) = $($*)"

.PHONY: all clean
.PRECIOUS: $(BUILDDIR)/tests/%.output
.DELETE_ON_ERROR: