{"thread":{"id":"37316","subject":"[PATCH] Update hard-coded header dependencies","startedAt":"2014-08-08T21:58:26Z","lastAt":"2014-08-26T19:40:17Z","messageCount":27,"participants":["Jonathan Nieder","Jeff King","Junio C Hamano","Jiang Xin"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"247527","messageId":"20140808215825.GH12427@google.com","threadId":"37316","inReplyTo":null,"subject":"[PATCH] Update hard-coded header dependencies","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2014-08-08T21:58:26Z","receivedAt":"2014-08-08T21:58:26Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"The fall-back rules used when compilers don't support the -MMD switch\nto generate makefile rules based on #includes have been out of date\nsince v1.7.12.1~22^2~8 (move git_version_string into version.c,\n2012-06-02).\n\nChecked with 'make CHECK_HEADER_DEPENDENCIES=yes'.\n\nSigned-off-by: Jonathan Nieder <jrnieder@gmail.com>\n---\nMaybe it's worth switching to plain\n\n\tLIB_H += $(wildcard *.h)\n\n?  People using ancient compilers that never change headers wouldn't\nbe hurt, people using modern compilers that do change headers also\nwouldn't be hurt, and we could stop pretending to maintain an\nup-to-date list.\n\n Makefile | 8 ++++++++\n 1 file changed, 8 insertions(+)\n\ndiff --git a/Makefile b/Makefile\nindex 2320de5..18f0fad 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -646,15 +646,19 @@ LIB_H += cache.h\n LIB_H += color.h\n LIB_H += column.h\n LIB_H += commit.h\n+LIB_H += commit-slab.h\n+LIB_H += compat/apple-common-crypto.h\n LIB_H += compat/bswap.h\n LIB_H += compat/mingw.h\n LIB_H += compat/obstack.h\n LIB_H += compat/poll/poll.h\n LIB_H += compat/precompose_utf8.h\n LIB_H += compat/terminal.h\n+LIB_H += compat/win32/alloca.h\n LIB_H += compat/win32/dirent.h\n LIB_H += compat/win32/pthread.h\n LIB_H += compat/win32/syslog.h\n+LIB_H += connect.h\n LIB_H += connected.h\n LIB_H += convert.h\n LIB_H += credential.h\n@@ -678,6 +682,7 @@ LIB_H += grep.h\n LIB_H += hashmap.h\n LIB_H += help.h\n LIB_H += http.h\n+LIB_H += khash.h\n LIB_H += kwset.h\n LIB_H += levenshtein.h\n LIB_H += line-log.h\n@@ -721,6 +726,7 @@ LIB_H += sha1-lookup.h\n LIB_H += shortlog.h\n LIB_H += sideband.h\n LIB_H += sigchain.h\n+LIB_H += split-index.h\n LIB_H += strbuf.h\n LIB_H += streaming.h\n LIB_H += string-list.h\n@@ -728,6 +734,7 @@ LIB_H += submodule.h\n LIB_H += tag.h\n LIB_H += tar.h\n LIB_H += thread-utils.h\n+LIB_H += trace.h\n LIB_H += transport.h\n LIB_H += tree-walk.h\n LIB_H += tree.h\n@@ -744,6 +751,7 @@ LIB_H += vcs-svn/repo_tree.h\n LIB_H += vcs-svn/sliding_window.h\n LIB_H += vcs-svn/svndiff.h\n LIB_H += vcs-svn/svndump.h\n+LIB_H += version.h\n LIB_H += walker.h\n LIB_H += wildmatch.h\n LIB_H += wt-status.h\n-- \n"},{"id":"247561","messageId":"20140810194824.GC9886@peff.net","threadId":"37316","inReplyTo":"20140808215825.GH12427@google.com","subject":"Re: [PATCH] Update hard-coded header dependencies","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2014-08-10T19:48:24Z","receivedAt":"2014-08-10T19:48:24Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Fri, Aug 08, 2014 at 02:58:26PM -0700, Jonathan Nieder wrote:\n\n> Maybe it's worth switching to plain\n> \n> \tLIB_H += $(wildcard *.h)\n> \n> ?  People using ancient compilers that never change headers wouldn't\n> be hurt, people using modern compilers that do change headers also\n> wouldn't be hurt, and we could stop pretending to maintain an\n> up-to-date list.\n\nYeah, I think that makes sense. I'd imagine most of the developers are\non a modern platform and don't use the static list at all, so we don't\nnotice when it breaks (and even when you do use it, it's quite hard to\nnotice anyway).\n\nWe'd have to do a multi-directory wildcard, though, to catch the header\nfiles stuck in compat/* and elsewhere. We could list the containing\ndirectories manually, but that's yet another thing to go wrong. For\npeople using the git repo, it would probably be fine to do:\n\n  LIB_H += $(shell git ls-files -- '*.h')\n\nThat wouldn't count new files a developer adds until they \"git add\" some\nversion of the file, but that is not so bad (right now they have to add\nit to the Makefile, and anyway, I think most devs are using the computed\ndependencies).\n\nBut that doesn't work for distributed tarballs, which would have to\nconvert that to a static list somehow. Maybe\n\n  LIB_H += $(shell find . -name '*.h' -print)\n\nwould work?\n\n-Peff\n"},{"id":"247571","messageId":"xmqq38d39b2d.fsf@gitster.dls.corp.google.com","threadId":"37316","inReplyTo":"20140808215825.GH12427@google.com","subject":"Re: [PATCH] Update hard-coded header dependencies","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2014-08-10T23:31:06Z","receivedAt":"2014-08-10T23:31:06Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jonathan Nieder <jrnieder@gmail.com> writes:\n\n> The fall-back rules used when compilers don't support the -MMD switch\n> to generate makefile rules based on #includes have been out of date\n> since v1.7.12.1~22^2~8 (move git_version_string into version.c,\n> 2012-06-02).\n>\n> Checked with 'make CHECK_HEADER_DEPENDENCIES=yes'.\n>\n> Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>\n> ---\n> Maybe it's worth switching to plain\n>\n> \tLIB_H += $(wildcard *.h)\n>\n> ?  People using ancient compilers that never change headers wouldn't\n> be hurt, people using modern compilers that do change headers also\n> wouldn't be hurt, and we could stop pretending to maintain an\n> up-to-date list.\n\nI agree that it is very tempting to declare that we do not manually\n\"maintain\" the dependency list and force people without -MMD to\nrecompile whenever any unrelated header changes.  Especially that\nthis patch only works on the 'master' branch and upwards, and does\nnot even work on 'maint', let alone 1.9 or 1.8.5 maintenance tracks.\n\nLet's consider the merit of that approach after 2.1 is out.  Thanks.\n"},{"id":"247572","messageId":"xmqqy4uv7w4j.fsf@gitster.dls.corp.google.com","threadId":"37316","inReplyTo":"xmqq38d39b2d.fsf@gitster.dls.corp.google.com","subject":"Re: [PATCH] Update hard-coded header dependencies","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2014-08-10T23:39:08Z","receivedAt":"2014-08-10T23:39:08Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Junio C Hamano <gitster@pobox.com> writes:\n\n> Jonathan Nieder <jrnieder@gmail.com> writes:\n>\n>> ?  People using ancient compilers that never change headers wouldn't\n>> be hurt, people using modern compilers that do change headers also\n>> wouldn't be hurt, and we could stop pretending to maintain an\n>> up-to-date list.\n>\n> I agree that it is very tempting to declare that we do not manually\n> \"maintain\" the dependency list and force people without -MMD to\n> recompile whenever any unrelated header changes.  Especially that\n> this patch only works on the 'master' branch and upwards, and does\n> not even work on 'maint', let alone 1.9 or 1.8.5 maintenance tracks.\n>\n> Let's consider the merit of that approach after 2.1 is out.  Thanks.\n\nActually \"upwards\" is not even true; the 'next' branch already wants\ne.g. trace.h to build credential-store.o, which is not needed for\nthe 'master' branch.\n"},{"id":"248045","messageId":"20140821082440.GA16402@peff.net","threadId":"37316","inReplyTo":"20140810194824.GC9886@peff.net","subject":"Re: [PATCH] Update hard-coded header dependencies","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2014-08-21T08:24:40Z","receivedAt":"2014-08-21T08:24:40Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Sun, Aug 10, 2014 at 03:48:24PM -0400, Jeff King wrote:\n\n> On Fri, Aug 08, 2014 at 02:58:26PM -0700, Jonathan Nieder wrote:\n> \n> > Maybe it's worth switching to plain\n> > \n> > \tLIB_H += $(wildcard *.h)\n> > \n> > ?  People using ancient compilers that never change headers wouldn't\n> > be hurt, people using modern compilers that do change headers also\n> > wouldn't be hurt, and we could stop pretending to maintain an\n> > up-to-date list.\n> [...]\n> Maybe\n> \n>   LIB_H += $(shell find . -name '*.h' -print)\n> \n> would work?\n\nI took a stab at this and it seems to work. Here's a series.\n\n  [1/2]: Makefile: use `find` to determine static header dependencies\n  [2/2]: Makefile: drop CHECK_HEADER_DEPENDENCIES code\n\n-Peff\n"},{"id":"248046","messageId":"20140821082935.GA25763@peff.net","threadId":"37316","inReplyTo":"20140821082440.GA16402@peff.net","subject":"[PATCH 1/2] Makefile: use \"find\" to determine static header dependencies","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2014-08-21T08:29:36Z","receivedAt":"2014-08-21T08:29:36Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"Most modern platforms will use automatically computed header\ndependencies to figure out when a C file needs to be rebuilt\ndue to a header changing. With old compilers, however, we\nfall back to a static list of header files. If any of them\nchanges, we recompile everything. This is overly\nconservative, but the best we can do without compiler\nsupport.\n\nIt is unfortunately easy for our static header list to grow\nstale, as none of the regular developers make use of it.\nInstead of trying to keep it up to date, let's invoke \"find\"\nto generate the list dynamically.\n\nWe'd like to avoid running find at all when it is not\nnecessary, since it may add a non-trivial amount of time to\nthe build.  Make is _almost_ smart enough to avoid\nevaluating the function when it is not necessary. For the\nstatic header dependencies, we include $(LIB_H) as a\ndependency only if COMPUTE_HEADER_DEPENDENCIES is turned\noff, so we don't trigger its use there unless necessary. So\nfar so good.\n\nHowever, we do always define $(LIB_H) as a dependency of\npo/git.pot. Even though we do not actually try to build that\ntarget, make will still evaluate the dependencies when\nreading the Makefile, and expand the variable. This is not\nideal because almost nobody wants to build po/git.pot (only\nthe translation maintainer does it, and even then only once\nor twice per release). We can hack around this by invoking a\nsub-make which evaluates the variable only when po/git.pot\nis actually being built.\n\nSigned-off-by: Jeff King <peff@peff.net>\n---\nI also optimized the \"find\" a bit by pruning out some\ndirectories that are almost certainly uninteresting. That\nmeans we wouldn't catch an include of \"t/foo.h\", but I think\nthat is probably an OK assumption.\n\nI'm open to attempts to improve my ugly git.pot hack. I\nthought at first it was caused by the use of \":=\" in\nassigning LOCALIZED_C, but after much testing, I think it is\nactually the expansion of the dependencies.\n\n Makefile | 143 ++++++---------------------------------------------------------\n 1 file changed, 13 insertions(+), 130 deletions(-)\n\ndiff --git a/Makefile b/Makefile\nindex 2320de5..08dd973 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -432,7 +432,6 @@ XDIFF_OBJS =\n VCSSVN_OBJS =\n GENERATED_H =\n EXTRA_CPPFLAGS =\n-LIB_H =\n LIB_OBJS =\n PROGRAM_OBJS =\n PROGRAMS =\n@@ -631,131 +630,11 @@ VCSSVN_LIB = vcs-svn/lib.a\n \n GENERATED_H += common-cmds.h\n \n-LIB_H += advice.h\n-LIB_H += archive.h\n-LIB_H += argv-array.h\n-LIB_H += attr.h\n-LIB_H += bisect.h\n-LIB_H += blob.h\n-LIB_H += branch.h\n-LIB_H += builtin.h\n-LIB_H += bulk-checkin.h\n-LIB_H += bundle.h\n-LIB_H += cache-tree.h\n-LIB_H += cache.h\n-LIB_H += color.h\n-LIB_H += column.h\n-LIB_H += commit.h\n-LIB_H += compat/bswap.h\n-LIB_H += compat/mingw.h\n-LIB_H += compat/obstack.h\n-LIB_H += compat/poll/poll.h\n-LIB_H += compat/precompose_utf8.h\n-LIB_H += compat/terminal.h\n-LIB_H += compat/win32/dirent.h\n-LIB_H += compat/win32/pthread.h\n-LIB_H += compat/win32/syslog.h\n-LIB_H += connected.h\n-LIB_H += convert.h\n-LIB_H += credential.h\n-LIB_H += csum-file.h\n-LIB_H += decorate.h\n-LIB_H += delta.h\n-LIB_H += diff.h\n-LIB_H += diffcore.h\n-LIB_H += dir.h\n-LIB_H += exec_cmd.h\n-LIB_H += ewah/ewok.h\n-LIB_H += ewah/ewok_rlw.h\n-LIB_H += fetch-pack.h\n-LIB_H += fmt-merge-msg.h\n-LIB_H += fsck.h\n-LIB_H += gettext.h\n-LIB_H += git-compat-util.h\n-LIB_H += gpg-interface.h\n-LIB_H += graph.h\n-LIB_H += grep.h\n-LIB_H += hashmap.h\n-LIB_H += help.h\n-LIB_H += http.h\n-LIB_H += kwset.h\n-LIB_H += levenshtein.h\n-LIB_H += line-log.h\n-LIB_H += line-range.h\n-LIB_H += list-objects.h\n-LIB_H += ll-merge.h\n-LIB_H += log-tree.h\n-LIB_H += mailmap.h\n-LIB_H += merge-blobs.h\n-LIB_H += merge-recursive.h\n-LIB_H += mergesort.h\n-LIB_H += notes-cache.h\n-LIB_H += notes-merge.h\n-LIB_H += notes-utils.h\n-LIB_H += notes.h\n-LIB_H += object.h\n-LIB_H += pack-objects.h\n-LIB_H += pack-revindex.h\n-LIB_H += pack.h\n-LIB_H += pack-bitmap.h\n-LIB_H += parse-options.h\n-LIB_H += patch-ids.h\n-LIB_H += pathspec.h\n-LIB_H += pkt-line.h\n-LIB_H += prio-queue.h\n-LIB_H += progress.h\n-LIB_H += prompt.h\n-LIB_H += quote.h\n-LIB_H += reachable.h\n-LIB_H += reflog-walk.h\n-LIB_H += refs.h\n-LIB_H += remote.h\n-LIB_H += rerere.h\n-LIB_H += resolve-undo.h\n-LIB_H += revision.h\n-LIB_H += run-command.h\n-LIB_H += send-pack.h\n-LIB_H += sequencer.h\n-LIB_H += sha1-array.h\n-LIB_H += sha1-lookup.h\n-LIB_H += shortlog.h\n-LIB_H += sideband.h\n-LIB_H += sigchain.h\n-LIB_H += strbuf.h\n-LIB_H += streaming.h\n-LIB_H += string-list.h\n-LIB_H += submodule.h\n-LIB_H += tag.h\n-LIB_H += tar.h\n-LIB_H += thread-utils.h\n-LIB_H += transport.h\n-LIB_H += tree-walk.h\n-LIB_H += tree.h\n-LIB_H += unpack-trees.h\n-LIB_H += unicode_width.h\n-LIB_H += url.h\n-LIB_H += urlmatch.h\n-LIB_H += userdiff.h\n-LIB_H += utf8.h\n-LIB_H += varint.h\n-LIB_H += vcs-svn/fast_export.h\n-LIB_H += vcs-svn/line_buffer.h\n-LIB_H += vcs-svn/repo_tree.h\n-LIB_H += vcs-svn/sliding_window.h\n-LIB_H += vcs-svn/svndiff.h\n-LIB_H += vcs-svn/svndump.h\n-LIB_H += walker.h\n-LIB_H += wildmatch.h\n-LIB_H += wt-status.h\n-LIB_H += xdiff-interface.h\n-LIB_H += xdiff/xdiff.h\n-LIB_H += xdiff/xdiffi.h\n-LIB_H += xdiff/xemit.h\n-LIB_H += xdiff/xinclude.h\n-LIB_H += xdiff/xmacros.h\n-LIB_H += xdiff/xprepare.h\n-LIB_H += xdiff/xtypes.h\n-LIB_H += xdiff/xutils.h\n+LIB_H = $(shell find . \\\n+\t-name .git -prune -o \\\n+\t-name t -prune -o \\\n+\t-name Documentation -prune -o \\\n+\t-name '*.h' -print)\n \n LIB_OBJS += abspath.o\n LIB_OBJS += advice.o\n@@ -1381,7 +1260,6 @@ ifdef NO_INET_PTON\n endif\n ifndef NO_UNIX_SOCKETS\n \tLIB_OBJS += unix-socket.o\n-\tLIB_H += unix-socket.h\n \tPROGRAM_OBJS += credential-cache.o\n \tPROGRAM_OBJS += credential-cache--daemon.o\n endif\n@@ -1405,12 +1283,10 @@ endif\n ifdef BLK_SHA1\n \tSHA1_HEADER = \"block-sha1/sha1.h\"\n \tLIB_OBJS += block-sha1/sha1.o\n-\tLIB_H += block-sha1/sha1.h\n else\n ifdef PPC_SHA1\n \tSHA1_HEADER = \"ppc/sha1.h\"\n \tLIB_OBJS += ppc/sha1.o ppc/sha1ppc.o\n-\tLIB_H += ppc/sha1.h\n else\n ifdef APPLE_COMMON_CRYPTO\n \tCOMPAT_CFLAGS += -DCOMMON_DIGEST_FOR_OPENSSL\n@@ -2128,7 +2004,7 @@ XGETTEXT_FLAGS_C = $(XGETTEXT_FLAGS) --language=C \\\n XGETTEXT_FLAGS_SH = $(XGETTEXT_FLAGS) --language=Shell \\\n \t--keyword=gettextln --keyword=eval_gettextln\n XGETTEXT_FLAGS_PERL = $(XGETTEXT_FLAGS) --keyword=__ --language=Perl\n-LOCALIZED_C := $(C_OBJ:o=c) $(LIB_H) $(GENERATED_H)\n+LOCALIZED_C := $(C_OBJ:o=c) $(GENERATED_H)\n LOCALIZED_SH := $(SCRIPT_SH)\n LOCALIZED_PERL := $(SCRIPT_PERL)\n \n@@ -2138,6 +2014,8 @@ LOCALIZED_SH += t/t0200/test.sh\n LOCALIZED_PERL += t/t0200/test.perl\n endif\n \n+ifdef REAL_GIT_POT\n+LOCALIZED_C += $(LIB_H)\n po/git.pot: $(LOCALIZED_C)\n \t$(QUIET_XGETTEXT)$(XGETTEXT) -o$@+ $(XGETTEXT_FLAGS_C) $(LOCALIZED_C)\n \t$(QUIET_XGETTEXT)$(XGETTEXT) -o$@+ --join-existing $(XGETTEXT_FLAGS_SH) \\\n@@ -2145,6 +2023,11 @@ po/git.pot: $(LOCALIZED_C)\n \t$(QUIET_XGETTEXT)$(XGETTEXT) -o$@+ --join-existing $(XGETTEXT_FLAGS_PERL) \\\n \t\t$(LOCALIZED_PERL)\n \tmv $@+ $@\n+else\n+.PHONY: po/git.pot\n+po/git.pot:\n+\t@$(MAKE) po/git.pot REAL_GIT_POT=Yes\n+endif\n \n pot: po/git.pot\n \n-- \n2.1.0.346.ga0367b9\n"},{"id":"248047","messageId":"20140821083103.GB25763@peff.net","threadId":"37316","inReplyTo":"20140821082440.GA16402@peff.net","subject":"[PATCH 2/2] Makefile: drop CHECK_HEADER_DEPENDENCIES code","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2014-08-21T08:31:03Z","receivedAt":"2014-08-21T08:31:03Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"This code was useful when we kept a static list of header\nfiles, and it was easy to forget to update it. Since the last\ncommit, we generate the list dynamically.\n\nTechnically this could still be used to find a dependency\nthat our dynamic check misses (e.g., a header file without a\n\".h\" extension).  But that is reasonably unlikely to be\nadded, and even less likely to be noticed by this tool\n(because it has to be run manually)., It is not worth\ncarrying around the cruft in the Makefile.\n\nSigned-off-by: Jeff King <peff@peff.net>\n---\nI'm open to leaving this, as it's not hurting anything aside from\nclutter, and it could possibly be used to cross-check the dynamic rule.\nI just couldn't resist that all-deletion diffstat.\n\n Makefile | 59 -----------------------------------------------------------\n 1 file changed, 59 deletions(-)\n\ndiff --git a/Makefile b/Makefile\nindex 08dd973..65ff772 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -317,9 +317,6 @@ all::\n # dependency rules.  The default is \"auto\", which means to use computed header\n # dependencies if your compiler is detected to support it.\n #\n-# Define CHECK_HEADER_DEPENDENCIES to check for problems in the hard-coded\n-# dependency rules.\n-#\n # Define NATIVE_CRLF if your platform uses CRLF for line endings.\n #\n # Define XDL_FAST_HASH to use an alternative line-hashing method in\n@@ -904,11 +901,6 @@ sysconfdir = etc\n endif\n endif\n \n-ifdef CHECK_HEADER_DEPENDENCIES\n-COMPUTE_HEADER_DEPENDENCIES = no\n-USE_COMPUTED_HEADER_DEPENDENCIES =\n-endif\n-\n ifndef COMPUTE_HEADER_DEPENDENCIES\n COMPUTE_HEADER_DEPENDENCIES = auto\n endif\n@@ -1809,29 +1801,13 @@ $(dep_dirs):\n missing_dep_dirs := $(filter-out $(wildcard $(dep_dirs)),$(dep_dirs))\n dep_file = $(dir $@).depend/$(notdir $@).d\n dep_args = -MF $(dep_file) -MQ $@ -MMD -MP\n-ifdef CHECK_HEADER_DEPENDENCIES\n-$(error cannot compute header dependencies outside a normal build. \\\n-Please unset CHECK_HEADER_DEPENDENCIES and try again)\n-endif\n endif\n \n ifneq ($(COMPUTE_HEADER_DEPENDENCIES),yes)\n-ifndef CHECK_HEADER_DEPENDENCIES\n dep_dirs =\n missing_dep_dirs =\n dep_args =\n endif\n-endif\n-\n-ifdef CHECK_HEADER_DEPENDENCIES\n-ifndef PRINT_HEADER_DEPENDENCIES\n-missing_deps = $(filter-out $(notdir $^), \\\n-\t$(notdir $(shell $(MAKE) -s $@ \\\n-\t\tCHECK_HEADER_DEPENDENCIES=YesPlease \\\n-\t\tUSE_COMPUTED_HEADER_DEPENDENCIES=YesPlease \\\n-\t\tPRINT_HEADER_DEPENDENCIES=YesPlease)))\n-endif\n-endif\n \n ASM_SRC := $(wildcard $(OBJECTS:o=S))\n ASM_OBJ := $(ASM_SRC:S=o)\n@@ -1839,45 +1815,10 @@ C_OBJ := $(filter-out $(ASM_OBJ),$(OBJECTS))\n \n .SUFFIXES:\n \n-ifdef PRINT_HEADER_DEPENDENCIES\n-$(C_OBJ): %.o: %.c FORCE\n-\techo $^\n-$(ASM_OBJ): %.o: %.S FORCE\n-\techo $^\n-\n-ifndef CHECK_HEADER_DEPENDENCIES\n-$(error cannot print header dependencies during a normal build. \\\n-Please set CHECK_HEADER_DEPENDENCIES and try again)\n-endif\n-endif\n-\n-ifndef PRINT_HEADER_DEPENDENCIES\n-ifdef CHECK_HEADER_DEPENDENCIES\n-$(C_OBJ): %.o: %.c $(dep_files) FORCE\n-\t@set -e; echo CHECK $@; \\\n-\tmissing_deps=\"$(missing_deps)\"; \\\n-\tif test \"$$missing_deps\"; \\\n-\tthen \\\n-\t\techo missing dependencies: $$missing_deps; \\\n-\t\tfalse; \\\n-\tfi\n-$(ASM_OBJ): %.o: %.S $(dep_files) FORCE\n-\t@set -e; echo CHECK $@; \\\n-\tmissing_deps=\"$(missing_deps)\"; \\\n-\tif test \"$$missing_deps\"; \\\n-\tthen \\\n-\t\techo missing dependencies: $$missing_deps; \\\n-\t\tfalse; \\\n-\tfi\n-endif\n-endif\n-\n-ifndef CHECK_HEADER_DEPENDENCIES\n $(C_OBJ): %.o: %.c GIT-CFLAGS $(missing_dep_dirs)\n \t$(QUIET_CC)$(CC) -o $*.o -c $(dep_args) $(ALL_CFLAGS) $(EXTRA_CPPFLAGS) $<\n $(ASM_OBJ): %.o: %.S GIT-CFLAGS $(missing_dep_dirs)\n \t$(QUIET_CC)$(CC) -o $*.o -c $(dep_args) $(ALL_CFLAGS) $(EXTRA_CPPFLAGS) $<\n-endif\n \n %.s: %.c GIT-CFLAGS FORCE\n \t$(QUIET_CC)$(CC) -o $@ -S $(ALL_CFLAGS) $(EXTRA_CPPFLAGS) $<\n-- \n2.1.0.346.ga0367b9\n"},{"id":"248062","messageId":"20140821144818.GG20185@google.com","threadId":"37316","inReplyTo":"20140821082935.GA25763@peff.net","subject":"Re: [PATCH 1/2] Makefile: use \"find\" to determine static header dependencies","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2014-08-21T14:48:18Z","receivedAt":"2014-08-21T14:48:18Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Hi,\n\nJeff King wrote:\n\n> However, we do always define $(LIB_H) as a dependency of\n> po/git.pot. Even though we do not actually try to build that\n> target, make will still evaluate the dependencies when\n> reading the Makefile, and expand the variable. This is not\n> ideal\n\nWould the following work?  The current dependencies for po/git.pot are\nnot correct anyway --- they include LOCALIZED_C but not LOCALIZED_SH\nor LOCALIZED_PERL, so someone hacking on shell scripts and then trying\n'make po/git.pot' could end up with the pot file not being\nregenerated.\n\n-- >8 --\nSubject: i18n: treat \"make pot\" as an explicitly-invoked target\n\npo/git.pot is normally used as-is and not regenerated by people\nbuilding git, so it is okay if an explicit \"make po/git.pot\" always\nautomatically regenerates it.  Depend on the magic FORCE target\ninstead of explicitly keeping track of dependencies.\n\nThis simplifies the makefile, in particular preparing for a moment\nwhen $(LIB_H), which is part of $(LOCALIZED_C), can be computed on the\nfly.\n\nWe still need a dependency on GENERATED_H, to force those files to be\nbuilt when regenerating git.pot.\n\nSigned-off-by: Jonathan Nieder <jrnieder@gmail.com>\n---\n Makefile | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/Makefile b/Makefile\nindex 2320de5..cf0ccdf 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -2138,7 +2138,7 @@ LOCALIZED_SH += t/t0200/test.sh\n LOCALIZED_PERL += t/t0200/test.perl\n endif\n \n-po/git.pot: $(LOCALIZED_C)\n+po/git.pot: $(GENERATED_H) FORCE\n \t$(QUIET_XGETTEXT)$(XGETTEXT) -o$@+ $(XGETTEXT_FLAGS_C) $(LOCALIZED_C)\n \t$(QUIET_XGETTEXT)$(XGETTEXT) -o$@+ --join-existing $(XGETTEXT_FLAGS_SH) \\\n \t\t$(LOCALIZED_SH)\n-- \n"},{"id":"248098","messageId":"20140822041236.GC27992@peff.net","threadId":"37316","inReplyTo":"20140821144818.GG20185@google.com","subject":"Re: [PATCH 1/2] Makefile: use \"find\" to determine static header dependencies","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2014-08-22T04:12:36Z","receivedAt":"2014-08-22T04:12:36Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Thu, Aug 21, 2014 at 07:48:18AM -0700, Jonathan Nieder wrote:\n\n> Subject: i18n: treat \"make pot\" as an explicitly-invoked target\n> \n> po/git.pot is normally used as-is and not regenerated by people\n> building git, so it is okay if an explicit \"make po/git.pot\" always\n> automatically regenerates it.  Depend on the magic FORCE target\n> instead of explicitly keeping track of dependencies.\n> \n> This simplifies the makefile, in particular preparing for a moment\n> when $(LIB_H), which is part of $(LOCALIZED_C), can be computed on the\n> fly.\n> \n> We still need a dependency on GENERATED_H, to force those files to be\n> built when regenerating git.pot.\n> \n> Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>\n\nYeah, this is way less gross than what I proposed, and I do not think it\nhurts anything. We do still need to drop the use of \":=\" in assigning\nLOCALIZED_C, but I do not think there is any need for it in the first\nplace.\n\n-Peff\n"},{"id":"248101","messageId":"20140822042716.GE27992@peff.net","threadId":"37316","inReplyTo":"20140822041236.GC27992@peff.net","subject":"[PATCH v2 0/3] dropping manually-maintained LIB_H","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2014-08-22T04:27:16Z","receivedAt":"2014-08-22T04:27:16Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Fri, Aug 22, 2014 at 12:12:36AM -0400, Jeff King wrote:\n\n> > po/git.pot is normally used as-is and not regenerated by people\n> > building git, so it is okay if an explicit \"make po/git.pot\" always\n> > automatically regenerates it.  Depend on the magic FORCE target\n> > instead of explicitly keeping track of dependencies.\n> \n> Yeah, this is way less gross than what I proposed, and I do not think it\n> hurts anything. We do still need to drop the use of \":=\" in assigning\n> LOCALIZED_C, but I do not think there is any need for it in the first\n> place.\n\nHere's a re-roll of my series on top of your patch. In addition to\nrebasing, I also switched it to use $(FIND) in the shell snippet rather\nthan a bare \"find\".\n\nI notice that for the ctags generation we actually try \"git ls-tree\"\nfirst and then fall back to \"find\". I guess we could do that here, but I\ndo not think the speed improvement matters much. And I think the \"find\"\noutput is a little more conservative. If you are adding a new header\nfile but have not mentioned it to git yet, I think we would prefer to\nerr on the side of including it as a potential dependency.\n\n  [1/3]: i18n: treat \"make pot\" as an explicitly-invoked target\n  [2/3]: Makefile: use `find` to determine static header dependencies\n  [3/3]: Makefile: drop CHECK_HEADER_DEPENDENCIES code\n\n-Peff\n"},{"id":"248102","messageId":"20140822043208.GA18192@peff.net","threadId":"37316","inReplyTo":"20140822042716.GE27992@peff.net","subject":"[PATCH 1/3] i18n: treat \"make pot\" as an explicitly-invoked target","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2014-08-22T04:32:08Z","receivedAt":"2014-08-22T04:32:08Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"From: Jonathan Nieder <jrnieder@gmail.com>\n\npo/git.pot is normally used as-is and not regenerated by people\nbuilding git, so it is okay if an explicit \"make po/git.pot\" always\nautomatically regenerates it.  Depend on the magic FORCE target\ninstead of explicitly keeping track of dependencies.\n\nThis simplifies the makefile, in particular preparing for a moment\nwhen $(LIB_H), which is part of $(LOCALIZED_C), can be computed on the\nfly. It also fixes a slight breakage in which changes to perl and shell\nscripts did not trigger a rebuild of po/git.pot.\n\nWe still need a dependency on GENERATED_H, to force those files to be\nbuilt when regenerating git.pot.\n\nSigned-off-by: Jonathan Nieder <jrnieder@gmail.com>\nSigned-off-by: Jeff King <peff@peff.net>\n---\nMostly as you sent it, but I mentioned the missing script dependencies\nin the commit message, too.\n\n Makefile | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/Makefile b/Makefile\nindex 2320de5..cf0ccdf 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -2138,7 +2138,7 @@ LOCALIZED_SH += t/t0200/test.sh\n LOCALIZED_PERL += t/t0200/test.perl\n endif\n \n-po/git.pot: $(LOCALIZED_C)\n+po/git.pot: $(GENERATED_H) FORCE\n \t$(QUIET_XGETTEXT)$(XGETTEXT) -o$@+ $(XGETTEXT_FLAGS_C) $(LOCALIZED_C)\n \t$(QUIET_XGETTEXT)$(XGETTEXT) -o$@+ --join-existing $(XGETTEXT_FLAGS_SH) \\\n \t\t$(LOCALIZED_SH)\n-- \n2.1.0.346.ga0367b9\n"},{"id":"248103","messageId":"20140822043303.GB18192@peff.net","threadId":"37316","inReplyTo":"20140822042716.GE27992@peff.net","subject":"[PATCH 2/3] Makefile: use `find` to determine static header dependencies","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2014-08-22T04:33:03Z","receivedAt":"2014-08-22T04:33:03Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"Most modern platforms will use automatically computed header\ndependencies to figure out when a C file needs rebuilt due\nto a header changing. With old compilers, however, we\nfallback to a static list of header files. If any of them\nchanges, we recompile everything. This is overly\nconservative, but the best we can do on older platforms.\n\nIt is unfortunately easy for our static header list to grow\nstale, as none of the regular developers make use of it.\nInstead of trying to keep it up to date, let's invoke \"find\"\nto generate the list dynamically.\n\nSince we do not use the value $(LIB_H) unless either\nCOMPUTE_HEADER_DEPENDENCIES is turned on or the user is\nbuilding \"po/git.pot\" (where it comes in via $(LOCALIZED_C),\nmake is smart enough to not even run this \"find\" in most\ncases. However, we do need to stop using the \"immediate\"\nvariable assignment \":=\" for $(LOCALIZED_C). That's OK,\nbecause it was not otherwise useful here.\n\nSigned-off-by: Jeff King <peff@peff.net>\n---\nI cannot see any reason for the \":=\", but maybe I am missing something.\n\n Makefile | 140 ++++-----------------------------------------------------------\n 1 file changed, 8 insertions(+), 132 deletions(-)\n\ndiff --git a/Makefile b/Makefile\nindex cf0ccdf..f2b85c9 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -432,7 +432,6 @@ XDIFF_OBJS =\n VCSSVN_OBJS =\n GENERATED_H =\n EXTRA_CPPFLAGS =\n-LIB_H =\n LIB_OBJS =\n PROGRAM_OBJS =\n PROGRAMS =\n@@ -631,131 +630,11 @@ VCSSVN_LIB = vcs-svn/lib.a\n \n GENERATED_H += common-cmds.h\n \n-LIB_H += advice.h\n-LIB_H += archive.h\n-LIB_H += argv-array.h\n-LIB_H += attr.h\n-LIB_H += bisect.h\n-LIB_H += blob.h\n-LIB_H += branch.h\n-LIB_H += builtin.h\n-LIB_H += bulk-checkin.h\n-LIB_H += bundle.h\n-LIB_H += cache-tree.h\n-LIB_H += cache.h\n-LIB_H += color.h\n-LIB_H += column.h\n-LIB_H += commit.h\n-LIB_H += compat/bswap.h\n-LIB_H += compat/mingw.h\n-LIB_H += compat/obstack.h\n-LIB_H += compat/poll/poll.h\n-LIB_H += compat/precompose_utf8.h\n-LIB_H += compat/terminal.h\n-LIB_H += compat/win32/dirent.h\n-LIB_H += compat/win32/pthread.h\n-LIB_H += compat/win32/syslog.h\n-LIB_H += connected.h\n-LIB_H += convert.h\n-LIB_H += credential.h\n-LIB_H += csum-file.h\n-LIB_H += decorate.h\n-LIB_H += delta.h\n-LIB_H += diff.h\n-LIB_H += diffcore.h\n-LIB_H += dir.h\n-LIB_H += exec_cmd.h\n-LIB_H += ewah/ewok.h\n-LIB_H += ewah/ewok_rlw.h\n-LIB_H += fetch-pack.h\n-LIB_H += fmt-merge-msg.h\n-LIB_H += fsck.h\n-LIB_H += gettext.h\n-LIB_H += git-compat-util.h\n-LIB_H += gpg-interface.h\n-LIB_H += graph.h\n-LIB_H += grep.h\n-LIB_H += hashmap.h\n-LIB_H += help.h\n-LIB_H += http.h\n-LIB_H += kwset.h\n-LIB_H += levenshtein.h\n-LIB_H += line-log.h\n-LIB_H += line-range.h\n-LIB_H += list-objects.h\n-LIB_H += ll-merge.h\n-LIB_H += log-tree.h\n-LIB_H += mailmap.h\n-LIB_H += merge-blobs.h\n-LIB_H += merge-recursive.h\n-LIB_H += mergesort.h\n-LIB_H += notes-cache.h\n-LIB_H += notes-merge.h\n-LIB_H += notes-utils.h\n-LIB_H += notes.h\n-LIB_H += object.h\n-LIB_H += pack-objects.h\n-LIB_H += pack-revindex.h\n-LIB_H += pack.h\n-LIB_H += pack-bitmap.h\n-LIB_H += parse-options.h\n-LIB_H += patch-ids.h\n-LIB_H += pathspec.h\n-LIB_H += pkt-line.h\n-LIB_H += prio-queue.h\n-LIB_H += progress.h\n-LIB_H += prompt.h\n-LIB_H += quote.h\n-LIB_H += reachable.h\n-LIB_H += reflog-walk.h\n-LIB_H += refs.h\n-LIB_H += remote.h\n-LIB_H += rerere.h\n-LIB_H += resolve-undo.h\n-LIB_H += revision.h\n-LIB_H += run-command.h\n-LIB_H += send-pack.h\n-LIB_H += sequencer.h\n-LIB_H += sha1-array.h\n-LIB_H += sha1-lookup.h\n-LIB_H += shortlog.h\n-LIB_H += sideband.h\n-LIB_H += sigchain.h\n-LIB_H += strbuf.h\n-LIB_H += streaming.h\n-LIB_H += string-list.h\n-LIB_H += submodule.h\n-LIB_H += tag.h\n-LIB_H += tar.h\n-LIB_H += thread-utils.h\n-LIB_H += transport.h\n-LIB_H += tree-walk.h\n-LIB_H += tree.h\n-LIB_H += unpack-trees.h\n-LIB_H += unicode_width.h\n-LIB_H += url.h\n-LIB_H += urlmatch.h\n-LIB_H += userdiff.h\n-LIB_H += utf8.h\n-LIB_H += varint.h\n-LIB_H += vcs-svn/fast_export.h\n-LIB_H += vcs-svn/line_buffer.h\n-LIB_H += vcs-svn/repo_tree.h\n-LIB_H += vcs-svn/sliding_window.h\n-LIB_H += vcs-svn/svndiff.h\n-LIB_H += vcs-svn/svndump.h\n-LIB_H += walker.h\n-LIB_H += wildmatch.h\n-LIB_H += wt-status.h\n-LIB_H += xdiff-interface.h\n-LIB_H += xdiff/xdiff.h\n-LIB_H += xdiff/xdiffi.h\n-LIB_H += xdiff/xemit.h\n-LIB_H += xdiff/xinclude.h\n-LIB_H += xdiff/xmacros.h\n-LIB_H += xdiff/xprepare.h\n-LIB_H += xdiff/xtypes.h\n-LIB_H += xdiff/xutils.h\n+LIB_H = $(shell $(FIND) . \\\n+\t-name .git -prune -o \\\n+\t-name t -prune -o \\\n+\t-name Documentation -prune -o \\\n+\t-name '*.h' -print)\n \n LIB_OBJS += abspath.o\n LIB_OBJS += advice.o\n@@ -1381,7 +1260,6 @@ ifdef NO_INET_PTON\n endif\n ifndef NO_UNIX_SOCKETS\n \tLIB_OBJS += unix-socket.o\n-\tLIB_H += unix-socket.h\n \tPROGRAM_OBJS += credential-cache.o\n \tPROGRAM_OBJS += credential-cache--daemon.o\n endif\n@@ -1405,12 +1283,10 @@ endif\n ifdef BLK_SHA1\n \tSHA1_HEADER = \"block-sha1/sha1.h\"\n \tLIB_OBJS += block-sha1/sha1.o\n-\tLIB_H += block-sha1/sha1.h\n else\n ifdef PPC_SHA1\n \tSHA1_HEADER = \"ppc/sha1.h\"\n \tLIB_OBJS += ppc/sha1.o ppc/sha1ppc.o\n-\tLIB_H += ppc/sha1.h\n else\n ifdef APPLE_COMMON_CRYPTO\n \tCOMPAT_CFLAGS += -DCOMMON_DIGEST_FOR_OPENSSL\n@@ -2128,9 +2004,9 @@ XGETTEXT_FLAGS_C = $(XGETTEXT_FLAGS) --language=C \\\n XGETTEXT_FLAGS_SH = $(XGETTEXT_FLAGS) --language=Shell \\\n \t--keyword=gettextln --keyword=eval_gettextln\n XGETTEXT_FLAGS_PERL = $(XGETTEXT_FLAGS) --keyword=__ --language=Perl\n-LOCALIZED_C := $(C_OBJ:o=c) $(LIB_H) $(GENERATED_H)\n-LOCALIZED_SH := $(SCRIPT_SH)\n-LOCALIZED_PERL := $(SCRIPT_PERL)\n+LOCALIZED_C = $(C_OBJ:o=c) $(GENERATED_H)\n+LOCALIZED_SH = $(SCRIPT_SH)\n+LOCALIZED_PERL = $(SCRIPT_PERL)\n \n ifdef XGETTEXT_INCLUDE_TESTS\n LOCALIZED_C += t/t0200/test.c\n-- \n2.1.0.346.ga0367b9\n"},{"id":"248104","messageId":"20140822043316.GC18192@peff.net","threadId":"37316","inReplyTo":"20140822042716.GE27992@peff.net","subject":"[PATCH 3/3] Makefile: drop CHECK_HEADER_DEPENDENCIES code","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2014-08-22T04:33:16Z","receivedAt":"2014-08-22T04:33:16Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"This code was useful when we kept a static list of header\nfiles, and it was easy to forget to update it. Since the last\ncommit, we generate the list dynamically.\n\nTechnically this could still be used to find a dependency\nthat our dynamic check misses (e.g., a header file without a\n\".h\" extension).  But that is reasonably unlikely to be\nadded, and even less likely to be noticed by this tool\n(because it has to be run manually)., It is not worth\ncarrying around the cruft in the Makefile.\n\nSigned-off-by: Jeff King <peff@peff.net>\n---\nSame as before.\n\n Makefile | 59 -----------------------------------------------------------\n 1 file changed, 59 deletions(-)\n\ndiff --git a/Makefile b/Makefile\nindex f2b85c9..23e621f 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -317,9 +317,6 @@ all::\n # dependency rules.  The default is \"auto\", which means to use computed header\n # dependencies if your compiler is detected to support it.\n #\n-# Define CHECK_HEADER_DEPENDENCIES to check for problems in the hard-coded\n-# dependency rules.\n-#\n # Define NATIVE_CRLF if your platform uses CRLF for line endings.\n #\n # Define XDL_FAST_HASH to use an alternative line-hashing method in\n@@ -904,11 +901,6 @@ sysconfdir = etc\n endif\n endif\n \n-ifdef CHECK_HEADER_DEPENDENCIES\n-COMPUTE_HEADER_DEPENDENCIES = no\n-USE_COMPUTED_HEADER_DEPENDENCIES =\n-endif\n-\n ifndef COMPUTE_HEADER_DEPENDENCIES\n COMPUTE_HEADER_DEPENDENCIES = auto\n endif\n@@ -1809,29 +1801,13 @@ $(dep_dirs):\n missing_dep_dirs := $(filter-out $(wildcard $(dep_dirs)),$(dep_dirs))\n dep_file = $(dir $@).depend/$(notdir $@).d\n dep_args = -MF $(dep_file) -MQ $@ -MMD -MP\n-ifdef CHECK_HEADER_DEPENDENCIES\n-$(error cannot compute header dependencies outside a normal build. \\\n-Please unset CHECK_HEADER_DEPENDENCIES and try again)\n-endif\n endif\n \n ifneq ($(COMPUTE_HEADER_DEPENDENCIES),yes)\n-ifndef CHECK_HEADER_DEPENDENCIES\n dep_dirs =\n missing_dep_dirs =\n dep_args =\n endif\n-endif\n-\n-ifdef CHECK_HEADER_DEPENDENCIES\n-ifndef PRINT_HEADER_DEPENDENCIES\n-missing_deps = $(filter-out $(notdir $^), \\\n-\t$(notdir $(shell $(MAKE) -s $@ \\\n-\t\tCHECK_HEADER_DEPENDENCIES=YesPlease \\\n-\t\tUSE_COMPUTED_HEADER_DEPENDENCIES=YesPlease \\\n-\t\tPRINT_HEADER_DEPENDENCIES=YesPlease)))\n-endif\n-endif\n \n ASM_SRC := $(wildcard $(OBJECTS:o=S))\n ASM_OBJ := $(ASM_SRC:S=o)\n@@ -1839,45 +1815,10 @@ C_OBJ := $(filter-out $(ASM_OBJ),$(OBJECTS))\n \n .SUFFIXES:\n \n-ifdef PRINT_HEADER_DEPENDENCIES\n-$(C_OBJ): %.o: %.c FORCE\n-\techo $^\n-$(ASM_OBJ): %.o: %.S FORCE\n-\techo $^\n-\n-ifndef CHECK_HEADER_DEPENDENCIES\n-$(error cannot print header dependencies during a normal build. \\\n-Please set CHECK_HEADER_DEPENDENCIES and try again)\n-endif\n-endif\n-\n-ifndef PRINT_HEADER_DEPENDENCIES\n-ifdef CHECK_HEADER_DEPENDENCIES\n-$(C_OBJ): %.o: %.c $(dep_files) FORCE\n-\t@set -e; echo CHECK $@; \\\n-\tmissing_deps=\"$(missing_deps)\"; \\\n-\tif test \"$$missing_deps\"; \\\n-\tthen \\\n-\t\techo missing dependencies: $$missing_deps; \\\n-\t\tfalse; \\\n-\tfi\n-$(ASM_OBJ): %.o: %.S $(dep_files) FORCE\n-\t@set -e; echo CHECK $@; \\\n-\tmissing_deps=\"$(missing_deps)\"; \\\n-\tif test \"$$missing_deps\"; \\\n-\tthen \\\n-\t\techo missing dependencies: $$missing_deps; \\\n-\t\tfalse; \\\n-\tfi\n-endif\n-endif\n-\n-ifndef CHECK_HEADER_DEPENDENCIES\n $(C_OBJ): %.o: %.c GIT-CFLAGS $(missing_dep_dirs)\n \t$(QUIET_CC)$(CC) -o $*.o -c $(dep_args) $(ALL_CFLAGS) $(EXTRA_CPPFLAGS) $<\n $(ASM_OBJ): %.o: %.S GIT-CFLAGS $(missing_dep_dirs)\n \t$(QUIET_CC)$(CC) -o $*.o -c $(dep_args) $(ALL_CFLAGS) $(EXTRA_CPPFLAGS) $<\n-endif\n \n %.s: %.c GIT-CFLAGS FORCE\n \t$(QUIET_CC)$(CC) -o $@ -S $(ALL_CFLAGS) $(EXTRA_CPPFLAGS) $<\n-- \n2.1.0.346.ga0367b9\n"},{"id":"248186","messageId":"CANYiYbGm+eB9amaqxPtQff-tEKDyQUMTA++5JLwO8T514DJ8rw@mail.gmail.com","threadId":"37316","inReplyTo":"20140821144818.GG20185@google.com","subject":"Re: [PATCH 1/2] Makefile: use \"find\" to determine static header dependencies","fromName":"Jiang Xin","fromEmail":"worldhello.net@gmail.com","sentAt":"2014-08-23T11:06:08Z","receivedAt":"2014-08-23T11:06:08Z","isPatch":true,"sender":{"key":"worldhello.net@gmail.com","avatar":"https://avatars.githubusercontent.com/u/183860?v=4"},"body":"2014-08-21 22:48 GMT+08:00 Jonathan Nieder <jrnieder@gmail.com>:\n> Hi,\n>\n> Jeff King wrote:\n>\n>> However, we do always define $(LIB_H) as a dependency of\n>> po/git.pot. Even though we do not actually try to build that\n>> target, make will still evaluate the dependencies when\n>> reading the Makefile, and expand the variable. This is not\n>> ideal\n>\n> Would the following work?  The current dependencies for po/git.pot are\n> not correct anyway --- they include LOCALIZED_C but not LOCALIZED_SH\n> or LOCALIZED_PERL, so someone hacking on shell scripts and then trying\n> 'make po/git.pot' could end up with the pot file not being\n> regenerated.\n>\n> -- >8 --\n> Subject: i18n: treat \"make pot\" as an explicitly-invoked target\n>\n> po/git.pot is normally used as-is and not regenerated by people\n> building git, so it is okay if an explicit \"make po/git.pot\" always\n> automatically regenerates it.  Depend on the magic FORCE target\n> instead of explicitly keeping track of dependencies.\n>\n\nThat's great, it's better than what I used to execute:\n\n    rm po/git.pot; make pot\n\n\n-- \nJiang Xin\n"},{"id":"248257","messageId":"xmqqvbpgl638.fsf@gitster.dls.corp.google.com","threadId":"37316","inReplyTo":"20140822043303.GB18192@peff.net","subject":"Re: [PATCH 2/3] Makefile: use `find` to determine static header dependencies","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2014-08-25T19:30:51Z","receivedAt":"2014-08-25T19:30:51Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jeff King <peff@peff.net> writes:\n\n> Since we do not use the value $(LIB_H) unless either\n> COMPUTE_HEADER_DEPENDENCIES is turned on or the user is\n> building \"po/git.pot\" (where it comes in via $(LOCALIZED_C),\n> make is smart enough to not even run this \"find\" in most\n> cases. However, we do need to stop using the \"immediate\"\n> variable assignment \":=\" for $(LOCALIZED_C). That's OK,\n> because it was not otherwise useful here.\n>\n> Signed-off-by: Jeff King <peff@peff.net>\n> ---\n> I cannot see any reason for the \":=\", but maybe I am missing something.\n\nIf the right-hand-side were something like $(shell find ...) that\nwas heavy-weight then it might have made sense, but I do not think\nit is that.  It has stayed to be := ever since it was introduced by\ncd5513a7 (i18n: Makefile: \"pot\" target to extract messages marked\nfor translation, 2011-02-22).\n\nAnd now you use LIB_H only once ;-).\n\nAlso interestingly, I notice that it is very clear that it is not\n\"LIB_H\" but \"ANY_H\" ;-)\n\n>\n>  Makefile | 140 ++++-----------------------------------------------------------\n>  1 file changed, 8 insertions(+), 132 deletions(-)\n>\n> diff --git a/Makefile b/Makefile\n> index cf0ccdf..f2b85c9 100644\n> --- a/Makefile\n> +++ b/Makefile\n> ...\n> @@ -2128,9 +2004,9 @@ XGETTEXT_FLAGS_C = $(XGETTEXT_FLAGS) --language=C \\\n>  XGETTEXT_FLAGS_SH = $(XGETTEXT_FLAGS) --language=Shell \\\n>  \t--keyword=gettextln --keyword=eval_gettextln\n>  XGETTEXT_FLAGS_PERL = $(XGETTEXT_FLAGS) --keyword=__ --language=Perl\n> -LOCALIZED_C := $(C_OBJ:o=c) $(LIB_H) $(GENERATED_H)\n> -LOCALIZED_SH := $(SCRIPT_SH)\n> -LOCALIZED_PERL := $(SCRIPT_PERL)\n> +LOCALIZED_C = $(C_OBJ:o=c) $(GENERATED_H)\n> +LOCALIZED_SH = $(SCRIPT_SH)\n> +LOCALIZED_PERL = $(SCRIPT_PERL)\n>  \n>  ifdef XGETTEXT_INCLUDE_TESTS\n>  LOCALIZED_C += t/t0200/test.c\n"},{"id":"248258","messageId":"20140825193358.GG30953@peff.net","threadId":"37316","inReplyTo":"xmqqvbpgl638.fsf@gitster.dls.corp.google.com","subject":"Re: [PATCH 2/3] Makefile: use `find` to determine static header dependencies","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2014-08-25T19:33:58Z","receivedAt":"2014-08-25T19:33:58Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Mon, Aug 25, 2014 at 12:30:51PM -0700, Junio C Hamano wrote:\n\n> Also interestingly, I notice that it is very clear that it is not\n> \"LIB_H\" but \"ANY_H\" ;-)\n\nYeah, it has been that way for quite a while. I don't know if it is that\nbig a deal, but it would not be unreasonable to do a patch to rename on\ntop (I am not sure what the new one would be; ANY_H is probably OK).\n\n-Peff\n"},{"id":"248261","messageId":"20140825194641.GS20185@google.com","threadId":"37316","inReplyTo":"20140822043303.GB18192@peff.net","subject":"Re: [PATCH 2/3] Makefile: use `find` to determine static header dependencies","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2014-08-25T19:46:41Z","receivedAt":"2014-08-25T19:46:41Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Jeff King wrote:\n\n> -LOCALIZED_C := $(C_OBJ:o=c) $(LIB_H) $(GENERATED_H)\n> +LOCALIZED_C = $(C_OBJ:o=c) $(GENERATED_H)\n\nWhy is LIB_H dropped here?  This would mean that po/git.pot stops\nincluding strings from macros and static inline functions in headers\n(e.g., in parse-options.h).\n\nThe rest looks good.\n\nThanks,\nJonathan\n"},{"id":"248262","messageId":"20140825200042.GJ30953@peff.net","threadId":"37316","inReplyTo":"20140825194641.GS20185@google.com","subject":"Re: [PATCH 2/3] Makefile: use `find` to determine static header dependencies","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2014-08-25T20:00:42Z","receivedAt":"2014-08-25T20:00:42Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Mon, Aug 25, 2014 at 12:46:41PM -0700, Jonathan Nieder wrote:\n\n> Jeff King wrote:\n> \n> > -LOCALIZED_C := $(C_OBJ:o=c) $(LIB_H) $(GENERATED_H)\n> > +LOCALIZED_C = $(C_OBJ:o=c) $(GENERATED_H)\n> \n> Why is LIB_H dropped here?  This would mean that po/git.pot stops\n> including strings from macros and static inline functions in headers\n> (e.g., in parse-options.h).\n\nIck, this is an accidental leftover from the earlier iteration of the\npatch, which moved that part to a separate line (inside my gross\nGIT_REAL_POT conditional). The extra line went away, but I forgot to add\n$(LIB_H) back in here. Thanks for noticing.\n\nHere's a revised version of the patch which fixes it (and I\ndouble-checked to make sure it continues to not execute the find unless\nyou are doing a \"make pot\").\n\n-- >8 --\nSubject: Makefile: use `find` to determine static header dependencies\n\nMost modern platforms will use automatically computed header\ndependencies to figure out when a C file needs rebuilt due\nto a header changing. With old compilers, however, we\nfallback to a static list of header files. If any of them\nchanges, we recompile everything. This is overly\nconservative, but the best we can do on older platforms.\n\nIt is unfortunately easy for our static header list to grow\nstale, as none of the regular developers make use of it.\nInstead of trying to keep it up to date, let's invoke \"find\"\nto generate the list dynamically.\n\nSince we do not use the value $(LIB_H) unless either\nCOMPUTE_HEADER_DEPENDENCIES is turned on or the user is\nbuilding \"po/git.pot\" (where it comes in via $(LOCALIZED_C),\nmake is smart enough to not even run this \"find\" in most\ncases. However, we do need to stop using the \"immediate\"\nvariable assignment \":=\" for $(LOCALIZED_C). That's OK,\nbecause it was not otherwise useful here.\n\nSigned-off-by: Jeff King <peff@peff.net>\n---\n Makefile | 140 ++++-----------------------------------------------------------\n 1 file changed, 8 insertions(+), 132 deletions(-)\n\ndiff --git a/Makefile b/Makefile\nindex cf0ccdf..a4fc440 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -432,7 +432,6 @@ XDIFF_OBJS =\n VCSSVN_OBJS =\n GENERATED_H =\n EXTRA_CPPFLAGS =\n-LIB_H =\n LIB_OBJS =\n PROGRAM_OBJS =\n PROGRAMS =\n@@ -631,131 +630,11 @@ VCSSVN_LIB = vcs-svn/lib.a\n \n GENERATED_H += common-cmds.h\n \n-LIB_H += advice.h\n-LIB_H += archive.h\n-LIB_H += argv-array.h\n-LIB_H += attr.h\n-LIB_H += bisect.h\n-LIB_H += blob.h\n-LIB_H += branch.h\n-LIB_H += builtin.h\n-LIB_H += bulk-checkin.h\n-LIB_H += bundle.h\n-LIB_H += cache-tree.h\n-LIB_H += cache.h\n-LIB_H += color.h\n-LIB_H += column.h\n-LIB_H += commit.h\n-LIB_H += compat/bswap.h\n-LIB_H += compat/mingw.h\n-LIB_H += compat/obstack.h\n-LIB_H += compat/poll/poll.h\n-LIB_H += compat/precompose_utf8.h\n-LIB_H += compat/terminal.h\n-LIB_H += compat/win32/dirent.h\n-LIB_H += compat/win32/pthread.h\n-LIB_H += compat/win32/syslog.h\n-LIB_H += connected.h\n-LIB_H += convert.h\n-LIB_H += credential.h\n-LIB_H += csum-file.h\n-LIB_H += decorate.h\n-LIB_H += delta.h\n-LIB_H += diff.h\n-LIB_H += diffcore.h\n-LIB_H += dir.h\n-LIB_H += exec_cmd.h\n-LIB_H += ewah/ewok.h\n-LIB_H += ewah/ewok_rlw.h\n-LIB_H += fetch-pack.h\n-LIB_H += fmt-merge-msg.h\n-LIB_H += fsck.h\n-LIB_H += gettext.h\n-LIB_H += git-compat-util.h\n-LIB_H += gpg-interface.h\n-LIB_H += graph.h\n-LIB_H += grep.h\n-LIB_H += hashmap.h\n-LIB_H += help.h\n-LIB_H += http.h\n-LIB_H += kwset.h\n-LIB_H += levenshtein.h\n-LIB_H += line-log.h\n-LIB_H += line-range.h\n-LIB_H += list-objects.h\n-LIB_H += ll-merge.h\n-LIB_H += log-tree.h\n-LIB_H += mailmap.h\n-LIB_H += merge-blobs.h\n-LIB_H += merge-recursive.h\n-LIB_H += mergesort.h\n-LIB_H += notes-cache.h\n-LIB_H += notes-merge.h\n-LIB_H += notes-utils.h\n-LIB_H += notes.h\n-LIB_H += object.h\n-LIB_H += pack-objects.h\n-LIB_H += pack-revindex.h\n-LIB_H += pack.h\n-LIB_H += pack-bitmap.h\n-LIB_H += parse-options.h\n-LIB_H += patch-ids.h\n-LIB_H += pathspec.h\n-LIB_H += pkt-line.h\n-LIB_H += prio-queue.h\n-LIB_H += progress.h\n-LIB_H += prompt.h\n-LIB_H += quote.h\n-LIB_H += reachable.h\n-LIB_H += reflog-walk.h\n-LIB_H += refs.h\n-LIB_H += remote.h\n-LIB_H += rerere.h\n-LIB_H += resolve-undo.h\n-LIB_H += revision.h\n-LIB_H += run-command.h\n-LIB_H += send-pack.h\n-LIB_H += sequencer.h\n-LIB_H += sha1-array.h\n-LIB_H += sha1-lookup.h\n-LIB_H += shortlog.h\n-LIB_H += sideband.h\n-LIB_H += sigchain.h\n-LIB_H += strbuf.h\n-LIB_H += streaming.h\n-LIB_H += string-list.h\n-LIB_H += submodule.h\n-LIB_H += tag.h\n-LIB_H += tar.h\n-LIB_H += thread-utils.h\n-LIB_H += transport.h\n-LIB_H += tree-walk.h\n-LIB_H += tree.h\n-LIB_H += unpack-trees.h\n-LIB_H += unicode_width.h\n-LIB_H += url.h\n-LIB_H += urlmatch.h\n-LIB_H += userdiff.h\n-LIB_H += utf8.h\n-LIB_H += varint.h\n-LIB_H += vcs-svn/fast_export.h\n-LIB_H += vcs-svn/line_buffer.h\n-LIB_H += vcs-svn/repo_tree.h\n-LIB_H += vcs-svn/sliding_window.h\n-LIB_H += vcs-svn/svndiff.h\n-LIB_H += vcs-svn/svndump.h\n-LIB_H += walker.h\n-LIB_H += wildmatch.h\n-LIB_H += wt-status.h\n-LIB_H += xdiff-interface.h\n-LIB_H += xdiff/xdiff.h\n-LIB_H += xdiff/xdiffi.h\n-LIB_H += xdiff/xemit.h\n-LIB_H += xdiff/xinclude.h\n-LIB_H += xdiff/xmacros.h\n-LIB_H += xdiff/xprepare.h\n-LIB_H += xdiff/xtypes.h\n-LIB_H += xdiff/xutils.h\n+LIB_H = $(shell $(FIND) . \\\n+\t-name .git -prune -o \\\n+\t-name t -prune -o \\\n+\t-name Documentation -prune -o \\\n+\t-name '*.h' -print)\n \n LIB_OBJS += abspath.o\n LIB_OBJS += advice.o\n@@ -1381,7 +1260,6 @@ ifdef NO_INET_PTON\n endif\n ifndef NO_UNIX_SOCKETS\n \tLIB_OBJS += unix-socket.o\n-\tLIB_H += unix-socket.h\n \tPROGRAM_OBJS += credential-cache.o\n \tPROGRAM_OBJS += credential-cache--daemon.o\n endif\n@@ -1405,12 +1283,10 @@ endif\n ifdef BLK_SHA1\n \tSHA1_HEADER = \"block-sha1/sha1.h\"\n \tLIB_OBJS += block-sha1/sha1.o\n-\tLIB_H += block-sha1/sha1.h\n else\n ifdef PPC_SHA1\n \tSHA1_HEADER = \"ppc/sha1.h\"\n \tLIB_OBJS += ppc/sha1.o ppc/sha1ppc.o\n-\tLIB_H += ppc/sha1.h\n else\n ifdef APPLE_COMMON_CRYPTO\n \tCOMPAT_CFLAGS += -DCOMMON_DIGEST_FOR_OPENSSL\n@@ -2128,9 +2004,9 @@ XGETTEXT_FLAGS_C = $(XGETTEXT_FLAGS) --language=C \\\n XGETTEXT_FLAGS_SH = $(XGETTEXT_FLAGS) --language=Shell \\\n \t--keyword=gettextln --keyword=eval_gettextln\n XGETTEXT_FLAGS_PERL = $(XGETTEXT_FLAGS) --keyword=__ --language=Perl\n-LOCALIZED_C := $(C_OBJ:o=c) $(LIB_H) $(GENERATED_H)\n-LOCALIZED_SH := $(SCRIPT_SH)\n-LOCALIZED_PERL := $(SCRIPT_PERL)\n+LOCALIZED_C = $(C_OBJ:o=c) $(LIB_H) $(GENERATED_H)\n+LOCALIZED_SH = $(SCRIPT_SH)\n+LOCALIZED_PERL = $(SCRIPT_PERL)\n \n ifdef XGETTEXT_INCLUDE_TESTS\n LOCALIZED_C += t/t0200/test.c\n-- \n2.1.0.346.ga0367b9\n"},{"id":"248263","messageId":"20140825200939.GK30953@peff.net","threadId":"37316","inReplyTo":"20140825200042.GJ30953@peff.net","subject":"Re: [PATCH 2/3] Makefile: use `find` to determine static header dependencies","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2014-08-25T20:09:39Z","receivedAt":"2014-08-25T20:09:39Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Mon, Aug 25, 2014 at 04:00:42PM -0400, Jeff King wrote:\n\n> On Mon, Aug 25, 2014 at 12:46:41PM -0700, Jonathan Nieder wrote:\n> \n> > Jeff King wrote:\n> > \n> > > -LOCALIZED_C := $(C_OBJ:o=c) $(LIB_H) $(GENERATED_H)\n> > > +LOCALIZED_C = $(C_OBJ:o=c) $(GENERATED_H)\n> > \n> > Why is LIB_H dropped here?  This would mean that po/git.pot stops\n> > including strings from macros and static inline functions in headers\n> > (e.g., in parse-options.h).\n> \n> Ick, this is an accidental leftover from the earlier iteration of the\n> patch, which moved that part to a separate line (inside my gross\n> GIT_REAL_POT conditional). The extra line went away, but I forgot to add\n> $(LIB_H) back in here. Thanks for noticing.\n\nAs an aside, this makes an interesting case study for our git.git\nworkflow.\n\nIn some workflows, I would have made the original unacceptable patch,\nyou would have reviewed it, and then I would have made the followup\npatch to adjust it, and you would have reviewed that. But it's quite\nhard to see my mistake in just the followup patch; the fact that\n$(LIB_H) was originally part of $(LOCALIZED_C) does not appear in that\nhunk at all.\n\nBut in our workflow, we squash out the unacceptable diff, and you review\nfrom scratch the movement from the original working state (assuming the\nstatus quo was working :) ) to the newly proposed state. And there the\nmistake is quite a bit more obvious.\n\nJust an interesting observation.\n\n-Peff\n"},{"id":"248267","messageId":"20140825204516.GT20185@google.com","threadId":"37316","inReplyTo":"20140825200042.GJ30953@peff.net","subject":"Re: [PATCH 2/3] Makefile: use `find` to determine static header dependencies","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2014-08-25T20:45:16Z","receivedAt":"2014-08-25T20:45:16Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Jeff King wrote:\n\n> It is unfortunately easy for our static header list to grow\n> stale, as none of the regular developers make use of it.\n> Instead of trying to keep it up to date, let's invoke \"find\"\n> to generate the list dynamically.\n\nYep, I like this.\n\nIt does mean that people who run \"make pot\" have to be a little more\nvigilant about not keeping around extra .h files by mistake.  But I\ntrust them.\n\n[...]\n> +LIB_H = $(shell $(FIND) . \\\n> +\t-name .git -prune -o \\\n> +\t-name t -prune -o \\\n> +\t-name Documentation -prune -o \\\n> +\t-name '*.h' -print)\n\nTiny nit: I might use\n\n\t$(shell $(FIND) * \\\n\t\t-name . -o\n\t\t-name '.*' -prune -o \\\n\t\t-name t -prune -o \\\n\t\t-name Documentation -prune -o \\\n\t\t-name '*.h' -print)\n\nor\n\n\t$(shell $(FIND) * \\\n\t\t-name '.?*' -prune -o \\\n\t\t-name t -prune -o \\\n\t\t-name Documentation -prune -o \\\n\t\t-name '*.h' -print)\n\nto avoid spending time looking in other dot-directories like .svn,\n.hg, or .snapshot.\n\nWith or without such a change,\nReviewed-by: Jonathan Nieder <jrnieder@gmail.com>\n"},{"id":"248269","messageId":"xmqqppfol1sx.fsf@gitster.dls.corp.google.com","threadId":"37316","inReplyTo":"20140825204516.GT20185@google.com","subject":"Re: [PATCH 2/3] Makefile: use `find` to determine static header dependencies","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2014-08-25T21:03:26Z","receivedAt":"2014-08-25T21:03:26Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jonathan Nieder <jrnieder@gmail.com> writes:\n\n> Jeff King wrote:\n>\n>> It is unfortunately easy for our static header list to grow\n>> stale, as none of the regular developers make use of it.\n>> Instead of trying to keep it up to date, let's invoke \"find\"\n>> to generate the list dynamically.\n>\n> Yep, I like this.\n>\n> It does mean that people who run \"make pot\" have to be a little more\n> vigilant about not keeping around extra .h files by mistake.  But I\n> trust them.\n>\n> [...]\n>> +LIB_H = $(shell $(FIND) . \\\n>> +\t-name .git -prune -o \\\n>> +\t-name t -prune -o \\\n>> +\t-name Documentation -prune -o \\\n>> +\t-name '*.h' -print)\n>\n> Tiny nit: I might use\n>\n> \t$(shell $(FIND) * \\\n> \t\t-name . -o\n> \t\t-name '.*' -prune -o \\\n> \t\t-name t -prune -o \\\n> \t\t-name Documentation -prune -o \\\n> \t\t-name '*.h' -print)\n>\n> or\n>\n> \t$(shell $(FIND) * \\\n> \t\t-name '.?*' -prune -o \\\n> \t\t-name t -prune -o \\\n> \t\t-name Documentation -prune -o \\\n> \t\t-name '*.h' -print)\n>\n> to avoid spending time looking in other dot-directories like .svn,\n> .hg, or .snapshot.\n\nWouldn't it be sufficient to start digging not from \"*\" but from\n\"??*\"?  That is, something like\n\n\tfind ??* \\( -name Documentation -o -name .\\?\\* \\) -prune -o -name \\*.h\n\n;-)\n\n> With or without such a change,\n> Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>\n\nThanks.\n"},{"id":"248273","messageId":"20140825212705.GU20185@google.com","threadId":"37316","inReplyTo":"xmqqppfol1sx.fsf@gitster.dls.corp.google.com","subject":"Re: [PATCH 2/3] Makefile: use `find` to determine static header dependencies","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2014-08-25T21:27:06Z","receivedAt":"2014-08-25T21:27:06Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Junio C Hamano wrote:\n> Jonathan Nieder <jrnieder@gmail.com> writes:\n\n>> Tiny nit: I might use\n>>\n>> \t$(shell $(FIND) * \\\n>> \t\t-name . -o\n>> \t\t-name '.*' -prune -o \\\n>> \t\t-name t -prune -o \\\n>> \t\t-name Documentation -prune -o \\\n>> \t\t-name '*.h' -print)\n>>\n>> or\n>>\n>> \t$(shell $(FIND) * \\\n>> \t\t-name '.?*' -prune -o \\\n>> \t\t-name t -prune -o \\\n>> \t\t-name Documentation -prune -o \\\n>> \t\t-name '*.h' -print)\n>>\n>> to avoid spending time looking in other dot-directories like .svn,\n>> .hg, or .snapshot.\n>\n> Wouldn't it be sufficient to start digging not from \"*\" but from\n> \"??*\"?\n\nGah, the * was supposed to be . in my examples (though it doesn't\nhurt).\n\n> \tfind ??* \\( -name Documentation -o -name .\\?\\* \\) -prune -o -name \\*.h\n\nHeh.  Yeah, that would work. ;-)\n"},{"id":"248275","messageId":"xmqq4mx0kyrx.fsf@gitster.dls.corp.google.com","threadId":"37316","inReplyTo":"20140825212705.GU20185@google.com","subject":"Re: [PATCH 2/3] Makefile: use `find` to determine static header dependencies","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2014-08-25T22:08:50Z","receivedAt":"2014-08-25T22:08:50Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jonathan Nieder <jrnieder@gmail.com> writes:\n\n>> Wouldn't it be sufficient to start digging not from \"*\" but from\n>> \"??*\"?\n>\n> Gah, the * was supposed to be . in my examples (though it doesn't\n> hurt).\n>\n>> \tfind ??* \\( -name Documentation -o -name .\\?\\* \\) -prune -o -name \\*.h\n>\n> Heh.  Yeah, that would work. ;-)\n\nContinuing useless discussion...\n\nActually as you are not excluding CVS, RCS, etc., and using ??* as\nthe starting point will exclude .git, .hg, etc. at the top, I think\nwe can shorten it even further and say\n\n\tfind ??* -name Documentation -prune -o -name \\*.h\n\nor something.\n\n...and time to go back to something more serious and practical.\n\nDon't we want to exclude contrib/ by the way?\n"},{"id":"248297","messageId":"20140826123427.GD29180@peff.net","threadId":"37316","inReplyTo":"xmqq4mx0kyrx.fsf@gitster.dls.corp.google.com","subject":"Re: [PATCH 2/3] Makefile: use `find` to determine static header dependencies","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2014-08-26T12:34:27Z","receivedAt":"2014-08-26T12:34:27Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Mon, Aug 25, 2014 at 03:08:50PM -0700, Junio C Hamano wrote:\n\n> Jonathan Nieder <jrnieder@gmail.com> writes:\n> \n> >> Wouldn't it be sufficient to start digging not from \"*\" but from\n> >> \"??*\"?\n> >\n> > Gah, the * was supposed to be . in my examples (though it doesn't\n> > hurt).\n> >\n> >> \tfind ??* \\( -name Documentation -o -name .\\?\\* \\) -prune -o -name \\*.h\n> >\n> > Heh.  Yeah, that would work. ;-)\n> \n> Continuing useless discussion...\n> \n> Actually as you are not excluding CVS, RCS, etc., and using ??* as\n> the starting point will exclude .git, .hg, etc. at the top, I think\n> we can shorten it even further and say\n> \n> \tfind ??* -name Documentation -prune -o -name \\*.h\n> \n> or something.\n\nI had originally considered starting with \"find *\", but I was worried\nabout shell globbing overflowing command-line limits here. \"echo *\" on a\nbuilt tree is about 12K. That's laughably small for Linux, but would\nother systems (which, after all, are the main targets) be more picky?\n\nPOSIX lists 4K as the minimum, and that has to fit the environment, too.\n\nI'd also be fine to try it and see if anybody on an antique system\ncomplains.\n\n> Don't we want to exclude contrib/ by the way?\n\nProbably. For calculating dependencies, it is OK to be overly\nconservative (the worst case is that we trigger a recompile if somebody\ntouched contrib/.../foo.h, which is rather unlikely).\n\nFor the .pot file, being conservative is a little annoying.  In theory\nwe might want to translate stuff in contrib/, but it probably is just\nextra work for translators for not much benefit (though I have not\nreally used gettext; I assume it only pulls in strings marked with _()\nand friends, so being conservative is maybe not that big a deal...).\n\nIn that sense, maybe we should just hit the whole tree to be on the\nconservative side. The two reasons I did not in my initial attempt were:\n\n  1. Performance. But with the final form, we only the run the `find` at\n     all very rarely, so shaving off a few readdirs() is not that big a\n     deal.\n\n  2. There are a few problematic areas. t/perf may contain build trees\n     which are copies of git, which I expect would confuse gettext.\n\nSo I dunno.\n\n-Peff\n"},{"id":"248320","messageId":"xmqqiolfjio4.fsf@gitster.dls.corp.google.com","threadId":"37316","inReplyTo":"20140826123427.GD29180@peff.net","subject":"Re: [PATCH 2/3] Makefile: use `find` to determine static header dependencies","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2014-08-26T16:54:19Z","receivedAt":"2014-08-26T16:54:19Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jeff King <peff@peff.net> writes:\n\n>> Actually as you are not excluding CVS, RCS, etc., and using ??* as\n>> the starting point will exclude .git, .hg, etc. at the top, I think\n>> we can shorten it even further and say\n>> \n>> \tfind ??* -name Documentation -prune -o -name \\*.h\n>> \n>> or something.\n>\n> I had originally considered starting with \"find *\", but I was worried\n> about shell globbing overflowing command-line limits here. \"echo *\" on a\n> built tree is about 12K.\n\nOK.  What I queued is still your original which is the most\nconservative among various \"fun\" alternatives we have seen so far on\nthis thread, so we should be good ;-)\n\nThanks.\n"},{"id":"248325","messageId":"20140826172959.GA16394@peff.net","threadId":"37316","inReplyTo":"xmqqiolfjio4.fsf@gitster.dls.corp.google.com","subject":"Re: [PATCH 2/3] Makefile: use `find` to determine static header dependencies","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2014-08-26T17:29:59Z","receivedAt":"2014-08-26T17:29:59Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Tue, Aug 26, 2014 at 09:54:19AM -0700, Junio C Hamano wrote:\n\n> Jeff King <peff@peff.net> writes:\n> \n> >> Actually as you are not excluding CVS, RCS, etc., and using ??* as\n> >> the starting point will exclude .git, .hg, etc. at the top, I think\n> >> we can shorten it even further and say\n> >> \n> >> \tfind ??* -name Documentation -prune -o -name \\*.h\n> >> \n> >> or something.\n> >\n> > I had originally considered starting with \"find *\", but I was worried\n> > about shell globbing overflowing command-line limits here. \"echo *\" on a\n> > built tree is about 12K.\n> \n> OK.  What I queued is still your original which is the most\n> conservative among various \"fun\" alternatives we have seen so far on\n> this thread, so we should be good ;-)\n\nThe only thing I think mine does not do that Jonathan suggested is\ndropping .hg, etc. I do not know why anyone would track git in hg, but\nit might make sense to s/.git/.?/ in what I sent.\n\n(I noticed also that you did not queue the third patch to drop\nCHECK_HEADER_DEPENDENCIES; I'm OK if we keep it, but I wanted to make\nsure it was not an oversight).\n\n-Peff\n"},{"id":"248340","messageId":"xmqqegw3hwf2.fsf@gitster.dls.corp.google.com","threadId":"37316","inReplyTo":"20140826172959.GA16394@peff.net","subject":"Re: [PATCH 2/3] Makefile: use `find` to determine static header dependencies","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2014-08-26T19:40:17Z","receivedAt":"2014-08-26T19:40:17Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jeff King <peff@peff.net> writes:\n\n> On Tue, Aug 26, 2014 at 09:54:19AM -0700, Junio C Hamano wrote:\n>\n>> Jeff King <peff@peff.net> writes:\n>> \n>> >> Actually as you are not excluding CVS, RCS, etc., and using ??* as\n>> >> the starting point will exclude .git, .hg, etc. at the top, I think\n>> >> we can shorten it even further and say\n>> >> \n>> >> \tfind ??* -name Documentation -prune -o -name \\*.h\n>> >> \n>> >> or something.\n>> >\n>> > I had originally considered starting with \"find *\", but I was worried\n>> > about shell globbing overflowing command-line limits here. \"echo *\" on a\n>> > built tree is about 12K.\n>> \n>> OK.  What I queued is still your original which is the most\n>> conservative among various \"fun\" alternatives we have seen so far on\n>> this thread, so we should be good ;-)\n>\n> The only thing I think mine does not do that Jonathan suggested is\n> dropping .hg, etc. I do not know why anyone would track git in hg, but\n> it might make sense to s/.git/.?/ in what I sent.\n>\n> (I noticed also that you did not queue the third patch to drop\n> CHECK_HEADER_DEPENDENCIES; I'm OK if we keep it, but I wanted to make\n> sure it was not an oversight).\n\nIt started as \"I just ran out of time to really think about it\" and\ntransitioned to \"Ahh, I forgot that I postponed deciding\" ;-)\n"}]}