+#!/bin/bash
+
+. ./functions.sh
+
+cat > 'test.cc' <<'EOF'
+#include <stdio.h>
+
+int main()
+{
+#if NUMBER == 123
+ printf("NUMBER is %d\n", NUMBER);
+#else
+# error No NUMBER defined
+#endif
+ return 0;
+}
+EOF
+
+cat > 'Makefile.omk' <<'EOF'
+bin_PROGRAMS = test
+
+test_SOURCES = test.cc
+EOF
+
+needs_valid_CC
+WVPASS make CXXFLAGS=-DNUMBER=123
+
+if [ $OMK_RULES = linux ]; then
+ # The following should work only with Linux rules
+ _compiled/bin/test|grep 123 || error "Custom CXXFLAGS didn't influence the output"
+fi