Makefile: fold MISC_H into LIB_H

We keep a list of most of the header files in LIB_H, but some are split out into MISC_H. The original point of LIB_H was that it would force recompilation of C files when any of the library headers changed. It was over-encompassing, since not all C files included all of the library headers; this made it simple to maintain, but meant that we sometimes recompiled when it was not necessary. Over time, some new headers were omitted from LIB_H, and rules were added to the Makefile for a few specific targets to explicitly depend on them. This avoided some unnecessary recompilation at the cost of having to maintain the dependency list of those targets manually (e.g., d349a03). Later, we needed a complete list of headers from which we should extract strings to localized. Thus 1b8b2e4 introduced MISC_H to mention all header files not included in LIB_H, and the concatenation of the two lists is fed to xgettext. Headers mentioned as dependencies must also be manually added to MISC_H to receive the benefits of localization. Having to update multiple locations manually is a pain and has led to errors. For example, see "git log -Swt-status.h Makefile" for some back-and-forth between the two locations. Or the fact that column.h was never added to MISC_H, and therefore was not localized (which is fixed by this patch). Moreover, the benefits of keeping these few headers out of LIB_H is not that great, for two reasons: 1. The better way to do this is by auto-computing the dependencies, which is more accurate and less work to maintain. If your compiler supports it, we turn on computed header dependencies by default these days. So these manual dependencies are used only for people who do not have gcc at all (which increases the chance of them becoming stale, as many developers will never even use them). 2. Even if you do not have gcc, the manual header dependencies do not help all that much. They obviously cannot help with an initial compilation (since their purpose is to avoid unnecessary recompilation when a header changes), which means they are only useful when building a new version of git in the working tree that held an existing build (e.g., after checkout or during a bisection). But since a change of a header in LIB_H will force recompilation, and given that the vast majority of headers are in LIB_H, most version changes will result in a full rebuild anyway. Let's just fold MISC_H into LIB_H and get rid of these manual rules. The worst case is some extra compilation, but even that is unlikely to matter due to the reasons above. The one exception is that we should keep common-cmds.h separate. Because it is generated, the computed dependencies do not handle it properly, and we must keep separate individual dependencies on it. Let's therefore rename MISC_H to GENERATED_H to make it more clear what should go in it. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Jeff King committed Jun 20, 2012 at 14:30 UTC b8ba629264b85a2daf0df9c61d00873988d006b7
1 file changed +16 -29
Makefile
+16 -29
@@ -397,7 +397,7 @@ XDIFF_OBJS =
397 VCSSVN_H =
398 VCSSVN_OBJS =
399 VCSSVN_TEST_OBJS =
400 -MISC_H =
400 +GENERATED_H =
401 EXTRA_CPPFLAGS =
402 LIB_H =
403 LIB_OBJS =
@@ -574,30 +574,22 @@ VCSSVN_H += vcs-svn/fast_export.h
574 VCSSVN_H += vcs-svn/svndiff.h
575 VCSSVN_H += vcs-svn/svndump.h
576
577 -MISC_H += bisect.h
578 -MISC_H += branch.h
579 -MISC_H += bundle.h
580 -MISC_H += common-cmds.h
581 -MISC_H += fetch-pack.h
582 -MISC_H += reachable.h
583 -MISC_H += send-pack.h
584 -MISC_H += shortlog.h
585 -MISC_H += tar.h
586 -MISC_H += thread-utils.h
587 -MISC_H += url.h
588 -MISC_H += walker.h
589 -MISC_H += wt-status.h
577 +GENERATED_H += common-cmds.h
578
579 LIB_H += advice.h
580 LIB_H += archive.h
581 LIB_H += argv-array.h
582 LIB_H += attr.h
583 +LIB_H += bisect.h
584 LIB_H += blob.h
585 +LIB_H += branch.h
586 LIB_H += builtin.h
587 LIB_H += bulk-checkin.h
588 +LIB_H += bundle.h
589 LIB_H += cache-tree.h
590 LIB_H += cache.h
591 LIB_H += color.h
592 +LIB_H += column.h
593 LIB_H += commit.h
594 LIB_H += compat/bswap.h
595 LIB_H += compat/cygwin.h
@@ -618,6 +610,7 @@ LIB_H += diff.h
610 LIB_H += diffcore.h
611 LIB_H += dir.h
612 LIB_H += exec_cmd.h
613 +LIB_H += fetch-pack.h
614 LIB_H += fmt-merge-msg.h
615 LIB_H += fsck.h
616 LIB_H += gettext.h
@@ -627,6 +620,7 @@ LIB_H += graph.h
620 LIB_H += grep.h
621 LIB_H += hash.h
622 LIB_H += help.h
623 +LIB_H += http.h
624 LIB_H += kwset.h
625 LIB_H += levenshtein.h
626 LIB_H += list-objects.h
@@ -649,6 +643,7 @@ LIB_H += pkt-line.h
643 LIB_H += progress.h
644 LIB_H += prompt.h
645 LIB_H += quote.h
646 +LIB_H += reachable.h
647 LIB_H += reflog-walk.h
648 LIB_H += refs.h
649 LIB_H += remote.h
@@ -656,9 +651,11 @@ LIB_H += rerere.h
651 LIB_H += resolve-undo.h
652 LIB_H += revision.h
653 LIB_H += run-command.h
654 +LIB_H += send-pack.h
655 LIB_H += sequencer.h
656 LIB_H += sha1-array.h
657 LIB_H += sha1-lookup.h
658 +LIB_H += shortlog.h
659 LIB_H += sideband.h
660 LIB_H += sigchain.h
661 LIB_H += strbuf.h
@@ -666,14 +663,18 @@ LIB_H += streaming.h
663 LIB_H += string-list.h
664 LIB_H += submodule.h
665 LIB_H += tag.h
666 +LIB_H += tar.h
667 LIB_H += thread-utils.h
668 LIB_H += transport.h
669 LIB_H += tree-walk.h
670 LIB_H += tree.h
671 LIB_H += unpack-trees.h
672 +LIB_H += url.h
673 LIB_H += userdiff.h
674 LIB_H += utf8.h
675 LIB_H += varint.h
676 +LIB_H += walker.h
677 +LIB_H += wt-status.h
678 LIB_H += xdiff-interface.h
679 LIB_H += xdiff/xdiff.h
680
@@ -2237,20 +2238,6 @@ else
2238 # gcc detects!
2239
2240 $(GIT_OBJS): $(LIB_H)
2240 -builtin/branch.o builtin/checkout.o builtin/clone.o builtin/reset.o branch.o transport.o: branch.h
2241 -builtin/bundle.o bundle.o transport.o: bundle.h
2242 -builtin/bisect--helper.o builtin/rev-list.o bisect.o: bisect.h
2243 -builtin/clone.o builtin/fetch-pack.o transport.o: fetch-pack.h
2244 -builtin/index-pack.o builtin/grep.o builtin/pack-objects.o transport-helper.o thread-utils.o: thread-utils.h
2245 -builtin/send-pack.o transport.o: send-pack.h
2246 -builtin/log.o builtin/shortlog.o: shortlog.h
2247 -builtin/prune.o builtin/reflog.o reachable.o: reachable.h
2248 -builtin/commit.o builtin/revert.o wt-status.o: wt-status.h
2249 -builtin/tar-tree.o archive-tar.o: tar.h
2250 -connect.o transport.o url.o http-backend.o: url.h
2251 -builtin/branch.o builtin/commit.o builtin/tag.o column.o help.o pager.o: column.h
2252 -http-fetch.o http-walker.o remote-curl.o transport.o walker.o: walker.h
2253 -http.o http-walker.o http-push.o http-fetch.o remote-curl.o: http.h url.h
2241
2242 xdiff-interface.o $(XDIFF_OBJS): $(XDIFF_H)
2243
@@ -2347,7 +2334,7 @@ XGETTEXT_FLAGS_C = $(XGETTEXT_FLAGS) --language=C \
2334 --keyword=_ --keyword=N_ --keyword="Q_:1,2"
2335 XGETTEXT_FLAGS_SH = $(XGETTEXT_FLAGS) --language=Shell
2336 XGETTEXT_FLAGS_PERL = $(XGETTEXT_FLAGS) --keyword=__ --language=Perl
2350 -LOCALIZED_C := $(C_OBJ:o=c) $(LIB_H) $(XDIFF_H) $(VCSSVN_H) $(MISC_H)
2337 +LOCALIZED_C := $(C_OBJ:o=c) $(LIB_H) $(XDIFF_H) $(VCSSVN_H) $(GENERATED_H)
2338 LOCALIZED_SH := $(SCRIPT_SH)
2339 LOCALIZED_PERL := $(SCRIPT_PERL)
2340