Why not add files without rebuilding the program
Heime <[email protected]> Thu, 30 Apr 2026 22:30:48 +0000
| Newsgroups | gmane.comp.gnu.make.general |
|---|---|
| Message-ID | <ecibfHrq3hOYrwVNSwLnjE7G2VSmVM46vtfsEZ_aV7zOrhE5FwxTD6vHDHn51-32RvWj0H8Bvlsz_EnxegePSlTVBnwtZq_UgmVtlSQb4do=@protonmail.com> |
I have a problem understanding the utility of order-only dependencies=20
in make.
For example, consider
obj/main.o: main.c | obj/
gcc -c main.c -o obj/main.o
=20
obj/:
mkdir -p obj
obj/ is built before obj/main.o, but updates to obj/ (e.g., adding=20
files) won't trigger a rebuild of obj/main.o.
Why would one add files if the program will not be rebuilt? I think
that if files are added to a build directory, they are included because
they are needed for updating the program.