2013-05-01 137 views
0

如果在工作區中找到另一個文件,是否可以添加先決條件?或者我還能如何實現以下想法?基本上,如果我的工作區有一個LCF文件中的特定位置,我需要另一個文件..事情是這樣的:根據條件添加先決條件

lcf := ../base_sw/lcf/base.lcf 

.PHONY : 
all : $(objects) 

# if $(lcf) file exists then 
all : $(objects) sup.a2l 

sup.a2l : 
    # Perl script runs here to produce sup.a2l 
    @echo Chris > [email protected] 

回答

1

這應做到:

lcf := $(wildcard ../base_sw/lcf/base.lcf) 

.PHONY : 
all : $(objects) $(lcf) 
0

想我已經成功地回答這一個我自己!

lcf := $(wildcard ../base_sw/lcf/base.lcf) 

開始構建需要做的文件:如果LCF文件不存在

通配符功能沒有返回

make_these_file := $(obejcts) 

如果LCF變量不爲空,附加到文件列表:

ifneq ($(lcf),) 
    make_these_file += sup.a2l 
endif 

現在我們的目標文件需要製作:

.PHONY : 
all : $(make_these_file) 

sup.a2l : 
    # Perl script here to produce sup.a2l 
    @echo Chris > [email protected] 

適用於我:)