makefile - How to filter out a file from wildcard match when an environment is not set -
i using gnu make.
i have version this:
mylist := $(filter-out $(if $(filter 1,$(exclude_file1)), file1.c),$(wildcard *.c))
it works well: when filter out "file1.c", set environment variable, exclude_file1.
now want opposite: when environment variable not set, want exclude file1.c.
could point me should change?
mylist := $(filter-out $(if $(filter undefined,$(origin exclude_file1)),,file1.c),$(wildcard *.c))
or
mylist := $(filter-out $(if $(filter-out undefined,$(origin exclude_file1)),file1.c),$(wildcard *.c))
or
mylist := $(filter-out $(if ${exclude_file1},,file1.c),$(wildcard *.c))
etc.
one advantage of first 2 formulations don't generate message when useful --warn-undefined-variables
in effect.
Comments
Post a Comment