make/toolchain.sh

Thu, 11 Jul 2024 20:15:56 +0200

author
Mike Becker <universe@uap-core.de>
date
Thu, 11 Jul 2024 20:15:56 +0200
changeset 85
4bf793d93ddf
parent 72
b533da8e7411
permissions
-rw-r--r--

Added tag v3.1 for changeset 5343a527ae96

72
b533da8e7411 use uwproj for build config generation
Mike Becker <universe@uap-core.de>
parents:
diff changeset
1 #!/bin/sh
b533da8e7411 use uwproj for build config generation
Mike Becker <universe@uap-core.de>
parents:
diff changeset
2 #
b533da8e7411 use uwproj for build config generation
Mike Becker <universe@uap-core.de>
parents:
diff changeset
3 # toolchain detection
b533da8e7411 use uwproj for build config generation
Mike Becker <universe@uap-core.de>
parents:
diff changeset
4 #
b533da8e7411 use uwproj for build config generation
Mike Becker <universe@uap-core.de>
parents:
diff changeset
5
b533da8e7411 use uwproj for build config generation
Mike Becker <universe@uap-core.de>
parents:
diff changeset
6 C_COMPILERS="gcc clang suncc cc"
b533da8e7411 use uwproj for build config generation
Mike Becker <universe@uap-core.de>
parents:
diff changeset
7 CPP_COMPILERS="g++ clang++ sunCC CC"
b533da8e7411 use uwproj for build config generation
Mike Becker <universe@uap-core.de>
parents:
diff changeset
8 unset TOOLCHAIN_NAME
b533da8e7411 use uwproj for build config generation
Mike Becker <universe@uap-core.de>
parents:
diff changeset
9 unset TOOLCHAIN_CC
b533da8e7411 use uwproj for build config generation
Mike Becker <universe@uap-core.de>
parents:
diff changeset
10 unset TOOLCHAIN_CXX
b533da8e7411 use uwproj for build config generation
Mike Becker <universe@uap-core.de>
parents:
diff changeset
11
b533da8e7411 use uwproj for build config generation
Mike Becker <universe@uap-core.de>
parents:
diff changeset
12 check_c_compiler()
b533da8e7411 use uwproj for build config generation
Mike Becker <universe@uap-core.de>
parents:
diff changeset
13 {
b533da8e7411 use uwproj for build config generation
Mike Becker <universe@uap-core.de>
parents:
diff changeset
14 cat > "$TEMP_DIR/test.c" << __EOF__
b533da8e7411 use uwproj for build config generation
Mike Becker <universe@uap-core.de>
parents:
diff changeset
15 /* test file */
b533da8e7411 use uwproj for build config generation
Mike Becker <universe@uap-core.de>
parents:
diff changeset
16 #include <stdio.h>
b533da8e7411 use uwproj for build config generation
Mike Becker <universe@uap-core.de>
parents:
diff changeset
17 int main(int argc, char **argv) {
b533da8e7411 use uwproj for build config generation
Mike Becker <universe@uap-core.de>
parents:
diff changeset
18 #if defined(__clang__)
b533da8e7411 use uwproj for build config generation
Mike Becker <universe@uap-core.de>
parents:
diff changeset
19 printf("clang\n");
b533da8e7411 use uwproj for build config generation
Mike Becker <universe@uap-core.de>
parents:
diff changeset
20 #elif defined(__GNUC__)
b533da8e7411 use uwproj for build config generation
Mike Becker <universe@uap-core.de>
parents:
diff changeset
21 printf("gcc\n");
b533da8e7411 use uwproj for build config generation
Mike Becker <universe@uap-core.de>
parents:
diff changeset
22 #elif defined(__sun)
b533da8e7411 use uwproj for build config generation
Mike Becker <universe@uap-core.de>
parents:
diff changeset
23 printf("suncc\n");
b533da8e7411 use uwproj for build config generation
Mike Becker <universe@uap-core.de>
parents:
diff changeset
24 #else
b533da8e7411 use uwproj for build config generation
Mike Becker <universe@uap-core.de>
parents:
diff changeset
25 printf("unknown\n");
b533da8e7411 use uwproj for build config generation
Mike Becker <universe@uap-core.de>
parents:
diff changeset
26 #endif
b533da8e7411 use uwproj for build config generation
Mike Becker <universe@uap-core.de>
parents:
diff changeset
27 return 0;
b533da8e7411 use uwproj for build config generation
Mike Becker <universe@uap-core.de>
parents:
diff changeset
28 }
b533da8e7411 use uwproj for build config generation
Mike Becker <universe@uap-core.de>
parents:
diff changeset
29 __EOF__
b533da8e7411 use uwproj for build config generation
Mike Becker <universe@uap-core.de>
parents:
diff changeset
30 rm -f "$TEMP_DIR/checkcc"
b533da8e7411 use uwproj for build config generation
Mike Becker <universe@uap-core.de>
parents:
diff changeset
31 $1 -o "$TEMP_DIR/checkcc" $CFLAGS $LDFLAGS "$TEMP_DIR/test.c" 2> /dev/null
b533da8e7411 use uwproj for build config generation
Mike Becker <universe@uap-core.de>
parents:
diff changeset
32 }
b533da8e7411 use uwproj for build config generation
Mike Becker <universe@uap-core.de>
parents:
diff changeset
33
b533da8e7411 use uwproj for build config generation
Mike Becker <universe@uap-core.de>
parents:
diff changeset
34 check_cpp_compiler()
b533da8e7411 use uwproj for build config generation
Mike Becker <universe@uap-core.de>
parents:
diff changeset
35 {
b533da8e7411 use uwproj for build config generation
Mike Becker <universe@uap-core.de>
parents:
diff changeset
36 cat > "$TEMP_DIR/test.cpp" << __EOF__
b533da8e7411 use uwproj for build config generation
Mike Becker <universe@uap-core.de>
parents:
diff changeset
37 /* test file */
b533da8e7411 use uwproj for build config generation
Mike Becker <universe@uap-core.de>
parents:
diff changeset
38 #include <iostream>
b533da8e7411 use uwproj for build config generation
Mike Becker <universe@uap-core.de>
parents:
diff changeset
39 int main(int argc, char **argv) {
b533da8e7411 use uwproj for build config generation
Mike Becker <universe@uap-core.de>
parents:
diff changeset
40 #if defined(__clang__)
b533da8e7411 use uwproj for build config generation
Mike Becker <universe@uap-core.de>
parents:
diff changeset
41 std::cout << "clang" << std::endl;
b533da8e7411 use uwproj for build config generation
Mike Becker <universe@uap-core.de>
parents:
diff changeset
42 #elif defined(__GNUC__)
b533da8e7411 use uwproj for build config generation
Mike Becker <universe@uap-core.de>
parents:
diff changeset
43 std::cout << "gcc" << std::endl;
b533da8e7411 use uwproj for build config generation
Mike Becker <universe@uap-core.de>
parents:
diff changeset
44 #elif defined(__sun)
b533da8e7411 use uwproj for build config generation
Mike Becker <universe@uap-core.de>
parents:
diff changeset
45 std::cout << "suncc" << std::endl;
b533da8e7411 use uwproj for build config generation
Mike Becker <universe@uap-core.de>
parents:
diff changeset
46 #else
b533da8e7411 use uwproj for build config generation
Mike Becker <universe@uap-core.de>
parents:
diff changeset
47 std::cout << "cc" << std::endl;
b533da8e7411 use uwproj for build config generation
Mike Becker <universe@uap-core.de>
parents:
diff changeset
48 #endif
b533da8e7411 use uwproj for build config generation
Mike Becker <universe@uap-core.de>
parents:
diff changeset
49 return 0;
b533da8e7411 use uwproj for build config generation
Mike Becker <universe@uap-core.de>
parents:
diff changeset
50 }
b533da8e7411 use uwproj for build config generation
Mike Becker <universe@uap-core.de>
parents:
diff changeset
51 __EOF__
b533da8e7411 use uwproj for build config generation
Mike Becker <universe@uap-core.de>
parents:
diff changeset
52 rm -f "$TEMP_DIR/checkcc"
b533da8e7411 use uwproj for build config generation
Mike Becker <universe@uap-core.de>
parents:
diff changeset
53 $1 -o "$TEMP_DIR/checkcc" $CXXFLAGS $LDFLAGS "$TEMP_DIR/test.cpp" 2> /dev/null
b533da8e7411 use uwproj for build config generation
Mike Becker <universe@uap-core.de>
parents:
diff changeset
54 }
b533da8e7411 use uwproj for build config generation
Mike Becker <universe@uap-core.de>
parents:
diff changeset
55
b533da8e7411 use uwproj for build config generation
Mike Becker <universe@uap-core.de>
parents:
diff changeset
56 create_libtest_source()
b533da8e7411 use uwproj for build config generation
Mike Becker <universe@uap-core.de>
parents:
diff changeset
57 {
b533da8e7411 use uwproj for build config generation
Mike Becker <universe@uap-core.de>
parents:
diff changeset
58 # $1: filename
b533da8e7411 use uwproj for build config generation
Mike Becker <universe@uap-core.de>
parents:
diff changeset
59 # $2: optional include
b533da8e7411 use uwproj for build config generation
Mike Becker <universe@uap-core.de>
parents:
diff changeset
60 cat > "$TEMP_DIR/$1" << __EOF__
b533da8e7411 use uwproj for build config generation
Mike Becker <universe@uap-core.de>
parents:
diff changeset
61 /* libtest file */
b533da8e7411 use uwproj for build config generation
Mike Becker <universe@uap-core.de>
parents:
diff changeset
62 int main(int argc, char **argv) {
b533da8e7411 use uwproj for build config generation
Mike Becker <universe@uap-core.de>
parents:
diff changeset
63 return 0;
b533da8e7411 use uwproj for build config generation
Mike Becker <universe@uap-core.de>
parents:
diff changeset
64 }
b533da8e7411 use uwproj for build config generation
Mike Becker <universe@uap-core.de>
parents:
diff changeset
65 __EOF__
b533da8e7411 use uwproj for build config generation
Mike Becker <universe@uap-core.de>
parents:
diff changeset
66 if [ -n "$2" ]; then
b533da8e7411 use uwproj for build config generation
Mike Becker <universe@uap-core.de>
parents:
diff changeset
67 echo "#include <$2>" >> "$TEMP_DIR/$1"
b533da8e7411 use uwproj for build config generation
Mike Becker <universe@uap-core.de>
parents:
diff changeset
68 fi
b533da8e7411 use uwproj for build config generation
Mike Becker <universe@uap-core.de>
parents:
diff changeset
69 }
b533da8e7411 use uwproj for build config generation
Mike Becker <universe@uap-core.de>
parents:
diff changeset
70
b533da8e7411 use uwproj for build config generation
Mike Becker <universe@uap-core.de>
parents:
diff changeset
71 check_c_lib()
b533da8e7411 use uwproj for build config generation
Mike Becker <universe@uap-core.de>
parents:
diff changeset
72 {
b533da8e7411 use uwproj for build config generation
Mike Becker <universe@uap-core.de>
parents:
diff changeset
73 # $1: libname
b533da8e7411 use uwproj for build config generation
Mike Becker <universe@uap-core.de>
parents:
diff changeset
74 # $2: optional include
b533da8e7411 use uwproj for build config generation
Mike Becker <universe@uap-core.de>
parents:
diff changeset
75 if [ -z "$TOOLCHAIN_CC" ]; then
b533da8e7411 use uwproj for build config generation
Mike Becker <universe@uap-core.de>
parents:
diff changeset
76 return 1
b533da8e7411 use uwproj for build config generation
Mike Becker <universe@uap-core.de>
parents:
diff changeset
77 fi
b533da8e7411 use uwproj for build config generation
Mike Becker <universe@uap-core.de>
parents:
diff changeset
78 create_libtest_source "test.c" "$2"
b533da8e7411 use uwproj for build config generation
Mike Becker <universe@uap-core.de>
parents:
diff changeset
79 rm -f "$TEMP_DIR/checklib"
b533da8e7411 use uwproj for build config generation
Mike Becker <universe@uap-core.de>
parents:
diff changeset
80 $TOOLCHAIN_CC -o "$TEMP_DIR/checklib" $CFLAGS $LDFLAGS "-l$1" "$TEMP_DIR/test.c" 2> /dev/null
b533da8e7411 use uwproj for build config generation
Mike Becker <universe@uap-core.de>
parents:
diff changeset
81 }
b533da8e7411 use uwproj for build config generation
Mike Becker <universe@uap-core.de>
parents:
diff changeset
82
b533da8e7411 use uwproj for build config generation
Mike Becker <universe@uap-core.de>
parents:
diff changeset
83 check_cpp_lib()
b533da8e7411 use uwproj for build config generation
Mike Becker <universe@uap-core.de>
parents:
diff changeset
84 {
b533da8e7411 use uwproj for build config generation
Mike Becker <universe@uap-core.de>
parents:
diff changeset
85 # $1: libname
b533da8e7411 use uwproj for build config generation
Mike Becker <universe@uap-core.de>
parents:
diff changeset
86 # $2: optional include
b533da8e7411 use uwproj for build config generation
Mike Becker <universe@uap-core.de>
parents:
diff changeset
87 if [ -z "$TOOLCHAIN_CXX" ]; then
b533da8e7411 use uwproj for build config generation
Mike Becker <universe@uap-core.de>
parents:
diff changeset
88 return 1
b533da8e7411 use uwproj for build config generation
Mike Becker <universe@uap-core.de>
parents:
diff changeset
89 fi
b533da8e7411 use uwproj for build config generation
Mike Becker <universe@uap-core.de>
parents:
diff changeset
90 create_libtest_source "test.cpp" "$2"
b533da8e7411 use uwproj for build config generation
Mike Becker <universe@uap-core.de>
parents:
diff changeset
91 rm -f "$TEMP_DIR/checklib"
b533da8e7411 use uwproj for build config generation
Mike Becker <universe@uap-core.de>
parents:
diff changeset
92 $TOOLCHAIN_CXX -o "$TEMP_DIR/checklib" $CXXFLAGS $LDFLAGS "-l$1" "$TEMP_DIR/test.cpp" 2> /dev/null
b533da8e7411 use uwproj for build config generation
Mike Becker <universe@uap-core.de>
parents:
diff changeset
93 }
b533da8e7411 use uwproj for build config generation
Mike Becker <universe@uap-core.de>
parents:
diff changeset
94
b533da8e7411 use uwproj for build config generation
Mike Becker <universe@uap-core.de>
parents:
diff changeset
95 check_lib()
b533da8e7411 use uwproj for build config generation
Mike Becker <universe@uap-core.de>
parents:
diff changeset
96 {
b533da8e7411 use uwproj for build config generation
Mike Becker <universe@uap-core.de>
parents:
diff changeset
97 # $1: libname
b533da8e7411 use uwproj for build config generation
Mike Becker <universe@uap-core.de>
parents:
diff changeset
98 # $2: optional include
b533da8e7411 use uwproj for build config generation
Mike Becker <universe@uap-core.de>
parents:
diff changeset
99 if [ -n "$TOOLCHAIN_CC" ]; then
b533da8e7411 use uwproj for build config generation
Mike Becker <universe@uap-core.de>
parents:
diff changeset
100 check_c_lib "$1" "$2"
b533da8e7411 use uwproj for build config generation
Mike Becker <universe@uap-core.de>
parents:
diff changeset
101 elif [ -n "$TOOLCHAIN_CXX" ]; then
b533da8e7411 use uwproj for build config generation
Mike Becker <universe@uap-core.de>
parents:
diff changeset
102 check_cpp_lib "$1" "$2"
b533da8e7411 use uwproj for build config generation
Mike Becker <universe@uap-core.de>
parents:
diff changeset
103 fi
b533da8e7411 use uwproj for build config generation
Mike Becker <universe@uap-core.de>
parents:
diff changeset
104 }
b533da8e7411 use uwproj for build config generation
Mike Becker <universe@uap-core.de>
parents:
diff changeset
105
b533da8e7411 use uwproj for build config generation
Mike Becker <universe@uap-core.de>
parents:
diff changeset
106 detect_c_compiler()
b533da8e7411 use uwproj for build config generation
Mike Becker <universe@uap-core.de>
parents:
diff changeset
107 {
b533da8e7411 use uwproj for build config generation
Mike Becker <universe@uap-core.de>
parents:
diff changeset
108 if [ -n "$TOOLCHAIN_CC" ]; then
b533da8e7411 use uwproj for build config generation
Mike Becker <universe@uap-core.de>
parents:
diff changeset
109 return 0
b533da8e7411 use uwproj for build config generation
Mike Becker <universe@uap-core.de>
parents:
diff changeset
110 fi
b533da8e7411 use uwproj for build config generation
Mike Becker <universe@uap-core.de>
parents:
diff changeset
111 printf "detect C compiler... "
b533da8e7411 use uwproj for build config generation
Mike Becker <universe@uap-core.de>
parents:
diff changeset
112 if [ -n "$CC" ]; then
b533da8e7411 use uwproj for build config generation
Mike Becker <universe@uap-core.de>
parents:
diff changeset
113 if check_c_compiler "$CC"; then
b533da8e7411 use uwproj for build config generation
Mike Becker <universe@uap-core.de>
parents:
diff changeset
114 TOOLCHAIN_CC=$CC
b533da8e7411 use uwproj for build config generation
Mike Becker <universe@uap-core.de>
parents:
diff changeset
115 TOOLCHAIN_NAME=`"$TEMP_DIR/checkcc"`
b533da8e7411 use uwproj for build config generation
Mike Becker <universe@uap-core.de>
parents:
diff changeset
116 echo "$CC"
b533da8e7411 use uwproj for build config generation
Mike Becker <universe@uap-core.de>
parents:
diff changeset
117 return 0
b533da8e7411 use uwproj for build config generation
Mike Becker <universe@uap-core.de>
parents:
diff changeset
118 else
b533da8e7411 use uwproj for build config generation
Mike Becker <universe@uap-core.de>
parents:
diff changeset
119 echo "$CC is not a working C compiler"
b533da8e7411 use uwproj for build config generation
Mike Becker <universe@uap-core.de>
parents:
diff changeset
120 return 1
b533da8e7411 use uwproj for build config generation
Mike Becker <universe@uap-core.de>
parents:
diff changeset
121 fi
b533da8e7411 use uwproj for build config generation
Mike Becker <universe@uap-core.de>
parents:
diff changeset
122 else
b533da8e7411 use uwproj for build config generation
Mike Becker <universe@uap-core.de>
parents:
diff changeset
123 for COMP in $C_COMPILERS
b533da8e7411 use uwproj for build config generation
Mike Becker <universe@uap-core.de>
parents:
diff changeset
124 do
b533da8e7411 use uwproj for build config generation
Mike Becker <universe@uap-core.de>
parents:
diff changeset
125 if check_c_compiler "$COMP"; then
b533da8e7411 use uwproj for build config generation
Mike Becker <universe@uap-core.de>
parents:
diff changeset
126 TOOLCHAIN_CC=$COMP
b533da8e7411 use uwproj for build config generation
Mike Becker <universe@uap-core.de>
parents:
diff changeset
127 TOOLCHAIN_NAME=`"$TEMP_DIR/checkcc"`
b533da8e7411 use uwproj for build config generation
Mike Becker <universe@uap-core.de>
parents:
diff changeset
128 echo "$COMP"
b533da8e7411 use uwproj for build config generation
Mike Becker <universe@uap-core.de>
parents:
diff changeset
129 return 0
b533da8e7411 use uwproj for build config generation
Mike Becker <universe@uap-core.de>
parents:
diff changeset
130 fi
b533da8e7411 use uwproj for build config generation
Mike Becker <universe@uap-core.de>
parents:
diff changeset
131 done
b533da8e7411 use uwproj for build config generation
Mike Becker <universe@uap-core.de>
parents:
diff changeset
132 echo "not found"
b533da8e7411 use uwproj for build config generation
Mike Becker <universe@uap-core.de>
parents:
diff changeset
133 return 1
b533da8e7411 use uwproj for build config generation
Mike Becker <universe@uap-core.de>
parents:
diff changeset
134 fi
b533da8e7411 use uwproj for build config generation
Mike Becker <universe@uap-core.de>
parents:
diff changeset
135 }
b533da8e7411 use uwproj for build config generation
Mike Becker <universe@uap-core.de>
parents:
diff changeset
136
b533da8e7411 use uwproj for build config generation
Mike Becker <universe@uap-core.de>
parents:
diff changeset
137 detect_cpp_compiler()
b533da8e7411 use uwproj for build config generation
Mike Becker <universe@uap-core.de>
parents:
diff changeset
138 {
b533da8e7411 use uwproj for build config generation
Mike Becker <universe@uap-core.de>
parents:
diff changeset
139 if [ -n "$TOOLCHAIN_CXX" ]; then
b533da8e7411 use uwproj for build config generation
Mike Becker <universe@uap-core.de>
parents:
diff changeset
140 return 0
b533da8e7411 use uwproj for build config generation
Mike Becker <universe@uap-core.de>
parents:
diff changeset
141 fi
b533da8e7411 use uwproj for build config generation
Mike Becker <universe@uap-core.de>
parents:
diff changeset
142 printf "detect C++ compiler... "
b533da8e7411 use uwproj for build config generation
Mike Becker <universe@uap-core.de>
parents:
diff changeset
143
b533da8e7411 use uwproj for build config generation
Mike Becker <universe@uap-core.de>
parents:
diff changeset
144 if [ -n "$CXX" ]; then
b533da8e7411 use uwproj for build config generation
Mike Becker <universe@uap-core.de>
parents:
diff changeset
145 if check_cpp_compiler "$CXX"; then
b533da8e7411 use uwproj for build config generation
Mike Becker <universe@uap-core.de>
parents:
diff changeset
146 TOOLCHAIN_CXX=$CXX
b533da8e7411 use uwproj for build config generation
Mike Becker <universe@uap-core.de>
parents:
diff changeset
147 TOOLCHAIN_NAME=`"$TEMP_DIR/checkcc"`
b533da8e7411 use uwproj for build config generation
Mike Becker <universe@uap-core.de>
parents:
diff changeset
148 echo "$CXX"
b533da8e7411 use uwproj for build config generation
Mike Becker <universe@uap-core.de>
parents:
diff changeset
149 return 0
b533da8e7411 use uwproj for build config generation
Mike Becker <universe@uap-core.de>
parents:
diff changeset
150 else
b533da8e7411 use uwproj for build config generation
Mike Becker <universe@uap-core.de>
parents:
diff changeset
151 echo "$CXX is not a working C++ compiler"
b533da8e7411 use uwproj for build config generation
Mike Becker <universe@uap-core.de>
parents:
diff changeset
152 return 1
b533da8e7411 use uwproj for build config generation
Mike Becker <universe@uap-core.de>
parents:
diff changeset
153 fi
b533da8e7411 use uwproj for build config generation
Mike Becker <universe@uap-core.de>
parents:
diff changeset
154 else
b533da8e7411 use uwproj for build config generation
Mike Becker <universe@uap-core.de>
parents:
diff changeset
155 for COMP in $CPP_COMPILERS
b533da8e7411 use uwproj for build config generation
Mike Becker <universe@uap-core.de>
parents:
diff changeset
156 do
b533da8e7411 use uwproj for build config generation
Mike Becker <universe@uap-core.de>
parents:
diff changeset
157 if check_cpp_compiler "$COMP"; then
b533da8e7411 use uwproj for build config generation
Mike Becker <universe@uap-core.de>
parents:
diff changeset
158 TOOLCHAIN_CXX=$COMP
b533da8e7411 use uwproj for build config generation
Mike Becker <universe@uap-core.de>
parents:
diff changeset
159 TOOLCHAIN_NAME=`"$TEMP_DIR/checkcc"`
b533da8e7411 use uwproj for build config generation
Mike Becker <universe@uap-core.de>
parents:
diff changeset
160 echo "$COMP"
b533da8e7411 use uwproj for build config generation
Mike Becker <universe@uap-core.de>
parents:
diff changeset
161 return 0
b533da8e7411 use uwproj for build config generation
Mike Becker <universe@uap-core.de>
parents:
diff changeset
162 fi
b533da8e7411 use uwproj for build config generation
Mike Becker <universe@uap-core.de>
parents:
diff changeset
163 done
b533da8e7411 use uwproj for build config generation
Mike Becker <universe@uap-core.de>
parents:
diff changeset
164 echo "${TOOLCHAIN_CXX:-"not found"}"
b533da8e7411 use uwproj for build config generation
Mike Becker <universe@uap-core.de>
parents:
diff changeset
165 return 1
b533da8e7411 use uwproj for build config generation
Mike Becker <universe@uap-core.de>
parents:
diff changeset
166 fi
b533da8e7411 use uwproj for build config generation
Mike Becker <universe@uap-core.de>
parents:
diff changeset
167 }
b533da8e7411 use uwproj for build config generation
Mike Becker <universe@uap-core.de>
parents:
diff changeset
168
b533da8e7411 use uwproj for build config generation
Mike Becker <universe@uap-core.de>
parents:
diff changeset
169 write_toolchain_defaults()
b533da8e7411 use uwproj for build config generation
Mike Becker <universe@uap-core.de>
parents:
diff changeset
170 {
b533da8e7411 use uwproj for build config generation
Mike Becker <universe@uap-core.de>
parents:
diff changeset
171 echo "# toolchain" >> "$1"
b533da8e7411 use uwproj for build config generation
Mike Becker <universe@uap-core.de>
parents:
diff changeset
172 if [ -n "$TOOLCHAIN_CC" ]; then
b533da8e7411 use uwproj for build config generation
Mike Becker <universe@uap-core.de>
parents:
diff changeset
173 echo "CC = ${TOOLCHAIN_CC}" >> "$1"
b533da8e7411 use uwproj for build config generation
Mike Becker <universe@uap-core.de>
parents:
diff changeset
174 fi
b533da8e7411 use uwproj for build config generation
Mike Becker <universe@uap-core.de>
parents:
diff changeset
175 if [ -n "$TOOLCHAIN_CXX" ]; then
b533da8e7411 use uwproj for build config generation
Mike Becker <universe@uap-core.de>
parents:
diff changeset
176 echo "CXX = ${TOOLCHAIN_CXX}" >> "$1"
b533da8e7411 use uwproj for build config generation
Mike Becker <universe@uap-core.de>
parents:
diff changeset
177 fi
b533da8e7411 use uwproj for build config generation
Mike Becker <universe@uap-core.de>
parents:
diff changeset
178 echo >> "$1"
b533da8e7411 use uwproj for build config generation
Mike Becker <universe@uap-core.de>
parents:
diff changeset
179 if [ -f "make/${TOOLCHAIN_NAME}.mk" ]; then
b533da8e7411 use uwproj for build config generation
Mike Becker <universe@uap-core.de>
parents:
diff changeset
180 cat "make/${TOOLCHAIN_NAME}.mk" >> "$1"
b533da8e7411 use uwproj for build config generation
Mike Becker <universe@uap-core.de>
parents:
diff changeset
181 elif [ -f "make/cc.mk" ]; then
b533da8e7411 use uwproj for build config generation
Mike Becker <universe@uap-core.de>
parents:
diff changeset
182 cat "make/cc.mk" >> "$1"
b533da8e7411 use uwproj for build config generation
Mike Becker <universe@uap-core.de>
parents:
diff changeset
183 else
b533da8e7411 use uwproj for build config generation
Mike Becker <universe@uap-core.de>
parents:
diff changeset
184 echo "!!! WARNING !!! Default toolchain flags not found. Configuration might be incomplete."
b533da8e7411 use uwproj for build config generation
Mike Becker <universe@uap-core.de>
parents:
diff changeset
185 fi
b533da8e7411 use uwproj for build config generation
Mike Becker <universe@uap-core.de>
parents:
diff changeset
186 }

mercurial