Tue, 04 Nov 2025 22:32:14 +0100
update uwproj
| 76 | 1 | #!/bin/sh |
| 2 | ||
|
77
808a7324b467
fix missing update of rules in chess subdir
Mike Becker <universe@uap-core.de>
parents:
76
diff
changeset
|
3 | dir="$1" |
| 76 | 4 | target='$(BUILDDIR)' |
| 5 | ||
| 6 | if [ -z "$CC" ]; then | |
| 7 | for cc in gcc clang ; do | |
| 8 | if command -v "$cc" > /dev/null ; then | |
| 9 | CC="$cc" | |
| 10 | break | |
| 11 | fi | |
| 12 | done | |
| 13 | fi | |
| 14 | ||
| 15 | if [ -z "$CC" ]; then | |
| 16 | echo "No suitable compiler found to generate make rules" | |
| 17 | exit 1 | |
| 18 | fi | |
| 19 | ||
| 20 | if command -v sed > /dev/null ; then | |
| 21 | : | |
| 22 | else | |
| 23 | echo "You need the 'sed' program for this script to work." | |
| 24 | exit 1 | |
| 25 | fi | |
| 26 | ||
| 27 | cd "$dir" | |
| 28 | ||
| 29 | mv Makefile Makefile.old | |
| 30 | sed '/FORCE:/q' Makefile.old > Makefile | |
| 31 | echo >> Makefile | |
| 32 | for file in `ls *.c` ; do | |
| 33 | "$CC" -MT "$target/${file/.c/.o}" -MM $CFLAGS "$file" | |
| 34 | printf '\t@echo "Compiling $<"\n' | |
| 35 | printf '\t$(CC) -o $@ $(CFLAGS) -c $<\n\n' | |
| 36 | done >> Makefile | |
| 37 | rm Makefile.old |