Created
April 17, 2015 09:20
-
-
Save ndmitchell/aaef551b662fb715a258 to your computer and use it in GitHub Desktop.
Ninja phony behaviour
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ninja bar.txt # builds foo.txt and bar.txt | |
# touch foo.txt | |
# ninja bar.txt # builds nothing | |
rule create | |
command = cmd /c "echo $out > $out" | |
rule copy | |
command = cmd /c "copy $from $out" | |
build foo: phony foo.txt | |
build bar.txt: copy foo | |
from = foo.txt | |
build foo.txt: create |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ninja bar.txt # builds foo.txt and bar.txt | |
# touch foo.txt | |
# ninja bar.txt # builds bar.txt | |
rule create | |
command = cmd /c "echo $out > $out" | |
rule copy | |
command = cmd /c "copy $from $out" | |
rule phony2 | |
command = cmd /c "echo nothing to do" | |
build foo: phony2 foo.txt | |
build bar.txt: copy foo | |
from = foo.txt | |
build foo.txt: create |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment