Make

Make is a build tool, docs. Its main purpse is compile/create/update file (targets), through commands/steps (rules) based on other files (dependencies). Rules need to be indented by TABs in order for make to differentiate between build commands and make syntax

<target>: <dependcies>
    <rule>

e.g. Create the file/target name.txt write the date to it and any content from ncont.txt

name.txt: ncont.txt
    date >> name.txt
    cat ncont.txt >> name.txt

Multiple targets

Create multiple files from the same rule/recipe With this filesystem:

ls
1.be  2.be  3.be  Makefile  name.txt  ncont.txt

And this rule Static Pattern Rules also Pitfalls of Using Wildcards

*.be: ncont.txt
    date >> $@
    echo "Wildcarding" >> $@
    cat ncont.txt >> $@

*.be will find all 3 files, but $@ will only evaluate to the first target 1.be

Last updated