[PATCH 1/3] [kbuild] Allow building of standalone .so libraries

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This patch allows specifying .so libraries directly in 'hostprogs-y'.
I need to create a .so library not linked to anything in the
scripts/lxdialog/ directory.

Signed-off-by: Petr Baudis <[email protected]>
---

 scripts/Makefile.host |   14 +++++++++++---
 1 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/scripts/Makefile.host b/scripts/Makefile.host
index 2d51970..ff1b54d 100644
--- a/scripts/Makefile.host
+++ b/scripts/Makefile.host
@@ -29,6 +29,12 @@
 # conf.c is compiled as a c program, and conf.o is linked together with
 # libkconfig.so as the executable conf.
 # Note: Shared libraries consisting of C++ files are not supported
+#
+# hostprogs-y := liblxdialog.so
+# 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).
 
 __hostprogs := $(sort $(hostprogs-y)$(hostprogs-m))
 
@@ -39,7 +45,7 @@ obj-dirs := $(strip $(sort $(filter-out 
 
 # C code
 # Executables compiled from a single .c file
-host-csingle	:= $(foreach m,$(__hostprogs),$(if $($(m)-objs),,$(m)))
+host-csingle	:= $(foreach m,$(__hostprogs),$(if $($(m:.so=)-objs),,$(m)))
 
 # C executables linked based on several .o files
 host-cmulti	:= $(foreach m,$(__hostprogs),\
@@ -57,8 +63,10 @@ host-cxxmulti	:= $(foreach m,$(__hostpro
 host-cxxobjs	:= $(sort $(foreach m,$(host-cxxmulti),$($(m)-cxxobjs)))
 
 # Shared libaries (only .c supported)
-# Shared libraries (.so) - all .so files referenced in "xxx-objs"
-host-cshlib	:= $(sort $(filter %.so, $(host-cobjs)))
+# Shared libraries (.so) - all .so files referenced in "xxx-objs", and
+# also standalone .so's referenced in hostprogs.
+host-cshlib	:= $(sort $(filter %.so, $(host-cobjs))) \
+		   $(sort $(filter %.so, $(__hostprogs)))
 # Remove .so files from "xxx-objs"
 host-cobjs	:= $(filter-out %.so,$(host-cobjs))
 

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux