The following makefile builds the test.o file in the specified directory (i.e. build), but fails to build the final target (i.e. test.exe) the first time make is executed because vpath somehow is ignored. However, when make is executed the second time, make finds the test.o and proceeds with test.exe normally.
[test]$ make
cc -c test.cpp -o build/test.o
echo "Dir: .; File: test.o"
Dir: .; File: test.o
cc -o build/test.exe test.o
cc: test.o: No such file or directory
cc: No input files
make: *** [test.exe] Error 1 [test]$ make
echo "Dir: build; File: test.o"
Dir: build; File: test.o
cc -o build/test.exe build/test.o
build/test.o: In function `LogonTest(void)':
build/test.o(.text+0x155): warning: setlogin is not implemented and will always fail
The version of the make utility is reported as:
GNU Make version 3.79.1, by Richard Stallman and Roland McGrath.
Built for i386-redhat-linux-gnu
Copyright (C) 1988, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 2000
Free Software Foundation, Inc.
If you have any further questions, please don't hesitate to ask.