do not generate flags when lang is not required - fixes #311

Mon, 02 Oct 2023 16:23:33 +0200

author
Mike Becker <universe@uap-core.de>
date
Mon, 02 Oct 2023 16:23:33 +0200
changeset 77
439902ff0af3
parent 76
620358ea3a0b
child 78
c3a62e0baa9e

do not generate flags when lang is not required - fixes #311

src/test/resources/golden-sample/configure file | annotate | diff | comparison | revisions
src/test/resources/golden-sample/configure2 file | annotate | diff | comparison | revisions
test/configure file | annotate | diff | comparison | revisions
test/make/configure.vm file | annotate | diff | comparison | revisions
--- a/src/test/resources/golden-sample/configure	Sun Sep 24 18:37:30 2023 +0200
+++ b/src/test/resources/golden-sample/configure	Mon Oct 02 16:23:33 2023 +0200
@@ -368,10 +368,10 @@
 
 # add general dependency flags to flags.mk
 echo "# general flags" >> "$TEMP_DIR/flags.mk"
-if [ -n "${TEMP_CFLAGS}" ]; then
+if [ -n "${TEMP_CFLAGS}" -a -n "$lang_c" ]; then
     echo "CFLAGS += $TEMP_CFLAGS" >> "$TEMP_DIR/flags.mk"
 fi
-if [ -n "${TEMP_CXXFLAGS}" ]; then
+if [ -n "${TEMP_CXXFLAGS}" -a -n "$lang_cpp" ]; then
     echo "CXXFLAGS += $TEMP_CXXFLAGS" >> "$TEMP_DIR/flags.mk"
 fi
 if [ -n "${TEMP_LDFLAGS}" ]; then
@@ -430,19 +430,27 @@
 fi
 
 
-if [ -n "${TEMP_CFLAGS}" ]; then
+if [ -n "${TEMP_CFLAGS}" -a -n "$lang_c" ]; then
     echo "CFLAGS  += $TEMP_CFLAGS" >> "$TEMP_DIR/flags.mk"
 fi
-if [ -n "${TEMP_CXXFLAGS}" ]; then
+if [ -n "${TEMP_CXXFLAGS}" -a -n "$lang_cpp" ]; then
     echo "CXXFLAGS  += $TEMP_CXXFLAGS" >> "$TEMP_DIR/flags.mk"
 fi
 if [ "$BUILD_TYPE" = "debug" ]; then
-    echo 'CFLAGS += ${DEBUG_CC_FLAGS}' >> "$TEMP_DIR/flags.mk"
-    echo 'CXXFLAGS += ${DEBUG_CXX_FLAGS}' >> "$TEMP_DIR/flags.mk"
+    if [ -n "$lang_c" ]; then
+        echo 'CFLAGS += ${DEBUG_CC_FLAGS}' >> "$TEMP_DIR/flags.mk"
+    fi
+    if [ -n "$lang_cpp" ]; then
+        echo 'CXXFLAGS += ${DEBUG_CXX_FLAGS}' >> "$TEMP_DIR/flags.mk"
+    fi
 fi
 if [ "$BUILD_TYPE" = "release" ]; then
-    echo 'CFLAGS += ${RELEASE_CC_FLAGS}' >> "$TEMP_DIR/flags.mk"
-    echo 'CXXFLAGS += ${RELEASE_CXX_FLAGS}' >> "$TEMP_DIR/flags.mk"
+    if [ -n "$lang_c" ]; then
+        echo 'CFLAGS += ${RELEASE_CC_FLAGS}' >> "$TEMP_DIR/flags.mk"
+    fi
+    if [ -n "$lang_cpp" ]; then
+        echo 'CXXFLAGS += ${RELEASE_CXX_FLAGS}' >> "$TEMP_DIR/flags.mk"
+    fi
 fi
 if [ -n "${TEMP_LDFLAGS}" ]; then
     echo "LDFLAGS += $TEMP_LDFLAGS" >> "$TEMP_DIR/flags.mk"
--- a/src/test/resources/golden-sample/configure2	Sun Sep 24 18:37:30 2023 +0200
+++ b/src/test/resources/golden-sample/configure2	Mon Oct 02 16:23:33 2023 +0200
@@ -464,10 +464,10 @@
 
 # add general dependency flags to flags.mk
 echo "# general flags" >> "$TEMP_DIR/flags.mk"
-if [ -n "${TEMP_CFLAGS}" ]; then
+if [ -n "${TEMP_CFLAGS}" -a -n "$lang_c" ]; then
     echo "CFLAGS += $TEMP_CFLAGS" >> "$TEMP_DIR/flags.mk"
 fi
-if [ -n "${TEMP_CXXFLAGS}" ]; then
+if [ -n "${TEMP_CXXFLAGS}" -a -n "$lang_cpp" ]; then
     echo "CXXFLAGS += $TEMP_CXXFLAGS" >> "$TEMP_DIR/flags.mk"
 fi
 if [ -n "${TEMP_LDFLAGS}" ]; then
@@ -652,19 +652,27 @@
     fi
 fi
 
-if [ -n "${TEMP_CFLAGS}" ]; then
+if [ -n "${TEMP_CFLAGS}" -a -n "$lang_c" ]; then
     echo "DAV_CFLAGS  += $TEMP_CFLAGS" >> "$TEMP_DIR/flags.mk"
 fi
-if [ -n "${TEMP_CXXFLAGS}" ]; then
+if [ -n "${TEMP_CXXFLAGS}" -a -n "$lang_cpp" ]; then
     echo "DAV_CXXFLAGS  += $TEMP_CXXFLAGS" >> "$TEMP_DIR/flags.mk"
 fi
 if [ "$BUILD_TYPE" = "debug" ]; then
-    echo 'DAV_CFLAGS += ${DEBUG_CC_FLAGS}' >> "$TEMP_DIR/flags.mk"
-    echo 'DAV_CXXFLAGS += ${DEBUG_CXX_FLAGS}' >> "$TEMP_DIR/flags.mk"
+    if [ -n "$lang_c" ]; then
+        echo 'DAV_CFLAGS += ${DEBUG_CC_FLAGS}' >> "$TEMP_DIR/flags.mk"
+    fi
+    if [ -n "$lang_cpp" ]; then
+        echo 'DAV_CXXFLAGS += ${DEBUG_CXX_FLAGS}' >> "$TEMP_DIR/flags.mk"
+    fi
 fi
 if [ "$BUILD_TYPE" = "release" ]; then
-    echo 'DAV_CFLAGS += ${RELEASE_CC_FLAGS}' >> "$TEMP_DIR/flags.mk"
-    echo 'DAV_CXXFLAGS += ${RELEASE_CXX_FLAGS}' >> "$TEMP_DIR/flags.mk"
+    if [ -n "$lang_c" ]; then
+        echo 'DAV_CFLAGS += ${RELEASE_CC_FLAGS}' >> "$TEMP_DIR/flags.mk"
+    fi
+    if [ -n "$lang_cpp" ]; then
+        echo 'DAV_CXXFLAGS += ${RELEASE_CXX_FLAGS}' >> "$TEMP_DIR/flags.mk"
+    fi
 fi
 if [ -n "${TEMP_LDFLAGS}" ]; then
     echo "DAV_LDFLAGS += $TEMP_LDFLAGS" >> "$TEMP_DIR/flags.mk"
@@ -685,19 +693,27 @@
 # Features
 
 
-if [ -n "${TEMP_CFLAGS}" ]; then
+if [ -n "${TEMP_CFLAGS}" -a -n "$lang_c" ]; then
     echo "CFLAGS  += $TEMP_CFLAGS" >> "$TEMP_DIR/flags.mk"
 fi
-if [ -n "${TEMP_CXXFLAGS}" ]; then
+if [ -n "${TEMP_CXXFLAGS}" -a -n "$lang_cpp" ]; then
     echo "CXXFLAGS  += $TEMP_CXXFLAGS" >> "$TEMP_DIR/flags.mk"
 fi
 if [ "$BUILD_TYPE" = "debug" ]; then
-    echo 'CFLAGS += ${DEBUG_CC_FLAGS}' >> "$TEMP_DIR/flags.mk"
-    echo 'CXXFLAGS += ${DEBUG_CXX_FLAGS}' >> "$TEMP_DIR/flags.mk"
+    if [ -n "$lang_c" ]; then
+        echo 'CFLAGS += ${DEBUG_CC_FLAGS}' >> "$TEMP_DIR/flags.mk"
+    fi
+    if [ -n "$lang_cpp" ]; then
+        echo 'CXXFLAGS += ${DEBUG_CXX_FLAGS}' >> "$TEMP_DIR/flags.mk"
+    fi
 fi
 if [ "$BUILD_TYPE" = "release" ]; then
-    echo 'CFLAGS += ${RELEASE_CC_FLAGS}' >> "$TEMP_DIR/flags.mk"
-    echo 'CXXFLAGS += ${RELEASE_CXX_FLAGS}' >> "$TEMP_DIR/flags.mk"
+    if [ -n "$lang_c" ]; then
+        echo 'CFLAGS += ${RELEASE_CC_FLAGS}' >> "$TEMP_DIR/flags.mk"
+    fi
+    if [ -n "$lang_cpp" ]; then
+        echo 'CXXFLAGS += ${RELEASE_CXX_FLAGS}' >> "$TEMP_DIR/flags.mk"
+    fi
 fi
 if [ -n "${TEMP_LDFLAGS}" ]; then
     echo "LDFLAGS += $TEMP_LDFLAGS" >> "$TEMP_DIR/flags.mk"
--- a/test/configure	Sun Sep 24 18:37:30 2023 +0200
+++ b/test/configure	Mon Oct 02 16:23:33 2023 +0200
@@ -368,10 +368,10 @@
 
 # add general dependency flags to flags.mk
 echo "# general flags" >> "$TEMP_DIR/flags.mk"
-if [ -n "${TEMP_CFLAGS}" ]; then
+if [ -n "${TEMP_CFLAGS}" -a -n "$lang_c" ]; then
     echo "CFLAGS += $TEMP_CFLAGS" >> "$TEMP_DIR/flags.mk"
 fi
-if [ -n "${TEMP_CXXFLAGS}" ]; then
+if [ -n "${TEMP_CXXFLAGS}" -a -n "$lang_cpp" ]; then
     echo "CXXFLAGS += $TEMP_CXXFLAGS" >> "$TEMP_DIR/flags.mk"
 fi
 if [ -n "${TEMP_LDFLAGS}" ]; then
@@ -430,19 +430,27 @@
 fi
 
 
-if [ -n "${TEMP_CFLAGS}" ]; then
+if [ -n "${TEMP_CFLAGS}" -a -n "$lang_c" ]; then
     echo "CFLAGS  += $TEMP_CFLAGS" >> "$TEMP_DIR/flags.mk"
 fi
-if [ -n "${TEMP_CXXFLAGS}" ]; then
+if [ -n "${TEMP_CXXFLAGS}" -a -n "$lang_cpp" ]; then
     echo "CXXFLAGS  += $TEMP_CXXFLAGS" >> "$TEMP_DIR/flags.mk"
 fi
 if [ "$BUILD_TYPE" = "debug" ]; then
-    echo 'CFLAGS += ${DEBUG_CC_FLAGS}' >> "$TEMP_DIR/flags.mk"
-    echo 'CXXFLAGS += ${DEBUG_CXX_FLAGS}' >> "$TEMP_DIR/flags.mk"
+    if [ -n "$lang_c" ]; then
+        echo 'CFLAGS += ${DEBUG_CC_FLAGS}' >> "$TEMP_DIR/flags.mk"
+    fi
+    if [ -n "$lang_cpp" ]; then
+        echo 'CXXFLAGS += ${DEBUG_CXX_FLAGS}' >> "$TEMP_DIR/flags.mk"
+    fi
 fi
 if [ "$BUILD_TYPE" = "release" ]; then
-    echo 'CFLAGS += ${RELEASE_CC_FLAGS}' >> "$TEMP_DIR/flags.mk"
-    echo 'CXXFLAGS += ${RELEASE_CXX_FLAGS}' >> "$TEMP_DIR/flags.mk"
+    if [ -n "$lang_c" ]; then
+        echo 'CFLAGS += ${RELEASE_CC_FLAGS}' >> "$TEMP_DIR/flags.mk"
+    fi
+    if [ -n "$lang_cpp" ]; then
+        echo 'CXXFLAGS += ${RELEASE_CXX_FLAGS}' >> "$TEMP_DIR/flags.mk"
+    fi
 fi
 if [ -n "${TEMP_LDFLAGS}" ]; then
     echo "LDFLAGS += $TEMP_LDFLAGS" >> "$TEMP_DIR/flags.mk"
--- a/test/make/configure.vm	Sun Sep 24 18:37:30 2023 +0200
+++ b/test/make/configure.vm	Mon Oct 02 16:23:33 2023 +0200
@@ -404,10 +404,10 @@
 
 # add general dependency flags to flags.mk
 echo "# general flags" >> "$TEMP_DIR/flags.mk"
-if [ -n "${TEMP_CFLAGS}" ]; then
+if [ -n "${TEMP_CFLAGS}" -a -n "$lang_c" ]; then
     echo "CFLAGS += $TEMP_CFLAGS" >> "$TEMP_DIR/flags.mk"
 fi
-if [ -n "${TEMP_CXXFLAGS}" ]; then
+if [ -n "${TEMP_CXXFLAGS}" -a -n "$lang_cpp" ]; then
     echo "CXXFLAGS += $TEMP_CXXFLAGS" >> "$TEMP_DIR/flags.mk"
 fi
 if [ -n "${TEMP_LDFLAGS}" ]; then
@@ -534,19 +534,27 @@
 fi
 #end
 
-if [ -n "${TEMP_CFLAGS}" ]; then
+if [ -n "${TEMP_CFLAGS}" -a -n "$lang_c" ]; then
     echo "${target.getCFlags()}  += $TEMP_CFLAGS" >> "$TEMP_DIR/flags.mk"
 fi
-if [ -n "${TEMP_CXXFLAGS}" ]; then
+if [ -n "${TEMP_CXXFLAGS}" -a -n "$lang_cpp" ]; then
     echo "${target.getCXXFlags()}  += $TEMP_CXXFLAGS" >> "$TEMP_DIR/flags.mk"
 fi
 if [ "$BUILD_TYPE" = "debug" ]; then
-    echo '${target.getCFlags()} += ${DEBUG_CC_FLAGS}' >> "$TEMP_DIR/flags.mk"
-    echo '${target.getCXXFlags()} += ${DEBUG_CXX_FLAGS}' >> "$TEMP_DIR/flags.mk"
+    if [ -n "$lang_c" ]; then
+        echo '${target.getCFlags()} += ${DEBUG_CC_FLAGS}' >> "$TEMP_DIR/flags.mk"
+    fi
+    if [ -n "$lang_cpp" ]; then
+        echo '${target.getCXXFlags()} += ${DEBUG_CXX_FLAGS}' >> "$TEMP_DIR/flags.mk"
+    fi
 fi
 if [ "$BUILD_TYPE" = "release" ]; then
-    echo '${target.getCFlags()} += ${RELEASE_CC_FLAGS}' >> "$TEMP_DIR/flags.mk"
-    echo '${target.getCXXFlags()} += ${RELEASE_CXX_FLAGS}' >> "$TEMP_DIR/flags.mk"
+    if [ -n "$lang_c" ]; then
+        echo '${target.getCFlags()} += ${RELEASE_CC_FLAGS}' >> "$TEMP_DIR/flags.mk"
+    fi
+    if [ -n "$lang_cpp" ]; then
+        echo '${target.getCXXFlags()} += ${RELEASE_CXX_FLAGS}' >> "$TEMP_DIR/flags.mk"
+    fi
 fi
 if [ -n "${TEMP_LDFLAGS}" ]; then
     echo "${target.getLDFlags()} += $TEMP_LDFLAGS" >> "$TEMP_DIR/flags.mk"

mercurial