I do not want to run the compiler twice or have a separate make depend target. 
The pattern rule exactly matches what the compiler is doing: from a .c file 
create a .d and .o at the same time.

A list of .d files is calculated and make includes them. If they are not there 
this forces make to create the .d files. The .o files are also created. Then 
make builds its main goal, finds the .o files are already done and runs the 
linker or librarian.

What is your alternative? How can what I suggested be harmful?

Philip Guenther wrote:
On Wed, Nov 11, 2009 at 3:25 PM, John Fisher <[email protected]> wrote:
...
My style uses a pattern rule like this

%.d %.o: %.c

and the -MMD switch to the GNU C compiler to create dependencies and object
files at the same time.

The latter (-MMD) is a good choice, yes.

The former (using a multiple target pattern rule that has %.d as a
target) is pointless or even harmful in my experience.  What are your
reasons for doing that?


Philip Guenther



_______________________________________________
Help-make mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-make

Reply via email to