How to conditional set up a Makefile variable by testing if a file exists

后端 未结 1 600
时光说笑
时光说笑 2021-01-31 07:12

For example: I want:

if file1 exists:

CLEAN_SRC = *.h file3

else

CLEAN_SRC = 
相关标签:
1条回答
  • 2021-01-31 08:06

    If file1 does not exist then $(wildcard file1) will evaluate to an empty string.

    ifeq ($(wildcard file1),) 
        CLEAN_SRC =
    else 
        CLEAN_SRC = *.h file3
    endif 
    
    0 讨论(0)
提交回复
热议问题