#!/usr/bin/env bash rm -f foo.* echo ' # project dir p = '"$PWD"' # object dir o = '"$PWD"' rule cp command = cp $in $out rule cc depfile = $out.d deps = gcc command = cc -c $in -o $out -MD -MT $out -MF $out.d build all: phony $o/foo.o build $p/foo.h: cp $p/foo.h.in IN = $o/foo.h.in build $o/foo.o: cc $p/foo.c || $p/foo.h # A relative path works as expected: #IN = foo.c # An absolute path shows the bug ? IN = "$p/foo.c" default all ' > build.ninja echo ' #include "foo.h" int main(void) { return 0; } ' > foo.c >foo.h.in echo 'initial build:' ninja echo '--------------------------------------------------' echo 'sleep to ensure timestamp change' sleep 1 echo '--------------------------------------------------' echo 'modify input' touch foo.h.in echo '--------------------------------------------------' echo 'should fully rebuild:' ninja -v -d explain echo '--------------------------------------------------' echo 'should build nothing:' ninja -v -d explain echo '--------------------------------------------------' echo 'should build nothing again:' ninja -v -d explain