#!/bin/bash . ./wvtest.sh create_files() { cat > 'test.c' <<'EOF' #include 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 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