git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jonathan Nieder <jrnieder@gmail.com>
To: Git Mailing List <git@vger.kernel.org>
Cc: Junio C Hamano <gitster@pobox.com>,
	Johannes Schindelin <Johannes.Schindelin@gmx.de>,
	Erik Faye-Lund <kusmabite@googlemail.com>,
	Sverre Rabbelier <srabbelier@gmail.com>,
	Andreas Schwab <schwab@linux-m68k.org>
Subject: [PATCH v2 11/12] Makefile: list standalone program object files in PROGRAM_OBJS
Date: Wed, 27 Jan 2010 03:07:21 -0600	[thread overview]
Message-ID: <20100127090423.GA28252@progeny.tock> (raw)
In-Reply-To: <20100126155423.GL4895@progeny.tock>

Because of new commands like git-remote-http, the OBJECTS list
contains fictitious objects such as remote-http.o.  Thus any
out-of-tree rules that require all $(OBJECTS) to be buildable
are broken.  Add a list of real program objects to avoid this
problem.

To avoid duplication of effort, calculate the command list in
the PROGRAMS variable using the expansion of PROGRAM_OBJS.
This calculation occurs at the time $(PROGRAMS) is expanded,
so later additions to PROGRAM_OBJS will be reflected in it,
provided they occur before the build rules begin on line 1489.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
---
The previous version of this patch had a bug: I assumed that

	PROGRAMS += $(patsubst %.o,git-%$X,$(PROGRAM_OBJS))

would add to PROGRAMS a list of command names derived from the value
of PROGRAM_OBJS at the time that line is first read; but in fact, what
matters is the value of PROGRAM_OBJS at expansion time.

More importantly, my process had a bug: I didn’t try 'make install'
before sending.  Sorry about that.  Here’s a fixed patch, at least.

I have pushed out this fix to

  git://repo.or.cz/git/jrn.git autodep-rebased
  git://repo.or.cz/git/jrn.git autodep

The former has been rerolled to include the fixed patch 11; the
latter includes a fixup commit at the end.

Thanks to Junio for the report.

 Makefile |   28 ++++++++++++++++------------
 1 files changed, 16 insertions(+), 12 deletions(-)

diff --git a/Makefile b/Makefile
index df36173..630687f 100644
--- a/Makefile
+++ b/Makefile
@@ -341,6 +341,7 @@ COMPAT_CFLAGS =
 COMPAT_OBJS =
 LIB_H =
 LIB_OBJS =
+PROGRAM_OBJS =
 PROGRAMS =
 SCRIPT_PERL =
 SCRIPT_PYTHON =
@@ -390,12 +391,15 @@ EXTRA_PROGRAMS =
 
 # ... and all the rest that could be moved out of bindir to gitexecdir
 PROGRAMS += $(EXTRA_PROGRAMS)
-PROGRAMS += git-fast-import$X
-PROGRAMS += git-imap-send$X
-PROGRAMS += git-shell$X
-PROGRAMS += git-show-index$X
-PROGRAMS += git-upload-pack$X
-PROGRAMS += git-http-backend$X
+
+PROGRAM_OBJS += fast-import.o
+PROGRAM_OBJS += imap-send.o
+PROGRAM_OBJS += shell.o
+PROGRAM_OBJS += show-index.o
+PROGRAM_OBJS += upload-pack.o
+PROGRAM_OBJS += http-backend.o
+
+PROGRAMS += $(patsubst %.o,git-%$X,$(PROGRAM_OBJS))
 
 TEST_PROGRAMS_NEED_X += test-chmtime
 TEST_PROGRAMS_NEED_X += test-ctype
@@ -1139,11 +1143,12 @@ else
 	REMOTE_CURL_PRIMARY = git-remote-http$X
 	REMOTE_CURL_ALIASES = git-remote-https$X git-remote-ftp$X git-remote-ftps$X
 	REMOTE_CURL_NAMES = $(REMOTE_CURL_PRIMARY) $(REMOTE_CURL_ALIASES)
-	PROGRAMS += $(REMOTE_CURL_NAMES) git-http-fetch$X
+	PROGRAM_OBJS += http-fetch.o
+	PROGRAMS += $(REMOTE_CURL_NAMES)
 	curl_check := $(shell (echo 070908; curl-config --vernum) | sort -r | sed -ne 2p)
 	ifeq "$(curl_check)" "070908"
 		ifndef NO_EXPAT
-			PROGRAMS += git-http-push$X
+			PROGRAM_OBJS += http-push.o
 		endif
 	endif
 	ifndef NO_EXPAT
@@ -1163,7 +1168,7 @@ endif
 EXTLIBS += -lz
 
 ifndef NO_POSIX_ONLY_PROGRAMS
-	PROGRAMS += git-daemon$X
+	PROGRAM_OBJS += daemon.o
 endif
 ifndef NO_OPENSSL
 	OPENSSL_LIBSSL = -lssl
@@ -1670,9 +1675,8 @@ 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))
+GIT_OBJS := $(LIB_OBJS) $(BUILTIN_OBJS) $(PROGRAM_OBJS) $(TEST_OBJS) \
+	git.o http.o http-walker.o remote-curl.o
 XDIFF_OBJS = xdiff/xdiffi.o xdiff/xprepare.o xdiff/xutils.o xdiff/xemit.o \
 	xdiff/xmerge.o xdiff/xpatience.o
 OBJECTS := $(GIT_OBJS) $(XDIFF_OBJS)
-- 
1.6.6

  reply	other threads:[~2010-01-27  9:07 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-23 14:42 [PATCH 0/5] Makefile: add missing header dependency rules Jonathan Nieder
2010-01-23 14:43 ` [PATCH 1/5] Makefile: add missing header file dependencies Jonathan Nieder
2010-01-23 14:44 ` [PATCH 2/5] Makefile: make sure test helpers are rebuilt when headers change Jonathan Nieder
2010-01-23 14:44 ` [PATCH 3/5] Makefile: remove wt-status.h from LIB_H Jonathan Nieder
2010-01-23 14:45 ` [PATCH 4/5] Makefile: clean up http-walker.o dependency rules Jonathan Nieder
2010-01-23 14:45 ` [PATCH 5/5] Makefile: drop dependency on $(wildcard */*.h) Jonathan Nieder
2010-01-25  4:44 ` [PATCH 0/5] Makefile: add missing header dependency rules Junio C Hamano
2010-01-26 15:43   ` [PATCH 00/12] " Jonathan Nieder
2010-01-26 15:44     ` [PATCH 01/12] Makefile: add missing header file dependencies Jonathan Nieder
2010-01-26 15:45     ` [PATCH 02/12] Makefile: make sure test helpers are rebuilt when headers change Jonathan Nieder
2010-01-26 15:46     ` [PATCH 03/12] Makefile: remove wt-status.h from LIB_H Jonathan Nieder
2010-01-26 15:46     ` [PATCH 04/12] Makefile: clean up http-walker.o dependency rules Jonathan Nieder
2010-01-26 15:46     ` [PATCH 05/12] Makefile: drop dependency on $(wildcard */*.h) Jonathan Nieder
2010-01-26 15:47     ` [PATCH 06/12] Makefile: transport.o depends on branch.h now Jonathan Nieder
2010-01-26 15:49     ` [PATCH 07/12] Makefile: rearrange dependency rules Jonathan Nieder
2010-01-26 15:51     ` [PATCH 08/12] Makefile: disable default implicit rules Jonathan Nieder
2010-01-26 15:52     ` [PATCH 09/12] Makefile: list generated object files in OBJECTS Jonathan Nieder
2010-01-26 15:52     ` [PATCH 10/12] Makefile: lazily compute header dependencies Jonathan Nieder
2010-01-26 15:54     ` [PATCH 11/12] Makefile: list standalone program object files in PROGRAM_OBJS Jonathan Nieder
2010-01-27  9:07       ` Jonathan Nieder [this message]
2010-01-26 15:57     ` [PATCH 12/12] Teach Makefile to check header dependencies Jonathan Nieder
2010-01-31 20:42       ` Junio C Hamano
2010-01-31 21:14         ` Jonathan Nieder
2010-01-31 21:26           ` Junio C Hamano
2010-01-31 21:37             ` [PATCH 14/12] Makefile: always remove .depend directories on 'make clean' Jonathan Nieder
2010-01-31 21:23         ` [PATCH 13/12] Makefile: tuck away generated makefile fragments in .depend Jonathan Nieder
2010-01-26 16:19     ` [PATCH 00/12] Re: Makefile: add missing header dependency rules Jonathan Nieder

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100127090423.GA28252@progeny.tock \
    --to=jrnieder@gmail.com \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=kusmabite@googlemail.com \
    --cc=schwab@linux-m68k.org \
    --cc=srabbelier@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).