headers-generated-default-cflags headers-nonexisting hooks \
idl ignore_errors includes invocation_dir libraries no-print-directory \
no_vpath omk_config override-config parallel_make programs \
-programs-cflags programs-cxxflags programs-cflags-cmdline programs-defs \
+programs-cflags programs-cxxflags programs-defs \
programs-test_PROGRAMS qt qt-qmake shlibs sources_dir \
sources_in_subdirectory sources_list subdirs_first \
subdirs_first-force-subdir use_leaf_makefiles vxworks whole_tree omkize
#!/bin/bash
-. ./functions.sh
+. ./wvtest.sh
-touch config.omk-default
-echo "CFLAGS=-DNUMBER=123" > config.omk
+create_files() {
+ cat > 'test.c' <<'EOF'
+#include <stdio.h>
+
+int main()
+{
+#ifdef NUMBER
+ printf("NUMBER is %d\n", NUMBER);
+#endif
+ return 0;
+}
+EOF
+ cat > 'Makefile.omk' <<'EOF'
+bin_PROGRAMS = test
+test_SOURCES = test.c
+EOF
+}
+
+grepout() {
+ if [ $OMK_RULES = linux ]; then
+ # The following should work only with Linux rules
+ _compiled/bin/test|grep $@
+ fi
+}
+
+set -o pipefail
+
+WVSTART "AM_CFLAGS"
+create_files
needs_valid_CC
-make||error "Can't compile"
-if [ $OMK_RULES = linux ]; then
- # The following should work only with Linux rules
- _compiled/bin/test|grep 123 || error "Custom CFLAGS didn't influence the output"
-fi
+WVPASS make AM_CFLAGS=-DNUMBER=123
+WVPASS grepout 123
+
+WVSTART "CFLAGS override AM_CFLAGS"
+create_files
+WVPASS make AM_CFLAGS=-DNUMBER=123 CFLAGS=-DNUMBER=321
+WVPASS grepout 321
+
+
+WVSTART "AM_CFLAGS in config.omk"
+create_files
+echo "AM_CFLAGS=-DNUMBER=123" > config.omk
+WVPASS make
+WVPASS grepout 123
+++ /dev/null
-#!/bin/bash
-
-. ./functions.sh
-
-touch config.omk-default
-needs_valid_CC
-make CFLAGS="-DNONSENSE=abc -DNUMBER=123"||error "Can't compile"
-if [ $OMK_RULES = linux ]; then
- # The following should work only with Linux rules
- _compiled/bin/test|grep 123 || error "Custom CFLAGS didn't influence the output"
-fi