Tue, 12 Sep 2023 23:36:45 +0200
add debug/release options - fixes #285
--- a/src/test/resources/golden-sample/configure Tue Sep 12 22:42:12 2023 +0200 +++ b/src/test/resources/golden-sample/configure Tue Sep 12 23:36:45 2023 +0200 @@ -66,6 +66,7 @@ # # parse arguments # +BUILD_TYPE="default" for ARG in "$@" do case "$ARG" in @@ -83,6 +84,8 @@ "--infodir="*) INFODIR=${ARG#--infodir=} ;; "--mandir"*) MANDIR=${ARG#--mandir} ;; "--help"*) printhelp; rm -Rf "$TEMP_DIR"; exit 1 ;; + "--debug") BUILD_TYPE="debug" ;; + "--release") BUILD_TYPE="release" ;; "--enable-pg") FEATURE_PG=on ;; "--disable-pg") unset FEATURE_PG ;; "-"*) echo "unknown option: $ARG"; rm -Rf "$TEMP_DIR"; exit 1 ;; @@ -415,6 +418,14 @@ if [ -n "${TEMP_CXXFLAGS}" ]; then echo "CXXFLAGS += $TEMP_CXXFLAGS" >> "$TEMP_DIR/config.mk" fi +if [ "$BUILD_TYPE" = "debug" ]; then + echo 'CFLAGS += ${DEBUG_FLAGS}' >> "$TEMP_DIR/config.mk" + echo 'CXXFLAGS += ${DEBUG_FLAGS}' >> "$TEMP_DIR/config.mk" +fi +if [ "$BUILD_TYPE" = "release" ]; then + echo 'CFLAGS += ${RELEASE_FLAGS}' >> "$TEMP_DIR/config.mk" + echo 'CXXFLAGS += ${RELEASE_FLAGS}' >> "$TEMP_DIR/config.mk" +fi if [ -n "${TEMP_LDFLAGS}" ]; then echo "LDFLAGS += $TEMP_LDFLAGS" >> "$TEMP_DIR/config.mk" fi
--- a/src/test/resources/golden-sample/configure2 Tue Sep 12 22:42:12 2023 +0200 +++ b/src/test/resources/golden-sample/configure2 Tue Sep 12 23:36:45 2023 +0200 @@ -56,6 +56,8 @@ --mandir=DIR man documentation [DATAROOTDIR/man] Options: + --debug add extra compile flags for debug builds + --release add extra compile flags for release builds --toolkit=(gtk3|cli|gtk2|wpf) Optional Features: @@ -68,6 +70,7 @@ # # parse arguments # +BUILD_TYPE="default" for ARG in "$@" do case "$ARG" in @@ -85,6 +88,8 @@ "--infodir="*) INFODIR=${ARG#--infodir=} ;; "--mandir"*) MANDIR=${ARG#--mandir} ;; "--help"*) printhelp; rm -Rf "$TEMP_DIR"; exit 1 ;; + "--debug") BUILD_TYPE="debug" ;; + "--release") BUILD_TYPE="release" ;; "--toolkit="*) OPT_TOOLKIT=${ARG#--toolkit=} ;; "--enable-db") FEATURE_DB=on ;; "--disable-db") unset FEATURE_DB ;; @@ -670,6 +675,14 @@ if [ -n "${TEMP_CXXFLAGS}" ]; then echo "DAV_CXXFLAGS += $TEMP_CXXFLAGS" >> "$TEMP_DIR/config.mk" fi +if [ "$BUILD_TYPE" = "debug" ]; then + echo 'DAV_CFLAGS += ${DEBUG_FLAGS}' >> "$TEMP_DIR/config.mk" + echo 'DAV_CXXFLAGS += ${DEBUG_FLAGS}' >> "$TEMP_DIR/config.mk" +fi +if [ "$BUILD_TYPE" = "release" ]; then + echo 'DAV_CFLAGS += ${RELEASE_FLAGS}' >> "$TEMP_DIR/config.mk" + echo 'DAV_CXXFLAGS += ${RELEASE_FLAGS}' >> "$TEMP_DIR/config.mk" +fi if [ -n "${TEMP_LDFLAGS}" ]; then echo "DAV_LDFLAGS += $TEMP_LDFLAGS" >> "$TEMP_DIR/config.mk" fi @@ -695,6 +708,14 @@ if [ -n "${TEMP_CXXFLAGS}" ]; then echo "CXXFLAGS += $TEMP_CXXFLAGS" >> "$TEMP_DIR/config.mk" fi +if [ "$BUILD_TYPE" = "debug" ]; then + echo 'CFLAGS += ${DEBUG_FLAGS}' >> "$TEMP_DIR/config.mk" + echo 'CXXFLAGS += ${DEBUG_FLAGS}' >> "$TEMP_DIR/config.mk" +fi +if [ "$BUILD_TYPE" = "release" ]; then + echo 'CFLAGS += ${RELEASE_FLAGS}' >> "$TEMP_DIR/config.mk" + echo 'CXXFLAGS += ${RELEASE_FLAGS}' >> "$TEMP_DIR/config.mk" +fi if [ -n "${TEMP_LDFLAGS}" ]; then echo "LDFLAGS += $TEMP_LDFLAGS" >> "$TEMP_DIR/config.mk" fi
--- a/test/configure Tue Sep 12 22:42:12 2023 +0200 +++ b/test/configure Tue Sep 12 23:36:45 2023 +0200 @@ -66,6 +66,7 @@ # # parse arguments # +BUILD_TYPE="default" for ARG in "$@" do case "$ARG" in @@ -83,6 +84,8 @@ "--infodir="*) INFODIR=${ARG#--infodir=} ;; "--mandir"*) MANDIR=${ARG#--mandir} ;; "--help"*) printhelp; rm -Rf "$TEMP_DIR"; exit 1 ;; + "--debug") BUILD_TYPE="debug" ;; + "--release") BUILD_TYPE="release" ;; "--enable-pg") FEATURE_PG=on ;; "--disable-pg") unset FEATURE_PG ;; "-"*) echo "unknown option: $ARG"; rm -Rf "$TEMP_DIR"; exit 1 ;; @@ -415,6 +418,14 @@ if [ -n "${TEMP_CXXFLAGS}" ]; then echo "CXXFLAGS += $TEMP_CXXFLAGS" >> "$TEMP_DIR/config.mk" fi +if [ "$BUILD_TYPE" = "debug" ]; then + echo 'CFLAGS += ${DEBUG_FLAGS}' >> "$TEMP_DIR/config.mk" + echo 'CXXFLAGS += ${DEBUG_FLAGS}' >> "$TEMP_DIR/config.mk" +fi +if [ "$BUILD_TYPE" = "release" ]; then + echo 'CFLAGS += ${RELEASE_FLAGS}' >> "$TEMP_DIR/config.mk" + echo 'CXXFLAGS += ${RELEASE_FLAGS}' >> "$TEMP_DIR/config.mk" +fi if [ -n "${TEMP_LDFLAGS}" ]; then echo "LDFLAGS += $TEMP_LDFLAGS" >> "$TEMP_DIR/config.mk" fi
--- a/test/make/clang.mk Tue Sep 12 22:42:12 2023 +0200 +++ b/test/make/clang.mk Tue Sep 12 23:36:45 2023 +0200 @@ -2,8 +2,10 @@ # clang toolchain config # -CFLAGS = -LDFLAGS = +CFLAGS = +DEBUG_FLAGS = -g +RELEASE_FLAGS = -O3 -DNDEBUG +LDFLAGS = SHLIB_CFLAGS = -fPIC SHLIB_LDFLAGS = -shared
--- a/test/make/configure.vm Tue Sep 12 22:42:12 2023 +0200 +++ b/test/make/configure.vm Tue Sep 12 23:36:45 2023 +0200 @@ -94,6 +94,8 @@ #if( $options.size() > 0 ) Options: + --debug add extra compile flags for debug builds + --release add extra compile flags for release builds #foreach( $opt in $options ) --${opt.getArgument()}=${opt.getValuesString()} #end @@ -116,6 +118,7 @@ # # parse arguments # +BUILD_TYPE="default" #set( $D = '$' ) for ARG in "$@" do @@ -134,6 +137,8 @@ "--infodir="*) INFODIR=${D}{ARG#--infodir=} ;; "--mandir"*) MANDIR=${D}{ARG#--mandir} ;; "--help"*) printhelp; rm -Rf "$TEMP_DIR"; exit 1 ;; + "--debug") BUILD_TYPE="debug" ;; + "--release") BUILD_TYPE="release" ;; #foreach( $opt in $options ) "--${opt.getArgument()}="*) ${opt.getVarName()}=${D}{ARG#--${opt.getArgument()}=} ;; #end @@ -588,6 +593,14 @@ if [ -n "${TEMP_CXXFLAGS}" ]; then echo "${target.getCXXFlags()} += $TEMP_CXXFLAGS" >> "$TEMP_DIR/config.mk" fi +if [ "$BUILD_TYPE" = "debug" ]; then + echo '${target.getCFlags()} += ${DEBUG_FLAGS}' >> "$TEMP_DIR/config.mk" + echo '${target.getCXXFlags()} += ${DEBUG_FLAGS}' >> "$TEMP_DIR/config.mk" +fi +if [ "$BUILD_TYPE" = "release" ]; then + echo '${target.getCFlags()} += ${RELEASE_FLAGS}' >> "$TEMP_DIR/config.mk" + echo '${target.getCXXFlags()} += ${RELEASE_FLAGS}' >> "$TEMP_DIR/config.mk" +fi if [ -n "${TEMP_LDFLAGS}" ]; then echo "${target.getLDFlags()} += $TEMP_LDFLAGS" >> "$TEMP_DIR/config.mk" fi
--- a/test/make/gcc.mk Tue Sep 12 22:42:12 2023 +0200 +++ b/test/make/gcc.mk Tue Sep 12 23:36:45 2023 +0200 @@ -2,7 +2,9 @@ # gcc toolchain config # -CFLAGS = +CFLAGS = +DEBUG_FLAGS = -g +RELEASE_FLAGS = -O3 -DNDEBUG LDFLAGS = SHLIB_CFLAGS = -fPIC