Sat, 20 Jan 2024 16:02:04 +0100
update uwproj and check toolchain dependency for coverage flags - fixes #345
configure | file | annotate | diff | comparison | revisions | |
make/cc.mk | file | annotate | diff | comparison | revisions | |
make/configure.vm | file | annotate | diff | comparison | revisions | |
make/project.xml | file | annotate | diff | comparison | revisions | |
make/suncc.mk | file | annotate | diff | comparison | revisions | |
make/toolchain.sh | file | annotate | diff | comparison | revisions | |
make/uwproj.xsd | file | annotate | diff | comparison | revisions |
1.1 --- a/configure Wed Jan 17 21:01:50 2024 +0100 1.2 +++ b/configure Sat Jan 20 16:02:04 2024 +0100 1.3 @@ -163,17 +163,17 @@ 1.4 printf "detect platform... " 1.5 if [ "$OS" = "SunOS" ]; then 1.6 PLATFORM="solaris sunos unix svr4" 1.7 -fi 1.8 -if [ "$OS" = "Linux" ]; then 1.9 +elif [ "$OS" = "Linux" ]; then 1.10 PLATFORM="linux unix" 1.11 -fi 1.12 -if [ "$OS" = "FreeBSD" ]; then 1.13 +elif [ "$OS" = "FreeBSD" ]; then 1.14 PLATFORM="freebsd bsd unix" 1.15 -fi 1.16 -if [ "$OS" = "Darwin" ]; then 1.17 +elif [ "$OS" = "OpenBSD" ]; then 1.18 + PLATFORM="openbsd bsd unix" 1.19 +elif [ "$OS" = "NetBSD" ]; then 1.20 + PLATFORM="netbsd bsd unix" 1.21 +elif [ "$OS" = "Darwin" ]; then 1.22 PLATFORM="macos osx bsd unix" 1.23 -fi 1.24 -if echo "$OS" | grep -i "MINGW" > /dev/null; then 1.25 +elif echo "$OS" | grep -i "MINGW" > /dev/null; then 1.26 PLATFORM="windows mingw" 1.27 fi 1.28 : ${PLATFORM:="unix"} 1.29 @@ -201,6 +201,26 @@ 1.30 done 1.31 return 0 1.32 } 1.33 +istoolchain() 1.34 +{ 1.35 + for t in $TOOLCHAIN 1.36 + do 1.37 + if [ "$t" = "$1" ]; then 1.38 + return 0 1.39 + fi 1.40 + done 1.41 + return 1 1.42 +} 1.43 +notistoolchain() 1.44 +{ 1.45 + for t in $TOOLCHAIN 1.46 + do 1.47 + if [ "$t" = "$1" ]; then 1.48 + return 1 1.49 + fi 1.50 + done 1.51 + return 0 1.52 +} 1.53 1.54 1.55 # generate vars.mk 1.56 @@ -267,9 +287,12 @@ 1.57 dependency_error_coverage() 1.58 { 1.59 print_check_msg "$dep_checked_coverage" "checking for coverage... " 1.60 - # dependency coverage 1.61 + # dependency coverage toolchain="gnuc" 1.62 while true 1.63 do 1.64 + if notistoolchain "gnuc"; then 1.65 + break 1.66 + fi 1.67 TEMP_CFLAGS="$TEMP_CFLAGS \${COVERAGE_CFLAGS}" 1.68 TEMP_LDFLAGS="$TEMP_LDFLAGS \${COVERAGE_LDFLAGS}" 1.69 print_check_msg "$dep_checked_coverage" "yes\n" 1.70 @@ -453,10 +476,10 @@ 1.71 1.72 # add general dependency flags to flags.mk 1.73 echo "# general flags" >> "$TEMP_DIR/flags.mk" 1.74 -if [ -n "${TEMP_CFLAGS}" -a -n "$lang_c" ]; then 1.75 +if [ -n "${TEMP_CFLAGS}" ] && [ -n "$lang_c" ]; then 1.76 echo "CFLAGS += $TEMP_CFLAGS" >> "$TEMP_DIR/flags.mk" 1.77 fi 1.78 -if [ -n "${TEMP_CXXFLAGS}" -a -n "$lang_cpp" ]; then 1.79 +if [ -n "${TEMP_CXXFLAGS}" ] && [ -n "$lang_cpp" ]; then 1.80 echo "CXXFLAGS += $TEMP_CXXFLAGS" >> "$TEMP_DIR/flags.mk" 1.81 fi 1.82 if [ -n "${TEMP_LDFLAGS}" ]; then 1.83 @@ -639,10 +662,10 @@ 1.84 fi 1.85 fi 1.86 1.87 -if [ -n "${TEMP_CFLAGS}" -a -n "$lang_c" ]; then 1.88 +if [ -n "${TEMP_CFLAGS}" ] && [ -n "$lang_c" ]; then 1.89 echo "CFLAGS += $TEMP_CFLAGS" >> "$TEMP_DIR/flags.mk" 1.90 fi 1.91 -if [ -n "${TEMP_CXXFLAGS}" -a -n "$lang_cpp" ]; then 1.92 +if [ -n "${TEMP_CXXFLAGS}" ] && [ -n "$lang_cpp" ]; then 1.93 echo "CXXFLAGS += $TEMP_CXXFLAGS" >> "$TEMP_DIR/flags.mk" 1.94 fi 1.95 if [ "$BUILD_TYPE" = "debug" ]; then 1.96 @@ -699,6 +722,3 @@ 1.97 write_toolchain_defaults "$TEMP_DIR/toolchain.mk" 1.98 cat "$TEMP_DIR/vars.mk" "$TEMP_DIR/toolchain.mk" "$TEMP_DIR/flags.mk" "$TEMP_DIR/make.mk" > config.mk 1.99 rm -Rf "$TEMP_DIR" 1.100 - 1.101 - 1.102 -
2.1 --- a/make/cc.mk Wed Jan 17 21:01:50 2024 +0100 2.2 +++ b/make/cc.mk Sat Jan 20 16:02:04 2024 +0100 2.3 @@ -9,6 +9,3 @@ 2.4 2.5 SHLIB_CFLAGS = -fPIC 2.6 SHLIB_LDFLAGS = -shared 2.7 - 2.8 -COVERAGE_CFLAGS = 2.9 -COVERAGE_LDFLAGS =
3.1 --- a/make/configure.vm Wed Jan 17 21:01:50 2024 +0100 3.2 +++ b/make/configure.vm Sat Jan 20 16:02:04 2024 +0100 3.3 @@ -93,11 +93,7 @@ 3.4 #if( $features.size() > 0 ) 3.5 Optional Features: 3.6 #foreach( $feature in $features ) 3.7 -#if( $feature.auto ) 3.8 - --disable-${feature.arg} 3.9 -#else 3.10 - --enable-${feature.arg} 3.11 -#end 3.12 +${feature.helpText} 3.13 #end 3.14 3.15 #end 3.16 @@ -190,17 +186,17 @@ 3.17 printf "detect platform... " 3.18 if [ "$OS" = "SunOS" ]; then 3.19 PLATFORM="solaris sunos unix svr4" 3.20 -fi 3.21 -if [ "$OS" = "Linux" ]; then 3.22 +elif [ "$OS" = "Linux" ]; then 3.23 PLATFORM="linux unix" 3.24 -fi 3.25 -if [ "$OS" = "FreeBSD" ]; then 3.26 +elif [ "$OS" = "FreeBSD" ]; then 3.27 PLATFORM="freebsd bsd unix" 3.28 -fi 3.29 -if [ "$OS" = "Darwin" ]; then 3.30 +elif [ "$OS" = "OpenBSD" ]; then 3.31 + PLATFORM="openbsd bsd unix" 3.32 +elif [ "$OS" = "NetBSD" ]; then 3.33 + PLATFORM="netbsd bsd unix" 3.34 +elif [ "$OS" = "Darwin" ]; then 3.35 PLATFORM="macos osx bsd unix" 3.36 -fi 3.37 -if echo "$OS" | grep -i "MINGW" > /dev/null; then 3.38 +elif echo "$OS" | grep -i "MINGW" > /dev/null; then 3.39 PLATFORM="windows mingw" 3.40 fi 3.41 : ${PLATFORM:="unix"} 3.42 @@ -228,6 +224,26 @@ 3.43 done 3.44 return 0 3.45 } 3.46 +istoolchain() 3.47 +{ 3.48 + for t in $TOOLCHAIN 3.49 + do 3.50 + if [ "$t" = "$1" ]; then 3.51 + return 0 3.52 + fi 3.53 + done 3.54 + return 1 3.55 +} 3.56 +notistoolchain() 3.57 +{ 3.58 + for t in $TOOLCHAIN 3.59 + do 3.60 + if [ "$t" = "$1" ]; then 3.61 + return 1 3.62 + fi 3.63 + done 3.64 + return 0 3.65 +} 3.66 ]]# 3.67 ## End of unparsed content ** 3.68 3.69 @@ -307,8 +323,13 @@ 3.70 break 3.71 fi 3.72 #end 3.73 + #if( $sub.toolchain ) 3.74 + if notistoolchain "${sub.toolchain}"; then 3.75 + break 3.76 + fi 3.77 + #end 3.78 #foreach( $np in $sub.notList ) 3.79 - if isplatform "${np}"; then 3.80 + if isplatform "${np}" || istoolchain "${np}"; then 3.81 break 3.82 fi 3.83 #end 3.84 @@ -384,8 +405,13 @@ 3.85 break 3.86 fi 3.87 #end 3.88 + #if( $dependency.toolchain ) 3.89 + if notistoolchain "${dependency.toolchain}"; then 3.90 + break 3.91 + fi 3.92 + #end 3.93 #foreach( $np in $dependency.notList ) 3.94 - if isplatform "${np}"; then 3.95 + if isplatform "${np}" || istoolchain "${np}"; then 3.96 break 3.97 fi 3.98 #end 3.99 @@ -444,10 +470,10 @@ 3.100 3.101 # add general dependency flags to flags.mk 3.102 echo "# general flags" >> "$TEMP_DIR/flags.mk" 3.103 -if [ -n "${TEMP_CFLAGS}" -a -n "$lang_c" ]; then 3.104 +if [ -n "${TEMP_CFLAGS}" ] && [ -n "$lang_c" ]; then 3.105 echo "CFLAGS += $TEMP_CFLAGS" >> "$TEMP_DIR/flags.mk" 3.106 fi 3.107 -if [ -n "${TEMP_CXXFLAGS}" -a -n "$lang_cpp" ]; then 3.108 +if [ -n "${TEMP_CXXFLAGS}" ] && [ -n "$lang_cpp" ]; then 3.109 echo "CXXFLAGS += $TEMP_CXXFLAGS" >> "$TEMP_DIR/flags.mk" 3.110 fi 3.111 if [ -n "${TEMP_LDFLAGS}" ]; then 3.112 @@ -578,10 +604,10 @@ 3.113 fi 3.114 #end 3.115 3.116 -if [ -n "${TEMP_CFLAGS}" -a -n "$lang_c" ]; then 3.117 +if [ -n "${TEMP_CFLAGS}" ] && [ -n "$lang_c" ]; then 3.118 echo "${target.cFlags} += $TEMP_CFLAGS" >> "$TEMP_DIR/flags.mk" 3.119 fi 3.120 -if [ -n "${TEMP_CXXFLAGS}" -a -n "$lang_cpp" ]; then 3.121 +if [ -n "${TEMP_CXXFLAGS}" ] && [ -n "$lang_cpp" ]; then 3.122 echo "${target.cxxFlags} += $TEMP_CXXFLAGS" >> "$TEMP_DIR/flags.mk" 3.123 fi 3.124 if [ "$BUILD_TYPE" = "debug" ]; then 3.125 @@ -645,6 +671,3 @@ 3.126 write_toolchain_defaults "$TEMP_DIR/toolchain.mk" 3.127 cat "$TEMP_DIR/vars.mk" "$TEMP_DIR/toolchain.mk" "$TEMP_DIR/flags.mk" "$TEMP_DIR/make.mk" > config.mk 3.128 rm -Rf "$TEMP_DIR" 3.129 - 3.130 - 3.131 -
4.1 --- a/make/project.xml Wed Jan 17 21:01:50 2024 +0100 4.2 +++ b/make/project.xml Sat Jan 20 16:02:04 2024 +0100 4.3 @@ -69,7 +69,7 @@ 4.4 <test>test -n "$PANDOC"</test> 4.5 </dependency> 4.6 4.7 - <dependency name="coverage"> 4.8 + <dependency name="coverage" toolchain="gnuc"> 4.9 <cflags>\${COVERAGE_CFLAGS}</cflags> 4.10 <ldflags>\${COVERAGE_LDFLAGS}</ldflags> 4.11 </dependency>
5.1 --- a/make/suncc.mk Wed Jan 17 21:01:50 2024 +0100 5.2 +++ b/make/suncc.mk Sat Jan 20 16:02:04 2024 +0100 5.3 @@ -9,6 +9,3 @@ 5.4 5.5 SHLIB_CFLAGS = -Kpic 5.6 SHLIB_LDFLAGS = -G 5.7 - 5.8 -COVERAGE_CFLAGS = 5.9 -COVERAGE_LDFLAGS =
6.1 --- a/make/toolchain.sh Wed Jan 17 21:01:50 2024 +0100 6.2 +++ b/make/toolchain.sh Sat Jan 20 16:02:04 2024 +0100 6.3 @@ -3,64 +3,74 @@ 6.4 # toolchain detection 6.5 # 6.6 6.7 -C_COMPILERS="gcc clang suncc cc" 6.8 -CPP_COMPILERS="g++ clang++ sunCC CC" 6.9 +if isplatform "bsd" && notisplatform "openbsd"; then 6.10 + C_COMPILERS="clang gcc cc" 6.11 + CPP_COMPILERS="clang++ g++ CC" 6.12 +else 6.13 + C_COMPILERS="gcc clang suncc cc" 6.14 + CPP_COMPILERS="g++ clang++ sunCC CC" 6.15 +fi 6.16 +unset TOOLCHAIN 6.17 unset TOOLCHAIN_NAME 6.18 unset TOOLCHAIN_CC 6.19 unset TOOLCHAIN_CXX 6.20 6.21 check_c_compiler() 6.22 { 6.23 - cat > "$TEMP_DIR/test.c" << __EOF__ 6.24 + cat > "$TEMP_DIR/test.c" << __EOF__ 6.25 /* test file */ 6.26 #include <stdio.h> 6.27 int main(int argc, char **argv) { 6.28 -#if defined(__clang__) 6.29 - printf("clang\n"); 6.30 +#if defined(_MSC_VER) 6.31 + printf("msc\n"); 6.32 +#elif defined(__clang__) 6.33 + printf("clang gnuc\n"); 6.34 #elif defined(__GNUC__) 6.35 - printf("gcc\n"); 6.36 + printf("gcc gnuc\n"); 6.37 #elif defined(__sun) 6.38 - printf("suncc\n"); 6.39 + printf("suncc\n"); 6.40 #else 6.41 - printf("unknown\n"); 6.42 + printf("unknown\n"); 6.43 #endif 6.44 - return 0; 6.45 + return 0; 6.46 } 6.47 __EOF__ 6.48 - rm -f "$TEMP_DIR/checkcc" 6.49 - $1 -o "$TEMP_DIR/checkcc" $CFLAGS $LDFLAGS "$TEMP_DIR/test.c" 2> /dev/null 6.50 + rm -f "$TEMP_DIR/checkcc" 6.51 + $1 -o "$TEMP_DIR/checkcc" $CFLAGS $LDFLAGS "$TEMP_DIR/test.c" 2> /dev/null 6.52 } 6.53 6.54 check_cpp_compiler() 6.55 { 6.56 - cat > "$TEMP_DIR/test.cpp" << __EOF__ 6.57 + cat > "$TEMP_DIR/test.cpp" << __EOF__ 6.58 /* test file */ 6.59 #include <iostream> 6.60 int main(int argc, char **argv) { 6.61 -#if defined(__clang__) 6.62 - std::cout << "clang" << std::endl; 6.63 +#if defined(_MSC_VER) 6.64 + std::cout << "msc" << std::endl; 6.65 +#elif defined(__clang__) 6.66 + std::cout << "clang gnuc" << std::endl; 6.67 #elif defined(__GNUC__) 6.68 - std::cout << "gcc" << std::endl; 6.69 + std::cout << "gcc gnuc" << std::endl; 6.70 #elif defined(__sun) 6.71 - std::cout << "suncc" << std::endl; 6.72 + std::cout << "suncc" << std::endl; 6.73 #else 6.74 - std::cout << "cc" << std::endl; 6.75 + std::cout << "cc" << std::endl; 6.76 #endif 6.77 - return 0; 6.78 + return 0; 6.79 } 6.80 __EOF__ 6.81 - rm -f "$TEMP_DIR/checkcc" 6.82 - $1 -o "$TEMP_DIR/checkcc" $CXXFLAGS $LDFLAGS "$TEMP_DIR/test.cpp" 2> /dev/null 6.83 + rm -f "$TEMP_DIR/checkcc" 6.84 + $1 -o "$TEMP_DIR/checkcc" $CXXFLAGS $LDFLAGS "$TEMP_DIR/test.cpp" 2> /dev/null 6.85 } 6.86 6.87 create_libtest_source() 6.88 { 6.89 # $1: filename 6.90 # $2: optional include 6.91 - cat > "$TEMP_DIR/$1" << __EOF__ 6.92 + cat > "$TEMP_DIR/$1" << __EOF__ 6.93 /* libtest file */ 6.94 int main(int argc, char **argv) { 6.95 - return 0; 6.96 + return 0; 6.97 } 6.98 __EOF__ 6.99 if [ -n "$2" ]; then 6.100 @@ -77,7 +87,7 @@ 6.101 fi 6.102 create_libtest_source "test.c" "$2" 6.103 rm -f "$TEMP_DIR/checklib" 6.104 - $TOOLCHAIN_CC -o "$TEMP_DIR/checklib" $CFLAGS $LDFLAGS "-l$1" "$TEMP_DIR/test.c" 2> /dev/null 6.105 + $TOOLCHAIN_CC -o "$TEMP_DIR/checklib" $CFLAGS $LDFLAGS "-l$1" "$TEMP_DIR/test.c" 2> /dev/null 6.106 } 6.107 6.108 check_cpp_lib() 6.109 @@ -87,20 +97,20 @@ 6.110 if [ -z "$TOOLCHAIN_CXX" ]; then 6.111 return 1 6.112 fi 6.113 - create_libtest_source "test.cpp" "$2" 6.114 + create_libtest_source "test.cpp" "$2" 6.115 rm -f "$TEMP_DIR/checklib" 6.116 - $TOOLCHAIN_CXX -o "$TEMP_DIR/checklib" $CXXFLAGS $LDFLAGS "-l$1" "$TEMP_DIR/test.cpp" 2> /dev/null 6.117 + $TOOLCHAIN_CXX -o "$TEMP_DIR/checklib" $CXXFLAGS $LDFLAGS "-l$1" "$TEMP_DIR/test.cpp" 2> /dev/null 6.118 } 6.119 6.120 check_lib() 6.121 { 6.122 # $1: libname 6.123 # $2: optional include 6.124 - if [ -n "$TOOLCHAIN_CC" ]; then 6.125 - check_c_lib "$1" "$2" 6.126 - elif [ -n "$TOOLCHAIN_CXX" ]; then 6.127 - check_cpp_lib "$1" "$2" 6.128 - fi 6.129 + if [ -n "$TOOLCHAIN_CC" ]; then 6.130 + check_c_lib "$1" "$2" 6.131 + elif [ -n "$TOOLCHAIN_CXX" ]; then 6.132 + check_cpp_lib "$1" "$2" 6.133 + fi 6.134 } 6.135 6.136 detect_c_compiler() 6.137 @@ -112,7 +122,8 @@ 6.138 if [ -n "$CC" ]; then 6.139 if check_c_compiler "$CC"; then 6.140 TOOLCHAIN_CC=$CC 6.141 - TOOLCHAIN_NAME=`"$TEMP_DIR/checkcc"` 6.142 + TOOLCHAIN=`"$TEMP_DIR/checkcc"` 6.143 + TOOLCHAIN_NAME=`echo "$TOOLCHAIN" | cut -f1 -d' ' -` 6.144 echo "$CC" 6.145 return 0 6.146 else 6.147 @@ -124,7 +135,8 @@ 6.148 do 6.149 if check_c_compiler "$COMP"; then 6.150 TOOLCHAIN_CC=$COMP 6.151 - TOOLCHAIN_NAME=`"$TEMP_DIR/checkcc"` 6.152 + TOOLCHAIN=`"$TEMP_DIR/checkcc"` 6.153 + TOOLCHAIN_NAME=`echo "$TOOLCHAIN" | cut -f1 -d' ' -` 6.154 echo "$COMP" 6.155 return 0 6.156 fi 6.157 @@ -144,7 +156,8 @@ 6.158 if [ -n "$CXX" ]; then 6.159 if check_cpp_compiler "$CXX"; then 6.160 TOOLCHAIN_CXX=$CXX 6.161 - TOOLCHAIN_NAME=`"$TEMP_DIR/checkcc"` 6.162 + TOOLCHAIN=`"$TEMP_DIR/checkcc"` 6.163 + TOOLCHAIN_NAME=`echo "$TOOLCHAIN" | cut -f1 -d' ' -` 6.164 echo "$CXX" 6.165 return 0 6.166 else 6.167 @@ -156,7 +169,8 @@ 6.168 do 6.169 if check_cpp_compiler "$COMP"; then 6.170 TOOLCHAIN_CXX=$COMP 6.171 - TOOLCHAIN_NAME=`"$TEMP_DIR/checkcc"` 6.172 + TOOLCHAIN=`"$TEMP_DIR/checkcc"` 6.173 + TOOLCHAIN_NAME=`echo "$TOOLCHAIN" | cut -f1 -d' ' -` 6.174 echo "$COMP" 6.175 return 0 6.176 fi
7.1 --- a/make/uwproj.xsd Wed Jan 17 21:01:50 2024 +0100 7.2 +++ b/make/uwproj.xsd Sat Jan 20 16:02:04 2024 +0100 7.3 @@ -3,7 +3,7 @@ 7.4 xmlns="http://unixwork.de/uwproj" 7.5 targetNamespace="http://unixwork.de/uwproj" 7.6 elementFormDefault="qualified" 7.7 - version="0.1" 7.8 + version="0.2" 7.9 > 7.10 <xs:element name="project" type="ProjectType"/> 7.11 7.12 @@ -102,9 +102,11 @@ 7.13 </p> 7.14 <p> 7.15 The optional <code>platform</code> attribute may specify a <em>single</em> platform identifier and 7.16 - the optional <code>not</code> attribute may specify a comma-separated list of platform identifiers. 7.17 - The configure script shall skip this dependency declaration if the detected platform is not 7.18 - matching the filter specification of these attributes. 7.19 + the optional <code>toolchain</code> attribute may specify a <em>single</em> toolchain. 7.20 + The optional <code>not</code> attribute may specify a comma-separated list of platform and/or 7.21 + toolchain identifiers. 7.22 + The configure script shall skip this dependency declaration if the detected platform and toolchain 7.23 + is not matching the filter specification of these attributes. 7.24 </p> 7.25 </xs:documentation> 7.26 </xs:annotation> 7.27 @@ -125,6 +127,7 @@ 7.28 </xs:choice> 7.29 <xs:attribute name="name" type="xs:string"/> 7.30 <xs:attribute name="platform" type="xs:string"/> 7.31 + <xs:attribute name="toolchain" type="xs:string"/> 7.32 <xs:attribute name="not" type="xs:string"/> 7.33 </xs:complexType> 7.34 7.35 @@ -186,6 +189,8 @@ 7.36 and is supposed to be automatically disabled (without error) when the dependencies are not satisfied. 7.37 The name that is supposed to be used for the --enable and --disable arguments can be optionally 7.38 specified with the <code>arg</code> attribute. Otherwise, the <code>name</code> is used by default. 7.39 + Optionally, a description for the help text of the resulting configure script can be specified by 7.40 + adding a <code>desc</code> element. 7.41 </xs:documentation> 7.42 </xs:annotation> 7.43 <xs:choice minOccurs="0" maxOccurs="unbounded"> 7.44 @@ -194,6 +199,7 @@ 7.45 <xs:attribute name="name" type="xs:string" use="required"/> 7.46 <xs:attribute name="arg" type="xs:string"/> 7.47 <xs:attribute name="default" type="xs:boolean" default="false"/> 7.48 + <xs:element name="desc" type="xs:string"/> 7.49 </xs:complexType> 7.50 7.51 <xs:complexType name="OptionType"> 7.52 @@ -278,4 +284,4 @@ 7.53 </xs:annotation> 7.54 <xs:restriction base="xs:string"/> 7.55 </xs:simpleType> 7.56 -</xs:schema> 7.57 \ No newline at end of file 7.58 +</xs:schema>