2016-12-12 15:57:39 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
HOOKTYPE=$1
|
|
|
|
|
|
|
|
if ! [ -e Makefile ]; then
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
2018-03-10 11:47:55 +00:00
|
|
|
TARGETS=$(make -pRrq : 2>/dev/null |
|
|
|
|
awk -v RS= -F: '/^# File/,/^# Finished Make data base/ {if ($$1 !~ "^[#.]") {print $$1}}' |
|
|
|
|
sort | egrep -v -e '^[^[:alnum:]]' | sed 's/:$//' | xargs)
|
2016-12-12 15:57:39 +00:00
|
|
|
|
2018-03-10 11:47:55 +00:00
|
|
|
if (echo $TARGETS | grep -q "auto-hook-${HOOKTYPE}"); then
|
2016-12-12 15:57:39 +00:00
|
|
|
exec make "auto-hook-${HOOKTYPE}"
|
|
|
|
fi
|