Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Pedro Alves <palves@redhat.com>
To: Yao Qi <yao@codesourcery.com>
Cc: Doug Evans <dje@google.com>, gdb-patches@sourceware.org
Subject: Re: [PATCH] Link gnulib in gdbserver.
Date: Fri, 13 Apr 2012 11:20:00 -0000	[thread overview]
Message-ID: <4F88088D.5030601@redhat.com> (raw)
In-Reply-To: <4F8774DC.4040004@codesourcery.com>

On 04/13/2012 01:35 AM, Yao Qi wrote:

> On 04/13/2012 04:21 AM, Doug Evans wrote:
>> Pedro thinks it's this:
>> FLAGS_TO_PASS changes $srcdir.  and install: does @$(MAKE)
>> $(FLAGS_TO_PASS) install-only
> 
> $(FLAGS_TO_PASS) is used to pass to Makefiles in sub-dirs.  When
> invoking install-only target, it is unnecessary to pass
> $(FLAGS_TO_PASS).  In the commands of target install-only below,
> $(FLAGS_TO_PASS) is passed to Makefiles in sub-dirs.
> 
> This patch just simply remove $(FLAGS_TO_PASS) in install target.  Is it OK?


I'm not a make expert, but I think this is more about passing variables
to sub-makes then about sub-dirs.  Note how everything in FLAGS_TO_PASS
(before the gnulib changes) is just the unitary FOO=$(FOO).

So I think this is better, and actually cleaner, for keeping FLAGS_TO_PASS
as it was, the gnulib specifics closer to gnulib code, and actually adding a
comment just around the gnulib specific GNULIB_FLAGS_TO_PASS.  :-)

BTW, is it really necessary to VPATH set to:

 VPATH=$(abs_top_srcdir)/../gnulib:$(abs_top_srcdir)"

instead of just:

 VPATH=$(abs_top_srcdir)/../gnulib"

I tried it, and things still appear to build fine.  IOW, is there a case
where building gnulib would need to find something in the gdbserver source dir?

-- 
Pedro Alves

2012-04-13  Pedro Alves  <palves@redhat.com>

	* Makefile.in (GNULIB_FLAGS_TO_PASS): New.
	(FLAGS_TO_PASS): Don't change or set $top_srcdir, $srcdir and VPATH.
	(all, uninstall, clean-info, all-lib, clean, maintainer-clean)
	(realclean, distclean): Explicitly pass $GNULIB_FLAGS_TO_PASS to
	the sub-make.
---

 gdb/gdbserver/Makefile.in |   24 +++++++++++++++---------
 1 files changed, 15 insertions(+), 9 deletions(-)

diff --git a/gdb/gdbserver/Makefile.in b/gdb/gdbserver/Makefile.in
index aa8b13b..de6e636 100644
--- a/gdb/gdbserver/Makefile.in
+++ b/gdb/gdbserver/Makefile.in
@@ -79,6 +79,14 @@ ustinc = @ustinc@
 GNULIB_INCLUDE_DIR = $(srcdir)/../gnulib
 GNULIB_LIB = gnulib/libgnu.a

+# We build gnulib directly under the gdbserver build directory, but
+# its sources don't live directly under gdbserver's source directory.
+# Tweak $srcdir and VPATH to make that work.
+GNULIB_FLAGS_TO_PASS = \
+	"top_srcdir=$(abs_top_srcdir)/.." \
+	"srcdir=$(abs_srcdir)/../gnulib" \
+	"VPATH=$(abs_top_srcdir)/../gnulib:$(abs_top_srcdir)"
+
 # Generated headers in the gnulib directory.  These must be listed
 # so that they are generated before other files are compiled.
 GNULIB_H = gnulib/string.h @GNULIB_STDINT_H@
@@ -169,8 +177,6 @@ extra_libraries = @extra_libraries@
 FLAGS_TO_PASS = \
 	"prefix=$(prefix)" \
 	"exec_prefix=$(exec_prefix)" \
-	"top_srcdir=$(abs_top_srcdir)/.." "srcdir=$(abs_srcdir)/../gnulib" \
-	"VPATH=$(abs_top_srcdir)/../gnulib:$(abs_top_srcdir)" \
 	"infodir=$(infodir)" \
 	"datarootdir=$(datarootdir)" \
 	"docdir=$(docdir)" \
@@ -206,7 +212,7 @@ FLAGS_TO_PASS = \
 	${CC} -c ${INTERNAL_CFLAGS} $<

 all: gdbserver$(EXEEXT) gdbreplay$(EXEEXT) $(extra_libraries)
-	@cd gnulib; $(MAKE) $(FLAGS_TO_PASS) all
+	@cd gnulib; $(MAKE) $(FLAGS_TO_PASS) $(GNULIB_FLAGS_TO_PASS) all

 # Traditionally "install" depends on "all".  But it may be useful
 # not to; for example, if the user has made some trivial change to a
@@ -227,13 +233,13 @@ install-only:
 	$(INSTALL_PROGRAM) gdbserver$(EXEEXT) $(DESTDIR)$(bindir)/$$n$(EXEEXT); \
 	$(SHELL) $(srcdir)/../../mkinstalldirs $(DESTDIR)$(man1dir); \
 	$(INSTALL_DATA) $(srcdir)/gdbserver.1 $(DESTDIR)$(man1dir)/$$n.1
-	@cd gnulib; $(MAKE) $(FLAGS_TO_PASS) install
+	@cd gnulib; $(MAKE) $(FLAGS_TO_PASS) $(GNULIB_FLAGS_TO_PASS) install

 uninstall: force
 	n=`echo gdbserver | sed '$(program_transform_name)'`; \
 	if [ x$$n = x ]; then n=gdbserver; else true; fi; \
 	rm -f $(DESTDIR)/$(bindir)/$$n$(EXEEXT) $(DESTDIR)$(man1dir)/$$n.1
-	@cd gnulib; $(MAKE) $(FLAGS_TO_PASS) uninstall
+	@cd gnulib; $(MAKE) $(FLAGS_TO_PASS) $(GNULIB_FLAGS_TO_PASS) uninstall

 installcheck:
 check:
@@ -243,7 +249,7 @@ install-pdf:
 html:
 install-html:
 clean-info: force
-	@cd gnulib; $(MAKE) $(FLAGS_TO_PASS) $@
+	@cd gnulib; $(MAKE) $(FLAGS_TO_PASS) $(GNULIB_FLAGS_TO_PASS) $@

 gdbserver$(EXEEXT): $(OBS) ${ADD_DEPS} ${CDEPS} $(GNULIB_LIB)
 	rm -f gdbserver$(EXEEXT)
@@ -252,7 +258,7 @@ gdbserver$(EXEEXT): $(OBS) ${ADD_DEPS} ${CDEPS} $(GNULIB_LIB)

 $(GNULIB_LIB) $(GNULIB_H): all-lib
 all-lib: gnulib/Makefile
-	@cd gnulib; $(MAKE) $(FLAGS_TO_PASS) all
+	@cd gnulib; $(MAKE) $(FLAGS_TO_PASS) $(GNULIB_FLAGS_TO_PASS) all

 .PHONY: all-lib

@@ -308,12 +314,12 @@ clean:
 	rm -f i386-avx.c i386-avx-linux.c
 	rm -f amd64-avx.c amd64-avx-linux.c
 	rm -f i386-mmx.c i386-mmx-linux.c
-	@cd gnulib; $(MAKE) $(FLAGS_TO_PASS) clean
+	@cd gnulib; $(MAKE) $(FLAGS_TO_PASS) $(GNULIB_FLAGS_TO_PASS) clean

 maintainer-clean realclean distclean: clean
 	rm -f nm.h tm.h xm.h config.status config.h stamp-h config.log
 	rm -f Makefile
-	@cd gnulib; $(MAKE) $(FLAGS_TO_PASS) $@
+	@cd gnulib; $(MAKE) $(FLAGS_TO_PASS) $(GNULIB_FLAGS_TO_PASS) $@

 config.h: stamp-h ; @true
 stamp-h: config.in config.status


  reply	other threads:[~2012-04-13 11:06 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-11  8:41 Yao Qi
2012-04-11 18:11 ` Pedro Alves
2012-04-12  8:14   ` Yao Qi
2012-04-12 20:26     ` Doug Evans
2012-04-13  0:47       ` Yao Qi
2012-04-13 11:20         ` Pedro Alves [this message]
2012-04-13 11:24           ` Pedro Alves
2012-04-13 12:01           ` Yao Qi
2012-04-13 13:23             ` Pedro Alves
2012-04-14  3:40 ` Jan Kratochvil
2012-04-14  3:52   ` Yao Qi
2012-04-15 19:42     ` [patch] Fix in-src-tree builds by gdbserver/gnulib/ copy [Re: [PATCH] Link gnulib in gdbserver.] Jan Kratochvil
2012-04-16  9:42       ` Yao Qi
2012-04-16 10:11         ` [patch#2] Fix in-src-tree builds by gdbserver/gnulib/ copy Jan Kratochvil
2012-04-16 10:51           ` Yao Qi
2012-04-16 11:32       ` [patch] Fix in-src-tree builds by gdbserver/gnulib/ copy [Re: [PATCH] Link gnulib in gdbserver.] Pedro Alves
2012-04-16 18:51         ` Fix in-src-tree builds by making gdbserver/gnulib/ a separate library (a la libiberty, etc.), and adding ACX_CONFIGURE_DIR Pedro Alves
2012-04-16 18:35           ` Jan Kratochvil
2012-04-17 16:55             ` Pedro Alves
2012-04-17 17:27               ` Jan Kratochvil
2012-04-17 18:55                 ` Pedro Alves
2012-04-17 23:52                   ` Joel Brobecker
2012-04-18  9:16                     ` Pedro Alves
2012-04-18  9:32                       ` Jan Kratochvil
2012-04-18 10:52                         ` Pedro Alves
2012-04-18 12:34                           ` Jan Kratochvil
2012-04-18 12:52                             ` Pedro Alves
2012-04-18 13:04                               ` Jan Kratochvil
2012-04-18 13:18                                 ` Pedro Alves
2012-04-18 15:52                                   ` Jan Kratochvil
2012-04-18 16:04                                     ` Pedro Alves
2012-04-18 16:09                                       ` Pedro Alves
2012-04-18 16:09                                       ` Jan Kratochvil
2012-04-18 16:16                                         ` Pedro Alves
2012-04-18 16:04                                     ` Mark Kettenis
2012-04-18 16:14                                       ` Jan Kratochvil
2012-04-18 17:05                                         ` Joel Brobecker
2012-04-18 15:04                           ` Joel Brobecker
2012-04-19 15:46                             ` gnulib/ -> gnulib/import/ Pedro Alves
2012-04-16 20:06           ` Fix in-src-tree builds by making gdbserver/gnulib/ a separate library (a la libiberty, etc.), and adding ACX_CONFIGURE_DIR Tom Tromey
2012-04-16 20:36             ` Doug Evans
2012-04-16 20:41               ` Pedro Alves
2012-04-16 22:57                 ` Joel Brobecker
2012-04-16 23:19                   ` Stan Shebs
2012-04-17 12:16                     ` Tom Tromey
2012-04-17 15:16                       ` Joel Brobecker
2012-04-17 10:29           ` Yao Qi
2012-04-17 10:49             ` Pedro Alves

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=4F88088D.5030601@redhat.com \
    --to=palves@redhat.com \
    --cc=dje@google.com \
    --cc=gdb-patches@sourceware.org \
    --cc=yao@codesourcery.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