How to check if a file exists in a makefile

后端 未结 3 1776
执笔经年
执笔经年 2021-02-13 06:40

I have a makefile template to compile a single DLL (for a plugin system). The makefile of the user looks like this:

EXTRA_SRCS=file1 file2
include makefile.in
         


        
3条回答
  •  星月不相逢
    2021-02-13 07:16

    Use the "wildcard" function:

    $(wildcard *.h)
    

    EDIT: in order to match a specific list, do

    $(wildcard $(HEADER_FILES))
    

    There is no need to use $(filter ...), the wildcard function automatically filters files which don't exist.

提交回复
热议问题