What do $< and $@ mean in makefiles?

前端 未结 3 1702
时光说笑
时光说笑 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:54

    The GNU make man page on Automatic Variables is extremely useful. Here's what it says:

    $@

    The file name of the target of the rule. If the target is an archive member, then ‘$@’ is the name of the archive file. In a pattern rule that has multiple targets (see Introduction to Pattern Rules), ‘$@’ is the name of whichever target caused the rule's recipe to be run.

    $<

    The name of the first prerequisite. If the target got its recipe from an implicit rule, this will be the first prerequisite added by the implicit rule (see Implicit Rules).

    Incidentally, you probably want to write your make rule as a pattern rule instead:

    %.lua : %.csv
        
    

提交回复
热议问题