How to conditionally set a Makefile variable by checking if a file exists

For example: I want:

if file1 exists:

CLEAN_SRC = *.h file3 

yet

 CLEAN_SRC = 
+48
makefile
Jul 03 '09 at 3:38
source share
1 answer

If file1 does not exist, then $(wildcard file1) will evaluate the empty string.

 ifeq ($(wildcard file1),) CLEAN_SRC = else CLEAN_SRC = *.h file3 endif 
+65
Jul 03 '09 at 4:02
source share



All Articles