help-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Why don't more makefiles use rules like this: %.d %.o: %.c


From: John Fisher
Subject: Why don't more makefiles use rules like this: %.d %.o: %.c
Date: Thu, 12 Nov 2009 10:25:55 +1100
User-agent: Thunderbird 2.0.0.21 (Windows/20090302)

Some years ago I developed my own style for GNU makefiles from scratch, without 
reference to existing technology. In more recent years I've come across other 
styles of writing makefiles, and advice for developing them.

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. This seems a lot more reliable and performs better than 
the other styles I have seen. Compilation is forced by the inclusion of the .d 
files rather than the target. I use MAKECMDGOALS to stop inclusion of the .d 
files when making clean.

Has anyone else considered or experimented with this style?
If so do they like it or have they rejected it?
If they have rejected it for what reason?




reply via email to

[Prev in Thread] Current Thread [Next in Thread]