All of lore.kernel.org
 help / color / mirror / Atom feed
From: Petr Baudis <pasky@suse.cz>
To: zippel@linux-m68k.org
Cc: <linux-kernel@vger.kernel.org>
Cc: sam@ravnborg.org, kbuild-devel@lists.sourceforge.net
Subject: [PATCH 2/3] [kbuild] Possibility to sanely link against off-directory .so
Date: Mon, 12 Dec 2005 01:46:04 +0100	[thread overview]
Message-ID: <20051212004603.31263.12201.stgit@machine.or.cz> (raw)
In-Reply-To: <20051212004159.31263.89669.stgit@machine.or.cz>

This patch introduces two special variables which make it actually possible
to link something against .so being built in another directory. The
variable $(<foo>-linkobjs) allows the user to specify additional objects
to link <foo> against, while not creating any dependencies of <foo> on the
objects.

I need this in order to link scripts/lxdialog/liblxdialog.so from
scripts/kconfig (I'll be able to build that lib thanks to the previous
patch and the actual change to make it a library will follow in the next
patch).

On 6 Nov 2002 Sam Ravnborg <sam@ravnborg.org> disputed this approach,
saying that such an extra complexity will bog the whole kernel build, but
this involves only the host tools build and there I think the extra penalty
is negligible. Also, .so has two users instead of a single one now, so it's
not that easy to use his suggested approach to offload the functionality to
the leaf makefiles.

Signed-off-by: Petr Baudis <pasky@suse.cz>
---

 scripts/Makefile.host |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/scripts/Makefile.host b/scripts/Makefile.host
index ff1b54d..1161f4c 100644
--- a/scripts/Makefile.host
+++ b/scripts/Makefile.host
@@ -34,7 +34,12 @@
 # liblxdialog-objs := checklist.o util.o
 # Will create a "standalone" liblxdialog.so library in the directory,
 # not linked against anything (useful when you want to link something
-# to it later).
+# to it later). To link the library from another directory, do:
+# hostprogs-y    := mconf
+# mconf-objs     := mconf.o
+# mconf-linkobjs := ../lxdialog/liblxdialog.so
+# This will prevent kbuild from trying to build ../lxdialog/liblxdialog.so
+# from scripts/kconfig nor make mconf depend on it.
 
 __hostprogs := $(sort $(hostprogs-y)$(hostprogs-m))
 
@@ -116,6 +121,7 @@ $(host-csingle): %: %.c FORCE
 quiet_cmd_host-cmulti	= HOSTLD  $@
       cmd_host-cmulti	= $(HOSTCC) $(HOSTLDFLAGS) -o $@ \
 			  $(addprefix $(obj)/,$($(@F)-objs)) \
+			  $(addprefix $(obj)/,$($(@F)-linkobjs)) \
 			  $(HOST_LOADLIBES) $(HOSTLOADLIBES_$(@F))
 $(host-cmulti): %: $(host-cobjs) $(host-cshlib) FORCE
 	$(call if_changed,host-cmulti)


  parent reply	other threads:[~2005-12-12  0:46 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-12-12  0:41 [PATCH 0/3] Link lxdialog with mconf directly Petr Baudis
2005-12-12  0:46 ` [PATCH 1/3] [kbuild] Allow building of standalone .so libraries Petr Baudis
2005-12-12  0:46 ` Petr Baudis [this message]
2005-12-12  0:46 ` [PATCH 3/3] [kconfig] Direct use of lxdialog routines by menuconfig Petr Baudis
2005-12-12  3:18   ` Kurt Wall
2005-12-12 11:20     ` Petr Baudis
2005-12-13  2:59       ` Kurt Wall
2005-12-14 22:18   ` Roman Zippel
2005-12-16 20:29     ` Sam Ravnborg
2005-12-14 22:57   ` Jesper Juhl
2005-12-12 19:14 ` [PATCH 0/3] Link lxdialog with mconf directly Sam Ravnborg
2005-12-12 20:08   ` Petr Baudis
2005-12-12 20:40     ` Sam Ravnborg
2005-12-16 21:26     ` Sam Ravnborg

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=20051212004603.31263.12201.stgit@machine.or.cz \
    --to=pasky@suse.cz \
    --cc=linux-kernel@vger.kernel.org \
    --cc=zippel@linux-m68k.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.