diff --git a/bin/check-recipe b/bin/check-recipe new file mode 100755 index 00000000..43fa7f33 --- /dev/null +++ b/bin/check-recipe @@ -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 diff --git a/conf.d/Makefile b/conf.d/Makefile index 3c9a8326..b2d4e113 100644 --- a/conf.d/Makefile +++ b/conf.d/Makefile @@ -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 diff --git a/features.in/Makefile b/features.in/Makefile index a400c131..63ad79bb 100644 --- a/features.in/Makefile +++ b/features.in/Makefile @@ -25,6 +25,9 @@ define grepper_body done endef +check: + @../bin/check-recipe */config.mk + %: $(error BUILDDIR not defined)