-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
41 lines (36 loc) · 1.04 KB
/
Makefile
File metadata and controls
41 lines (36 loc) · 1.04 KB
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
36
37
38
39
40
41
needvars =
#_# help
#_# Display this helpful message
#_#
help: .PHONY
@seen=; for m in $(MAKEFILE_LIST) $(.MAKE.MAKEFILES); do \
case "$$m" in (/usr/share/mk/*) continue;; esac; \
case " $$seen " in (*" $$m "*) continue;; esac; \
echo "$$m:" && \
sed -n 's/^#_#/ /p' "$$m"; \
seen="$$seen $$m"; \
done
#_# needvar.X
#_# Check whether $(X) is nonempty
#_# Add X to needvars to enable
#_#
_NEEDVAR_TARGETS != for v in $(needvars); do printf 'needvar.%s ' "$$v"; done
_NEEDVAR_LOOKUP != for v in $(needvars); do printf '%s) val='"'"'$$(%s)'"'"';; ' "$$v" "$$v"; done
$(_NEEDVAR_TARGETS):
@v=$@; v=$${v#needvar.}; val=; \
case "$$v" in $(_NEEDVAR_LOOKUP) esac; \
test -n "$$val" || { echo "variable not defined: $$v" >&2; exit 1; }
#_# clean
#_# Remove test artifacts
#_#
clean: .PHONY
@rm -f tests/output
@rm -rf tests/basedir/"*"
@rmdir tests/basedir 2>/dev/null; true
#_# test
#_# Run test suite and diff with expected results
#_#
test: .PHONY
@rm -f tests/output
@tests/run > tests/output
@diff tests/output tests/expected