Uniglot/Hooks/scripts.d/check-AniNIX-Makefile

23 lines
514 B
Plaintext
Raw Normal View History

2023-10-21 20:16:43 -05:00
#!/bin/bash
# Enforce each of the lines
2023-10-21 20:40:03 -05:00
linenum=0
2023-10-21 20:16:43 -05:00
for line in compile install clean uninstall test checkperm diff reverse; do
newlinenum="$(grep -nE "^$line:" "Makefile" | cut -f 1 -d ':')"
# Case 1: Missing section
if [ -z "$newlinenum" ]; then
echo "$file" is missing "$line"
exit 1
fi
# Case 2: Line is out of order
if [ "$newlinenum" -lt "$linenum" ]; then
echo "$file" has section "$line" out of order.
exit 2
fi
linenum="$newlinenum"
done