klibc-bot for Ben Hutchings
2019-Jan-20 00:24 UTC
[klibc] [klibc:master] Build and install kinit and sh without ".shared" suffix
Commit-ID: 9ded753aff9439cddd84b0cc469312b6c11823ab Gitweb: http://git.kernel.org/?p=libs/klibc/klibc.git;a=commit;h=9ded753aff9439cddd84b0cc469312b6c11823ab Author: Ben Hutchings <ben at decadent.org.uk> AuthorDate: Sat, 19 Jan 2019 23:02:32 +0000 Committer: Ben Hutchings <ben at decadent.org.uk> CommitDate: Sat, 19 Jan 2019 23:06:42 +0000 [klibc] Build and install kinit and sh without ".shared" suffix Most binaries are installed with the same name regardless of whether they use a static or shared library. The two exceptions to this are kinit and sh, which are installed with the suffix ".shared" if they use a shared library. Build these binaries in subdirectories, so that the static and shared versions have the same (unsuffixed) name. Signed-off-by: Ben Hutchings <ben at decadent.org.uk> --- usr/dash/Kbuild | 19 +++++++++++-------- usr/kinit/Kbuild | 33 ++++++++++++++++++--------------- 2 files changed, 29 insertions(+), 23 deletions(-) diff --git a/usr/dash/Kbuild b/usr/dash/Kbuild index 8682c0d..c0f8dcb 100644 --- a/usr/dash/Kbuild +++ b/usr/dash/Kbuild @@ -18,22 +18,22 @@ init-o-files := alias.o arith_yacc.o arith_yylex.o cd.o error.o eval.o exec.o ex gen-o-files := builtins.o init.o nodes.o syntax.o -sh-y := $(init-o-files) $(gen-o-files) +static/sh-y := $(init-o-files) $(gen-o-files) hostprogs-y := mkinit mksyntax mknodes mksignames gen-h-files := builtins.h nodes.h syntax.h token.h -static-y := sh +static-y := static/sh # The shared binary -shared-y := sh.shared -sh.shared-y := $(sh-y) +shared-y := shared/sh +shared/sh-y := $(static/sh-y) # For cleaning -targets := sh sh.g sh.shared sh.shared.g $(gen-o-files) +targets := static/sh static/sh.g shared/sh shared/sh.g $(gen-o-files) # explicit dependency for all generated files -$(addprefix $(obj)/, $(sh-y)): $(addprefix $(obj)/, $(gen-h-files)) +$(addprefix $(obj)/, $(static/sh-y)): $(addprefix $(obj)/, $(gen-h-files)) # Generate token.h targets += token.h @@ -92,9 +92,12 @@ $(obj)/syntax.c: $(obj)/mksyntax $(obj)/syntax.h: $(obj)/syntax.c $(Q): +# Clean deletes the static and shared dir +clean-dirs := static shared + # Targets to install ifdef KLIBCSHAREDFLAGS -install-y := sh.shared +install-y := shared/sh else -install-y := sh +install-y := static/sh endif diff --git a/usr/kinit/Kbuild b/usr/kinit/Kbuild index 84a636a..6cd5ba6 100644 --- a/usr/kinit/Kbuild +++ b/usr/kinit/Kbuild @@ -5,21 +5,21 @@ # library part of kinit. Is used by programs in sub-directories (resume et al) lib-y := name_to_dev.o devname.o getarg.o capabilities.o # use lib for kinit -kinit-y := lib.a +static/kinit-y := lib.a -kinit-y += kinit.o do_mounts.o ramdisk_load.o initrd.o -kinit-y += getintfile.o readfile.o xpio.o -kinit-y += do_mounts_md.o do_mounts_mtd.o nfsroot.o +static/kinit-y += kinit.o do_mounts.o ramdisk_load.o initrd.o +static/kinit-y += getintfile.o readfile.o xpio.o +static/kinit-y += do_mounts_md.o do_mounts_mtd.o nfsroot.o -kinit-y += ipconfig/ -kinit-y += nfsmount/ -kinit-y += run-init/ -kinit-y += fstype/ -kinit-y += resume/ +static/kinit-y += ipconfig/ +static/kinit-y += nfsmount/ +static/kinit-y += run-init/ +static/kinit-y += fstype/ +static/kinit-y += resume/ -static-y := kinit -shared-y := kinit.shared -kinit.shared-y := $(kinit-y) +static-y := static/kinit +shared-y := shared/kinit +shared/kinit-y := $(static/kinit-y) # Additional include paths files KLIBCCFLAGS += -I$(srctree)/$(src)/fstype \ @@ -29,12 +29,15 @@ KLIBCCFLAGS += -I$(srctree)/$(src)/fstype \ -I$(srctree)/$(src)/run-init # Cleaning -targets += kinit kinit.g kinit.shared kinit.shared.g +targets += static/kinit static/kinit.g shared/kinit shared/kinit.g subdir- := fstype ipconfig nfsmount resume run-init +# Clean deletes the static and shared dir +clean-dirs := static shared # install binary -install-y := kinit ifdef KLIBCSHAREDFLAGS -install-y += kinit.shared +install-y := shared/kinit +else +install-y := static/kinit endif