On 2006-3-2 21:51 UTC, Robert P. J. Day wrote: > > http://make.paulandlesley.org/multi-arch.html#advanced > > part of that makefile are the rules: > > Makefile : ; > %.mk :: ; > > % :: $(OBJDIR) ; : > > and the question is simply, do either of those last two rules > *require* the double colon as opposed to a single colon? i'm not > interested in issues of efficiency, just in absolute requirement.
Just efficiency, not correctness, unless I overlooked something in my experiments. Efficiency has more aspects than just speed. I believe that the commands in my makefiles run slowly enough (compiling template- heavy C++ code) to overwhelm any overhead that 'make' adds: remaking an already-up-to-date system takes only one second. The greatest benefit I see in the efficiency of double-colon rules here is that it makes 'make -d' output shorter, hence easier to read. Running my build system (based on the multi-arch example) with a 'show_flags' target whose rules run quickly, and selectively changing double to single colons, I see different savings for different double colons. I'm using 'make -d show_flag 2>&1 |wc' to measure "efficiency" as number of lines of debug output. > Makefile : ; A double colon in my equivalent of this line saves nine lines of debug output. > %.mk :: ; Nine lines saved here by the double colon. > % :: $(OBJDIR) ; : Here, I measure no difference. I write '; @:' for '; :' here. The biggest savings--almost two thousand lines--comes from using a double colon for autodependencies: -include *.d *.d:: ; Here's a part of my main makefile; I hope either that it helps you, or that someone helps me by pointing out any errors. # Included files that don't need to be remade are given explicit empty # commands, which significantly reduces the number of lines emitted by # 'make -d', making debug output easier to read. # # Included makefiles are cited by absolute pathname, e.g. # include $(src_dir)/included-file # $(src_dir)/included-file:: ; # An '--include-dir' option could make an absolute path unnecessary # in the 'include' statement itself, but the empty remake command # would not respect '--include-dir'. # # The double-colon rule elicits warnings like # Makefile `foo' might loop; not remaking it. # with 'make -d'. The "stupidly" comment at line 1745 of GNU make's # 'main.c' version 1.194 seems to suggest that writing such a rule is # a poor practice, but empty commands ought to be excused from that # inline comment, and perhaps even from that diagnostic. _______________________________________________ Help-make mailing list [email protected] http://lists.gnu.org/mailman/listinfo/help-make
