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