]> git.tuebingen.mpg.de Git - paraslash.git/commit
build: Let .d files depend only on .c.
authorAndre Noll <maan@tuebingen.mpg.de>
Sat, 16 Jul 2016 20:24:12 +0000 (22:24 +0200)
committerAndre Noll <maan@tuebingen.mpg.de>
Sun, 26 Mar 2017 09:02:28 +0000 (11:02 +0200)
commit9059ae879362cbab03c5c0892143799ca881e47b
tree70ab75852f7c5528e94f8f4c203f3b0c813486ec
parent1be3886508d2fe35df06e97336598d11bf2dd965
build: Let .d files depend only on .c.

Currently we let each .d file depend on the same set of files as the
.o file by having two targets specified as arguments to -MT options
in the cc command that creates the .d file: one for the .d file and
one for the .o file.

This approach runs into problems if header files are removed and the
now stale .d file depends on a file which no longer exists.

It is enough to let the .d file depend only on the corresponding
.c file. In case an included file changes or is removed, the .c
file changes as well, so we already know we must build the object
file and can update the .d file at the same time, without running
cc twice. The -MMD option which is added to the usual cc command
instructs the compiler to create both the .d and the .o file in one go.

When creating the .o and .d files simultaneously, we don't need a
sed command to prepend the directory containing the .lsg.h headers
as these files are prerequisites of the object file being created,
so they are known to exist when the cc command is executed.
Makefile.real