I have a question regarding the behavior of Make when running targets that are dependent on generated files.
Given the source tree and Makefile below, when I run this it takes two runs to complete the "build" even though everything was generated on the first run.
$ ls -R
.:
bar foo Makefile
Makefile
all: foobar
work:
mkdir -p work
work/foo: work foo
cp foo work/foo
work/bar: work bar
cp bar work/bar
foobar: work/foo work/bar
make
$ make
mkdir -p work
cp foo work/foo
cp bar work/bar
$ ls -R
.:
work/ bar CMakeLists.txt foo Makefile
./work:
bar foo
$ make
cp foo work/foo
$ make
make: Nothing to be done for 'all'.
Why does this happen?