make/update-rules.sh

Tue, 20 Aug 2024 13:36:56 +0200

author
Mike Becker <universe@uap-core.de>
date
Tue, 20 Aug 2024 13:36:56 +0200
branch
feature/tree_add
changeset 869
9e7f0db6a725
parent 766
e59b76889f00
permissions
-rwxr-xr-x

fix cx_tree_search() not remembering root as a valid candidate

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

mercurial