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