4 ms·
"But because Make works backward from the object files to the source, we need to compute all the object files we want from our source files". No.... don't do t
by TickleSteve 10y ago
"But because Make works backward from the object files to the source, we need to compute all the object files we want from our source files".
No.... don't do this.
Make is intended to work the other way around... it finds the source from your targets.
Define your VPATH and let it find them.
This is what loads of people do and is why there are so many Makefiles are packed full of macro-magic!
- wyldfire 10y agoTotally agree, they should use VPATH. And that way they could've just skipped to the implicit rules version.
- Tyr42 10y agoI do agree that VPATH is helpful, but you'd still need to put the Makefile into the build directory in that case, which is distasteful, as it's not a built file. Also you can't really get around specifying the files or searching, unless you have one c file per executable.
- jimparis 10y agoProjects that make blind use of VPATH are a pain. You can't have the same filename in two different directories! It's a hack at best, and using explicit paths (as this Makefile does) is a lot more reliable.