What do $< and $@ mean in makefiles?

前端 未结 3 1708
时光说笑
时光说笑 2021-01-28 04:49

I have a.csv,b.csv, ... in a my docs/csv directory, I need convert each of this file to a json file.

I follow this question to wri

3条回答
  •  隐瞒了意图╮
    2021-01-28 05:37

    The trouble is that in this rule:

    $(DESTS): $(SRCS)
        ...
    

    every lua file depends on all csv files, which is not what I think you intend. And since $< expands to the first prerequisite, you get the same one (items.csv) for every target.

    Try this:

    all: $(DESTS)
    
    scripts/data/%.lua: docs/csv/%.csv 
        echo $@
        echo $<
    

提交回复
热议问题