Skip to content

Instantly share code, notes, and snippets.

@kborovik
Created September 30, 2024 00:24
Show Gist options
  • Save kborovik/06e09d19030f42885b230c71a105eafd to your computer and use it in GitHub Desktop.
Save kborovik/06e09d19030f42885b230c71a105eafd to your computer and use it in GitHub Desktop.
#!/usr/bin/awk -f
# Print target name and description of Makefile
# The script expect:
# - 'make -qp' as input
# - '$(info ### description ###)' as one of the target's commands
BEGIN {
FS=":"
print "Targets:"
}
/^[a-zA-Z0-9][^$#\/\t=]*:([^=]|$)/ {
split($1,A,/:/)
target=A[1]
while (length($0) > 0) {
getline
if ($0 ~ /^[[:space:]]+\$\(info #+/) {
split($0,B,/#+/)
printf " %-20s %s\n", target, B[2]
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment