How to match double stem in target like %/% or other way?

前端 未结 2 1858
眼角桃花
眼角桃花 2021-01-22 03:53

I need to build targets with names like,

v1/thread4/foo  v1/thread8/foo v1/thread16/foo
v2/thread4/foo  v2/thread8/foo v2/thread16/foo

I want

2条回答
  •  执笔经年
    2021-01-22 04:18

    There is no way to have multiple patterns in GNU make.

    If your example above is actually reflective of what you want to do, it's simple enough, though:

    VLIST := 1 2
    TLIST := 4 8 16
    
    TARGETS := $(foreach V,$(VLIST),$(foreach T,$(TLIST),v$V/thread$T/foo))
    
    $(TARGETS): foo.cc $(HEADERS)
            $(CXX) $(CXXFLAGS) -DTHREAD=$* -o $@ $< $(LDLIBS)
    

提交回复
热议问题