make/update-rules.sh

Fri, 12 Apr 2024 22:43:00 +0200

author
Mike Becker <universe@uap-core.de>
date
Fri, 12 Apr 2024 22:43:00 +0200
changeset 61
b7954818a6b7
parent 8
756b49205a29
permissions
-rwxr-xr-x

merge different bools of AscSceneNode into flags

universe@8 1 #!/bin/sh
universe@8 2
universe@8 3 dir="$1"
universe@8 4
universe@8 5 if [ -z "$dir" ]; then
universe@8 6 echo "Usage: $0 <src_dir>"
universe@8 7 exit 1
universe@8 8 fi
universe@8 9
universe@8 10 if [ -d "$dir" ]; then
universe@8 11 :
universe@8 12 else
universe@8 13 echo "'$dir' is not a directory"
universe@8 14 exit 1
universe@8 15 fi
universe@8 16
universe@8 17 if [ -z "$CC" ]; then
universe@8 18 for cc in gcc clang ; do
universe@8 19 if command -v "$cc" > /dev/null ; then
universe@8 20 CC="$cc"
universe@8 21 break
universe@8 22 fi
universe@8 23 done
universe@8 24 fi
universe@8 25
universe@8 26 if [ -z "$CC" ]; then
universe@8 27 echo "No suitable compiler found to generate make rules"
universe@8 28 exit 1
universe@8 29 fi
universe@8 30
universe@8 31 if command -v sed > /dev/null ; then
universe@8 32 :
universe@8 33 else
universe@8 34 echo "You need the 'sed' program for this script to work."
universe@8 35 exit 1
universe@8 36 fi
universe@8 37
universe@8 38 cd "$dir"
universe@8 39
universe@8 40 mv Makefile Makefile.old
universe@8 41 sed '/FORCE:/q' Makefile.old > Makefile
universe@8 42 echo >> Makefile
universe@8 43 for file in `ls *.c` ; do
universe@8 44 "$CC" -MT "\$(BUILD_DIR)/${file/.c/.o}" -MM $CFLAGS "$file"
universe@8 45 printf '\t@echo "Compiling $<"\n'
universe@8 46 printf '\t$(CC) -o $@ $(CFLAGS) -c $<\n\n'
universe@8 47 done >> Makefile
universe@8 48 rm Makefile.old

mercurial