git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 07/12] Makefile: rearrange dependency rules

From
Jonathan Nieder <jrnieder@gmail.com>
Date
Jan 26, 2010, 15:49 UTC
Message-ID
<20100126154933.GH4895@progeny.tock>
In-Reply-To
<20100126154357.GA4895@progeny.tock>

Put rules listing dependencies of compiled objects (.o files) on header files (.h files) in one place, to make them easier to compare and modify all at once.

Add a GIT_OBJS variable listing objects that depend on LIB_H, for similar reasons.

No change in build-time behavior intended.
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
---
 Makefile |   49 +++++++++++++++++++++++++------------------------
 1 files changed, 25 insertions(+), 24 deletions(-)
diff --git a/Makefile b/Makefile
index 5678991..84ce137 100644
--- a/Makefile
+++ b/Makefile
@@ -1666,6 +1666,12 @@ git.o git.spec \
 	$(patsubst %.perl,%,$(SCRIPT_PERL)) \
 	: GIT-VERSION-FILE
 
+GIT_OBJS := $(LIB_OBJS) $(BUILTIN_OBJS) $(TEST_OBJS) \
+	git.o http.o http-walker.o remote-curl.o \
+	$(patsubst git-%$X,%.o,$(PROGRAMS))
+XDIFF_OBJS = xdiff/xdiffi.o xdiff/xprepare.o xdiff/xutils.o xdiff/xemit.o \
+	xdiff/xmerge.o xdiff/xpatience.o
+
 %.o: %.c GIT-CFLAGS
 	$(QUIET_CC)$(CC) -o $*.o -c $(ALL_CFLAGS) $<
 %.s: %.c GIT-CFLAGS FORCE
@@ -1673,6 +1679,25 @@ git.o git.spec \
 %.o: %.S GIT-CFLAGS
 	$(QUIET_CC)$(CC) -o $*.o -c $(ALL_CFLAGS) $<
 
+$(GIT_OBJS): $(LIB_H)
+builtin-branch.o builtin-checkout.o builtin-clone.o builtin-reset.o branch.o transport.o: branch.h
+builtin-bundle.o bundle.o transport.o: bundle.h
+builtin-bisect--helper.o builtin-rev-list.o bisect.o: bisect.h
+builtin-clone.o builtin-fetch-pack.o transport.o: fetch-pack.h
+builtin-send-pack.o transport.o: send-pack.h
+builtin-log.o builtin-shortlog.o: shortlog.h
+builtin-prune.o builtin-reflog.o reachable.o: reachable.h
+builtin-commit.o builtin-revert.o wt-status.o: wt-status.h
+builtin-tar-tree.o archive-tar.o: tar.h
+builtin-pack-objects.o: thread-utils.h
+http-fetch.o http-walker.o remote-curl.o transport.o walker.o: walker.h
+http.o http-walker.o http-push.o remote-curl.o: http.h
+
+
+xdiff-interface.o $(XDIFF_OBJS): \
+	xdiff/xinclude.h xdiff/xmacros.h xdiff/xdiff.h xdiff/xtypes.h \
+	xdiff/xutils.h xdiff/xprepare.h xdiff/xdiffi.h xdiff/xemit.h
+
 exec_cmd.s exec_cmd.o: ALL_CFLAGS += \
 	'-DGIT_EXEC_PATH="$(gitexecdir_SQ)"' \
 	'-DBINDIR="$(bindir_relative_SQ)"' \
@@ -1696,10 +1721,6 @@ git-imap-send$X: imap-send.o $(GITLIBS)
 	$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
 		$(LIBS) $(OPENSSL_LINK) $(OPENSSL_LIBSSL)
 
-http.o http-walker.o http-push.o remote-curl.o: http.h
-
-http.o http-walker.o remote-curl.o: $(LIB_H)
-
 git-http-fetch$X: revision.o http.o http-walker.o http-fetch.o $(GITLIBS)
 	$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
 		$(LIBS) $(CURL_LIBCURL)
@@ -1717,29 +1738,9 @@ $(REMOTE_CURL_PRIMARY): remote-curl.o http.o http-walker.o $(GITLIBS)
 	$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
 		$(LIBS) $(CURL_LIBCURL) $(EXPAT_LIBEXPAT)
 
-$(LIB_OBJS) $(BUILTIN_OBJS): $(LIB_H)
-$(patsubst git-%$X,%.o,$(PROGRAMS)) $(TEST_OBJS) git.o: $(LIB_H)
-builtin-branch.o builtin-checkout.o builtin-clone.o builtin-reset.o branch.o transport.o: branch.h
-builtin-bundle.o bundle.o transport.o: bundle.h
-builtin-bisect--helper.o builtin-rev-list.o bisect.o: bisect.h
-builtin-clone.o builtin-fetch-pack.o transport.o: fetch-pack.h
-builtin-send-pack.o transport.o: send-pack.h
-builtin-log.o builtin-shortlog.o: shortlog.h
-builtin-prune.o builtin-reflog.o reachable.o: reachable.h
-builtin-commit.o builtin-revert.o wt-status.o: wt-status.h
-builtin-tar-tree.o archive-tar.o: tar.h
-builtin-pack-objects.o: thread-utils.h
-http-fetch.o http-walker.o remote-curl.o transport.o walker.o: walker.h
-
 $(LIB_FILE): $(LIB_OBJS)
 	$(QUIET_AR)$(RM) $@ && $(AR) rcs $@ $(LIB_OBJS)
 
-XDIFF_OBJS=xdiff/xdiffi.o xdiff/xprepare.o xdiff/xutils.o xdiff/xemit.o \
-	xdiff/xmerge.o xdiff/xpatience.o
-xdiff-interface.o $(XDIFF_OBJS): \
-	xdiff/xinclude.h xdiff/xmacros.h xdiff/xdiff.h xdiff/xtypes.h \
-	xdiff/xutils.h xdiff/xprepare.h xdiff/xdiffi.h xdiff/xemit.h
-
 $(XDIFF_LIB): $(XDIFF_OBJS)
 	$(QUIET_AR)$(RM) $@ && $(AR) rcs $@ $(XDIFF_OBJS)
 
-- 
1.6.6
Previous: Jonathan NiederNext: Jonathan Nieder
Message 15 of 27 in “Makefile: add missing header dependency rules”
  1. 0/5 Makefile: add missing header dependency rulesJonathan Nieder, Jan 23, 2010
  2. 1/5 Makefile: add missing header file dependenciesJonathan Nieder, Jan 23, 2010
  3. 2/5 Makefile: make sure test helpers are rebuilt when headers changeJonathan Nieder, Jan 23, 2010
  4. 3/5 Makefile: remove wt-status.h from LIB_HJonathan Nieder, Jan 23, 2010
  5. 4/5 Makefile: clean up http-walker.o dependency rulesJonathan Nieder, Jan 23, 2010
  6. 5/5 Makefile: drop dependency on $(wildcard */*.h)Jonathan Nieder, Jan 23, 2010
  7. Junio C HamanoJan 25, 2010
  8. 00/12 Re: Makefile: add missing header dependency rulesJonathan Nieder, Jan 26, 2010
  9. 01/12 Makefile: add missing header file dependenciesJonathan Nieder, Jan 26, 2010
  10. 02/12 Makefile: make sure test helpers are rebuilt when headers changeJonathan Nieder, Jan 26, 2010
  11. 03/12 Makefile: remove wt-status.h from LIB_HJonathan Nieder, Jan 26, 2010
  12. 04/12 Makefile: clean up http-walker.o dependency rulesJonathan Nieder, Jan 26, 2010
  13. 05/12 Makefile: drop dependency on $(wildcard */*.h)Jonathan Nieder, Jan 26, 2010
  14. 06/12 Makefile: transport.o depends on branch.h nowJonathan Nieder, Jan 26, 2010
  15. 07/12 Makefile: rearrange dependency rulesJonathan Nieder, Jan 26, 2010
  16. 08/12 Makefile: disable default implicit rulesJonathan Nieder, Jan 26, 2010
  17. 09/12 Makefile: list generated object files in OBJECTSJonathan Nieder, Jan 26, 2010
  18. 10/12 Makefile: lazily compute header dependenciesJonathan Nieder, Jan 26, 2010
  19. 11/12 Makefile: list standalone program object files in PROGRAM_OBJSJonathan Nieder, Jan 26, 2010
  20. 11/12 Makefile: list standalone program object files in PROGRAM_OBJSJonathan Nieder, Jan 27, 2010
  21. 12/12 Teach Makefile to check header dependenciesJonathan Nieder, Jan 26, 2010
  22. Junio C HamanoJan 31, 2010
  23. Jonathan NiederJan 31, 2010
  24. Junio C HamanoJan 31, 2010
  25. 14/12 Makefile: always remove .depend directories on 'make clean'Jonathan Nieder, Jan 31, 2010
  26. 13/12 Makefile: tuck away generated makefile fragments in .dependJonathan Nieder, Jan 31, 2010
  27. Jonathan NiederJan 26, 2010

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.