Makefile: rearrange dependency rules
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>
Jonathan Nieder committed
Jan 26, 2010 at 09:49 UTC
beeb4564bb7133fd12e6811a701686982b10cc2f
1 file changed
+25
-24
Makefile
+25
-24
@@ -1666,6 +1666,12 @@ git.o git.spec \
1666
$(patsubst %.perl,%,$(SCRIPT_PERL)) \
1667
: GIT-VERSION-FILE
1668
1669
+GIT_OBJS := $(LIB_OBJS) $(BUILTIN_OBJS) $(TEST_OBJS) \
1670
+ git.o http.o http-walker.o remote-curl.o \
1671
+ $(patsubst git-%$X,%.o,$(PROGRAMS))
1672
+XDIFF_OBJS = xdiff/xdiffi.o xdiff/xprepare.o xdiff/xutils.o xdiff/xemit.o \
1673
+ xdiff/xmerge.o xdiff/xpatience.o
1674
+
1675
%.o: %.c GIT-CFLAGS
1676
$(QUIET_CC)$(CC) -o $*.o -c $(ALL_CFLAGS) $<
1677
%.s: %.c GIT-CFLAGS FORCE
@@ -1673,6 +1679,25 @@ git.o git.spec \
1679
%.o: %.S GIT-CFLAGS
1680
$(QUIET_CC)$(CC) -o $*.o -c $(ALL_CFLAGS) $<
1681
1682
+$(GIT_OBJS): $(LIB_H)
1683
+builtin-branch.o builtin-checkout.o builtin-clone.o builtin-reset.o branch.o transport.o: branch.h
1684
+builtin-bundle.o bundle.o transport.o: bundle.h
1685
+builtin-bisect--helper.o builtin-rev-list.o bisect.o: bisect.h
1686
+builtin-clone.o builtin-fetch-pack.o transport.o: fetch-pack.h
1687
+builtin-send-pack.o transport.o: send-pack.h
1688
+builtin-log.o builtin-shortlog.o: shortlog.h
1689
+builtin-prune.o builtin-reflog.o reachable.o: reachable.h
1690
+builtin-commit.o builtin-revert.o wt-status.o: wt-status.h
1691
+builtin-tar-tree.o archive-tar.o: tar.h
1692
+builtin-pack-objects.o: thread-utils.h
1693
+http-fetch.o http-walker.o remote-curl.o transport.o walker.o: walker.h
1694
+http.o http-walker.o http-push.o remote-curl.o: http.h
1695
+
1696
+
1697
+xdiff-interface.o $(XDIFF_OBJS): \
1698
+ xdiff/xinclude.h xdiff/xmacros.h xdiff/xdiff.h xdiff/xtypes.h \
1699
+ xdiff/xutils.h xdiff/xprepare.h xdiff/xdiffi.h xdiff/xemit.h
1700
+
1701
exec_cmd.s exec_cmd.o: ALL_CFLAGS += \
1702
'-DGIT_EXEC_PATH="$(gitexecdir_SQ)"' \
1703
'-DBINDIR="$(bindir_relative_SQ)"' \
@@ -1696,10 +1721,6 @@ git-imap-send$X: imap-send.o $(GITLIBS)
1721
$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
1722
$(LIBS) $(OPENSSL_LINK) $(OPENSSL_LIBSSL)
1723
1699
-http.o http-walker.o http-push.o remote-curl.o: http.h
1700
-
1701
-http.o http-walker.o remote-curl.o: $(LIB_H)
1702
-
1724
git-http-fetch$X: revision.o http.o http-walker.o http-fetch.o $(GITLIBS)
1725
$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
1726
$(LIBS) $(CURL_LIBCURL)
@@ -1717,29 +1738,9 @@ $(REMOTE_CURL_PRIMARY): remote-curl.o http.o http-walker.o $(GITLIBS)
1738
$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
1739
$(LIBS) $(CURL_LIBCURL) $(EXPAT_LIBEXPAT)
1740
1720
-$(LIB_OBJS) $(BUILTIN_OBJS): $(LIB_H)
1721
-$(patsubst git-%$X,%.o,$(PROGRAMS)) $(TEST_OBJS) git.o: $(LIB_H)
1722
-builtin-branch.o builtin-checkout.o builtin-clone.o builtin-reset.o branch.o transport.o: branch.h
1723
-builtin-bundle.o bundle.o transport.o: bundle.h
1724
-builtin-bisect--helper.o builtin-rev-list.o bisect.o: bisect.h
1725
-builtin-clone.o builtin-fetch-pack.o transport.o: fetch-pack.h
1726
-builtin-send-pack.o transport.o: send-pack.h
1727
-builtin-log.o builtin-shortlog.o: shortlog.h
1728
-builtin-prune.o builtin-reflog.o reachable.o: reachable.h
1729
-builtin-commit.o builtin-revert.o wt-status.o: wt-status.h
1730
-builtin-tar-tree.o archive-tar.o: tar.h
1731
-builtin-pack-objects.o: thread-utils.h
1732
-http-fetch.o http-walker.o remote-curl.o transport.o walker.o: walker.h
1733
-
1741
$(LIB_FILE): $(LIB_OBJS)
1742
$(QUIET_AR)$(RM) $@ && $(AR) rcs $@ $(LIB_OBJS)
1743
1737
-XDIFF_OBJS=xdiff/xdiffi.o xdiff/xprepare.o xdiff/xutils.o xdiff/xemit.o \
1738
- xdiff/xmerge.o xdiff/xpatience.o
1739
-xdiff-interface.o $(XDIFF_OBJS): \
1740
- xdiff/xinclude.h xdiff/xmacros.h xdiff/xdiff.h xdiff/xtypes.h \
1741
- xdiff/xutils.h xdiff/xprepare.h xdiff/xdiffi.h xdiff/xemit.h
1742
-
1744
$(XDIFF_LIB): $(XDIFF_OBJS)
1745
$(QUIET_AR)$(RM) $@ && $(AR) rcs $@ $(XDIFF_OBJS)
1746