Thu, 08 Jan 2026 18:16:15 +0100
toolchain.sh now generates defaults for all flags variables - resolves #767
| src/main/resources/make/cc.mk | file | annotate | diff | comparison | revisions | |
| src/main/resources/make/clang.mk | file | annotate | diff | comparison | revisions | |
| src/main/resources/make/gcc.mk | file | annotate | diff | comparison | revisions | |
| src/main/resources/make/suncc.mk | file | annotate | diff | comparison | revisions | |
| src/main/resources/make/toolchain.sh | file | annotate | diff | comparison | revisions | |
| test/make/cc.mk | file | annotate | diff | comparison | revisions | |
| test/make/clang.mk | file | annotate | diff | comparison | revisions | |
| test/make/gcc.mk | file | annotate | diff | comparison | revisions | |
| test/make/suncc.mk | file | annotate | diff | comparison | revisions | |
| test/make/toolchain.sh | file | annotate | diff | comparison | revisions |
--- a/src/main/resources/make/cc.mk Wed Dec 24 14:25:24 2025 +0100 +++ b/src/main/resources/make/cc.mk Thu Jan 08 18:16:15 2026 +0100 @@ -2,6 +2,11 @@ # cc toolchain config # +# How to use: +# - remove empty assignments and variables that you do not need +# - optionally: add toolchain specific variables and/or options +# - or: remove this file entirely (defaults will apply) +# - remove this comment CFLAGS = CXXFLAGS = DEBUG_CFLAGS = -g
--- a/src/main/resources/make/clang.mk Wed Dec 24 14:25:24 2025 +0100 +++ b/src/main/resources/make/clang.mk Thu Jan 08 18:16:15 2026 +0100 @@ -2,6 +2,11 @@ # clang toolchain config # +# How to use: +# - remove empty assignments and variables that you do not need +# - optionally: add toolchain specific variables and/or options +# - or: remove this file entirely (cc.mk or defaults will apply) +# - remove this comment CFLAGS = CXXFLAGS = DEBUG_CFLAGS = -g
--- a/src/main/resources/make/gcc.mk Wed Dec 24 14:25:24 2025 +0100 +++ b/src/main/resources/make/gcc.mk Thu Jan 08 18:16:15 2026 +0100 @@ -2,6 +2,11 @@ # gcc toolchain config # +# How to use: +# - remove empty assignments and variables that you do not need +# - optionally: add toolchain specific variables and/or options +# - or: remove this file entirely (cc.mk or defaults will apply) +# - remove this comment CFLAGS = CXXFLAGS = DEBUG_CFLAGS = -g
--- a/src/main/resources/make/suncc.mk Wed Dec 24 14:25:24 2025 +0100 +++ b/src/main/resources/make/suncc.mk Thu Jan 08 18:16:15 2026 +0100 @@ -2,6 +2,11 @@ # suncc toolchain # +# How to use: +# - remove empty assignments and variables that you do not need +# - optionally: add toolchain specific variables and/or options +# - or: remove this file entirely (cc.mk or defaults will apply) +# - remove this comment CFLAGS = CXXFLAGS = DEBUG_CFLAGS = -g
--- a/src/main/resources/make/toolchain.sh Wed Dec 24 14:25:24 2025 +0100 +++ b/src/main/resources/make/toolchain.sh Thu Jan 08 18:16:15 2026 +0100 @@ -162,21 +162,66 @@ fi } +is_flag_not_specified() +{ + # 1: flag to test + # 2: toolchain.mk file + if [ -n "$2" ] && grep "^ *$1 *=" "$2" > /dev/null; then + return 1 + else + return 0 + fi +} + write_toolchain_defaults() { + if [ -f "make/${TOOLCHAIN_NAME}.mk" ]; then + mkfile="make/${TOOLCHAIN_NAME}.mk" + elif [ -f 'make/cc.mk' ]; then + mkfile='make/cc.mk' + else + mkfile='' + fi + echo "# toolchain" >> "$1" if [ -n "$TOOLCHAIN_CC" ]; then echo "CC = ${TOOLCHAIN_CC}" >> "$1" + if is_flag_not_specified 'CFLAGS' "$mkfile"; then + echo 'CFLAGS =' >> "$1" + fi + if is_flag_not_specified 'DEBUG_CFLAGS' "$mkfile"; then + echo 'DEBUG_CFLAGS = -g' >> "$1" + fi + if is_flag_not_specified 'RELEASE_CFLAGS' "$mkfile"; then + echo 'RELEASE_CFLAGS = -O3 -DNDEBUG' >> "$1" + fi + if is_flag_not_specified 'SHLIB_CFLAGS' "$mkfile"; then + echo 'SHLIB_CFLAGS = -fPIC' >> "$1" + fi fi if [ -n "$TOOLCHAIN_CXX" ]; then echo "CXX = ${TOOLCHAIN_CXX}" >> "$1" + if is_flag_not_specified 'CXXFLAGS' "$mkfile"; then + echo 'CXXFLAGS =' >> "$1" + fi + if is_flag_not_specified 'DEBUG_CXXFLAGS' "$mkfile"; then + echo 'DEBUG_CXXFLAGS = -g' >> "$1" + fi + if is_flag_not_specified 'RELEASE_CXXFLAGS' "$mkfile"; then + echo 'RELEASE_CXXFLAGS = -O3 -DNDEBUG' >> "$1" + fi + if is_flag_not_specified 'SHLIB_CXXFLAGS' "$mkfile"; then + echo 'SHLIB_CXXFLAGS = -fPIC' >> "$1" + fi + fi + if is_flag_not_specified 'LDFLAGS' "$mkfile"; then + echo 'LDFLAGS =' >> "$1" + fi + if is_flag_not_specified 'SHLIB_LDFLAGS' "$mkfile"; then + echo 'SHLIB_LDFLAGS = -shared' >> "$1" fi echo >> "$1" - if [ -f "make/${TOOLCHAIN_NAME}.mk" ]; then - cat "make/${TOOLCHAIN_NAME}.mk" >> "$1" - elif [ -f "make/cc.mk" ]; then - cat "make/cc.mk" >> "$1" - else - echo "!!! WARNING !!! Default toolchain flags not found. Configuration might be incomplete." + if [ -n "$mkfile" ]; then + cat "$mkfile" >> "$1" fi }
--- a/test/make/cc.mk Wed Dec 24 14:25:24 2025 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,14 +0,0 @@ -# -# cc toolchain config -# - -CFLAGS = -CXXFLAGS = -DEBUG_CFLAGS = -g -DEBUG_CXXFLAGS = -g -RELEASE_CFLAGS = -O3 -DNDEBUG -RELEASE_CXXFLAGS = -O3 -DNDEBUG -LDFLAGS = - -SHLIB_CFLAGS = -fPIC -SHLIB_LDFLAGS = -shared
--- a/test/make/clang.mk Wed Dec 24 14:25:24 2025 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,14 +0,0 @@ -# -# clang toolchain config -# - -CFLAGS = -CXXFLAGS = -DEBUG_CFLAGS = -g -DEBUG_CXXFLAGS = -g -RELEASE_CFLAGS = -O3 -DNDEBUG -RELEASE_CXXFLAGS = -O3 -DNDEBUG -LDFLAGS = - -SHLIB_CFLAGS = -fPIC -SHLIB_LDFLAGS = -shared
--- a/test/make/gcc.mk Wed Dec 24 14:25:24 2025 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,15 +0,0 @@ -# -# gcc toolchain config -# - -CFLAGS = -CXXFLAGS = -DEBUG_CFLAGS = -g -DEBUG_CXXFLAGS = -g -RELEASE_CFLAGS = -O3 -DNDEBUG -RELEASE_CXXFLAGS = -O3 -DNDEBUG -LDFLAGS = - -SHLIB_CFLAGS = -fPIC -SHLIB_LDFLAGS = -shared -
--- a/test/make/suncc.mk Wed Dec 24 14:25:24 2025 +0100 +++ b/test/make/suncc.mk Thu Jan 08 18:16:15 2026 +0100 @@ -2,14 +2,6 @@ # suncc toolchain # -CFLAGS = -CXXFLAGS = -DEBUG_CFLAGS = -g -DEBUG_CXXFLAGS = -g -RELEASE_CFLAGS = -O3 -DNDEBUG -RELEASE_CXXFLAGS = -O3 -DNDEBUG -LDFLAGS = - SHLIB_CFLAGS = -Kpic SHLIB_LDFLAGS = -G
--- a/test/make/toolchain.sh Wed Dec 24 14:25:24 2025 +0100 +++ b/test/make/toolchain.sh Thu Jan 08 18:16:15 2026 +0100 @@ -162,21 +162,66 @@ fi } +is_flag_not_specified() +{ + # 1: flag to test + # 2: toolchain.mk file + if [ -n "$2" ] && grep "^ *$1 *=" "$2" > /dev/null; then + return 1 + else + return 0 + fi +} + write_toolchain_defaults() { + if [ -f "make/${TOOLCHAIN_NAME}.mk" ]; then + mkfile="make/${TOOLCHAIN_NAME}.mk" + elif [ -f 'make/cc.mk' ]; then + mkfile='make/cc.mk' + else + mkfile='' + fi + echo "# toolchain" >> "$1" if [ -n "$TOOLCHAIN_CC" ]; then echo "CC = ${TOOLCHAIN_CC}" >> "$1" + if is_flag_not_specified 'CFLAGS' "$mkfile"; then + echo 'CFLAGS =' >> "$1" + fi + if is_flag_not_specified 'DEBUG_CFLAGS' "$mkfile"; then + echo 'DEBUG_CFLAGS = -g' >> "$1" + fi + if is_flag_not_specified 'RELEASE_CFLAGS' "$mkfile"; then + echo 'RELEASE_CFLAGS = -O3 -DNDEBUG' >> "$1" + fi + if is_flag_not_specified 'SHLIB_CFLAGS' "$mkfile"; then + echo 'SHLIB_CFLAGS = -fPIC' >> "$1" + fi fi if [ -n "$TOOLCHAIN_CXX" ]; then echo "CXX = ${TOOLCHAIN_CXX}" >> "$1" + if is_flag_not_specified 'CXXFLAGS' "$mkfile"; then + echo 'CXXFLAGS =' >> "$1" + fi + if is_flag_not_specified 'DEBUG_CXXFLAGS' "$mkfile"; then + echo 'DEBUG_CXXFLAGS = -g' >> "$1" + fi + if is_flag_not_specified 'RELEASE_CXXFLAGS' "$mkfile"; then + echo 'RELEASE_CXXFLAGS = -O3 -DNDEBUG' >> "$1" + fi + if is_flag_not_specified 'SHLIB_CXXFLAGS' "$mkfile"; then + echo 'SHLIB_CXXFLAGS = -fPIC' >> "$1" + fi + fi + if is_flag_not_specified 'LDFLAGS' "$mkfile"; then + echo 'LDFLAGS =' >> "$1" + fi + if is_flag_not_specified 'SHLIB_LDFLAGS' "$mkfile"; then + echo 'SHLIB_LDFLAGS = -shared' >> "$1" fi echo >> "$1" - if [ -f "make/${TOOLCHAIN_NAME}.mk" ]; then - cat "make/${TOOLCHAIN_NAME}.mk" >> "$1" - elif [ -f "make/cc.mk" ]; then - cat "make/cc.mk" >> "$1" - else - echo "!!! WARNING !!! Default toolchain flags not found. Configuration might be incomplete." + if [ -n "$mkfile" ]; then + cat "$mkfile" >> "$1" fi }