check-recipe: generalize dependency control
An initial (and quite naive) implementation was done for conf.d/ files but features do need it as well -- which became obvious during a casual inspection of distro/alt-workstation's target graph (which occured broken). The code is a messy hackery unfortunately, regexes used are fragile regarding e.g. [A-Z_] in target names. Read with care. NB: lib/ might need this too but it's rather stable and contains some special cases that would obstruct the regexes even more...
This commit is contained in:
parent
949733a9b4
commit
a289726792
14
bin/check-recipe
Executable file
14
bin/check-recipe
Executable file
@ -0,0 +1,14 @@
|
||||
#!/bin/sh
|
||||
|
||||
# missing "; @:" for recipeless rules makes SHELL payload useless
|
||||
# (see also ../lib/report.mk); this results in broken target graphs
|
||||
# (so REPORT=1 gets crippled)
|
||||
|
||||
sed 's/^[a-z]\+\/.*:.*$/\n&/' "$@" \
|
||||
| grep -vE '^(#|export|if|else|endif|define|endef)' \
|
||||
| sed ':loop /^[^#].*[^\\]\\$/N; s/\\\n//; t loop' \
|
||||
| grep -vE ':=| = | ?= | += |^\$' \
|
||||
| sed ':loop /^[a-z]\+\/.*:.*$/N; s/\n\t\+@*/\; /; t loop' \
|
||||
| grep -vE ';|^$' && exit 1 ||:
|
||||
|
||||
# see also http://unix.stackexchange.com/questions/228547
|
@ -1,5 +1,2 @@
|
||||
# missing "; @:" for recipeless rules makes SHELL payload useless
|
||||
# (see also ../lib/report.mk); this results in broken target graphs
|
||||
# (so REPORT=1 gets crippled)
|
||||
check:
|
||||
@grep -E '^[a-z]+/.*: .*[^\\:]$$' *.mk
|
||||
@../bin/check-recipe *.mk
|
||||
|
@ -25,6 +25,9 @@ define grepper_body
|
||||
done
|
||||
endef
|
||||
|
||||
check:
|
||||
@../bin/check-recipe */config.mk
|
||||
|
||||
%:
|
||||
$(error BUILDDIR not defined)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user