Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Ninja phony behaviour
# 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
# 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