make/update-rules.sh

changeset 988
15b3ca7ee33f
parent 766
e59b76889f00
equal deleted inserted replaced
987:53e22f112b11 988:15b3ca7ee33f
1 #!/bin/sh 1 #!/bin/sh
2 2
3 dir="$1" 3 dir="$1"
4 target="$2" 4 target="$2"
5 extra_flags="$3"
5 6
6 if [ -z "$dir" ]; then 7 if [ -z "$dir" ]; then
7 echo "Usage: $0 <src_dir>" 8 echo "Usage: $0 <src_dir>"
8 exit 1 9 exit 1
9 fi 10 fi
44 45
45 mv Makefile Makefile.old 46 mv Makefile Makefile.old
46 sed '/FORCE:/q' Makefile.old > Makefile 47 sed '/FORCE:/q' Makefile.old > Makefile
47 echo >> Makefile 48 echo >> Makefile
48 for file in `ls *.c` ; do 49 for file in `ls *.c` ; do
49 "$CC" -MT "$target/${file/.c/\$(OBJ_EXT)}" -MM $CFLAGS "$file" 50 "$CC" -MT "$target/${file/.c/\$(OBJ_EXT)}" -MM $CFLAGS $extra_flags "$file"
50 printf '\t@echo "Compiling $<"\n' 51 printf '\t@echo "Compiling $<"\n'
51 printf '\t$(CC) -o $@ $(CFLAGS) -c $<\n\n' 52 printf '\t$(CC) -o $@ $(CFLAGS) %s -c $<\n\n' "$extra_flags"
52 done >> Makefile 53 done >> Makefile
53 rm Makefile.old 54 rm Makefile.old

mercurial