Created
January 29, 2022 13:24
-
-
Save nazfox/5d38cab37bb3b9d1a2e9a3199959b152 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#/bin/sh | |
# Automatically generate .PHONY for Makefile | |
MAKEFILE=$1 | |
cat $MAKEFILE | \ | |
grep -E '^[a-zA-Z\-_0-9.]+:' | \ | |
grep -Ev '^\.PHONY:' | \ | |
grep -Ev '#.*NO_PHONY' | \ | |
cut -d ':' -f 1 | tr '\n' ' ' | sed -e 's/ $/\n/g' |
You don't want to add task to .PHONY?
Add # NO_PHONY
in the same line of the task.
task: foo bar # NO_PHONY
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Usage
Write this in your Makefile