mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "H. Peter Anvin" <hpa@zytor.com>
To: linux-kernel@vger.kernel.org, klibc@zytor.com
Cc: "H. Peter Anvin" <hpa@zytor.com>
Subject: [klibc 02/31] Main Makefile changes for klibc
Date: Tue, 27 Jun 2006 22:17:02 -0700	[thread overview]
Message-ID: <klibc.200606272217.02@tazenda.hos.anvin.org> (raw)
In-Reply-To: <klibc.200606272217.00@tazenda.hos.anvin.org>

klibc requires that the main Makefile exports RANLIB, KLIBCARCH and
KLIBCARCHDIR.  KLIBCARCH and KLIBCARCHDIR are usually the same as
ARCH, but there are a few exceptions:

powerpc: KLIBCARCH is ppc or ppc64, KLIBCARCHDIR is powerpc
s390:	 KLIBCARCH is s390 or s390x, KLIBCARCHDIR is s390
um:      KLIBCARCH is the underlying architecture,
         KLIBCARCHDIR is set by that architecture.

s390 support by Heiko Carstens <heiko.carstens@de.ibm.com>.

Additionally, add support for building single files that have to be
built with klibc rules.  Support by Sam Ravnborg <sam@ravnborg.org>.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>

---
commit 6af9454fcd8dc22f657feff4f31923e3aa73c475
tree abf579fa4cca8e409474e9cd2a65201f8691bbb1
parent 9371ae0abc260d3f87f243b364e86d837a3a23fd
author H. Peter Anvin <hpa@zytor.com> Tue, 27 Jun 2006 20:50:21 -0700
committer H. Peter Anvin <hpa@zytor.com> Tue, 27 Jun 2006 20:50:21 -0700

 Makefile              |   32 +++++++++++++++++++++++---------
 arch/powerpc/Makefile |    1 +
 arch/s390/Makefile    |    4 ++++
 arch/um/Makefile      |    2 ++
 4 files changed, 30 insertions(+), 9 deletions(-)

diff --git a/Makefile b/Makefile
index e9560c6..6a4c559 100644
--- a/Makefile
+++ b/Makefile
@@ -176,7 +176,16 @@ ARCH		?= $(SUBARCH)
 CROSS_COMPILE	?=
 
 # Architecture as present in compile.h
-UTS_MACHINE := $(ARCH)
+UTS_MACHINE	:= $(ARCH)
+
+# Architecture used to compile user-space code
+KLIBCARCH	?= $(ARCH)
+KLIBCARCHDIR	?= $(KLIBCARCH)
+
+# klibc definitions
+export KLIBCINC := usr/include
+export KLIBCSRC := $(srctree)/usr/klibc
+export KLIBCOBJ := $(objtree)/usr/klibc
 
 KCONFIG_CONFIG	?= .config
 
@@ -278,6 +287,7 @@ LD		= $(CROSS_COMPILE)ld
 CC		= $(CROSS_COMPILE)gcc
 CPP		= $(CC) -E
 AR		= $(CROSS_COMPILE)ar
+RANLIB		= $(CROSS_COMPILE)ranlib
 NM		= $(CROSS_COMPILE)nm
 STRIP		= $(CROSS_COMPILE)strip
 OBJCOPY		= $(CROSS_COMPILE)objcopy
@@ -318,6 +328,7 @@ export VERSION PATCHLEVEL SUBLEVEL KERNE
 export ARCH CONFIG_SHELL HOSTCC HOSTCFLAGS CROSS_COMPILE AS LD CC
 export CPP AR NM STRIP OBJCOPY OBJDUMP MAKE AWK GENKSYMS PERL UTS_MACHINE
 export HOSTCXX HOSTCXXFLAGS LDFLAGS_MODULE CHECK CHECKFLAGS
+export RANLIB KLIBCARCH KLIBCARCHDIR
 
 export CPPFLAGS NOSTDINC_FLAGS LINUXINCLUDE OBJCOPYFLAGS LDFLAGS
 export CFLAGS CFLAGS_KERNEL CFLAGS_MODULE
@@ -1303,41 +1314,44 @@ # Single targets are compatible with:
 # - build whith mixed source and output
 # - build with separate output dir 'make O=...'
 # - external modules
+# - klibc library and klibc programs (everything under usr/)
 #
 #  target-dir => where to store outputfile
 #  build-dir  => directory in kernel source tree to use
 
 ifeq ($(KBUILD_EXTMOD),)
+        singlebld  = $(if $(filter usr/%,$(dir $@)),$(klibc),$(build))
         build-dir  = $(patsubst %/,%,$(dir $@))
         target-dir = $(dir $@)
 else
+        singlebld  = $(build)
         zap-slash=$(filter-out .,$(patsubst %/,%,$(dir $@)))
         build-dir  = $(KBUILD_EXTMOD)$(if $(zap-slash),/$(zap-slash))
         target-dir = $(if $(KBUILD_EXTMOD),$(dir $<),$(dir $@))
 endif
 
 %.s: %.c prepare scripts FORCE
-	$(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@)
+	$(Q)$(MAKE) $(singlebld)=$(build-dir) $(target-dir)$(notdir $@)
 %.i: %.c prepare scripts FORCE
-	$(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@)
+	$(Q)$(MAKE) $(singlebld)=$(build-dir) $(target-dir)$(notdir $@)
 %.o: %.c prepare scripts FORCE
-	$(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@)
+	$(Q)$(MAKE) $(singlebld)=$(build-dir) $(target-dir)$(notdir $@)
 %.lst: %.c prepare scripts FORCE
-	$(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@)
+	$(Q)$(MAKE) $(singlebld)=$(build-dir) $(target-dir)$(notdir $@)
 %.s: %.S prepare scripts FORCE
-	$(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@)
+	$(Q)$(MAKE) $(singlebld)=$(build-dir) $(target-dir)$(notdir $@)
 %.o: %.S prepare scripts FORCE
-	$(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@)
+	$(Q)$(MAKE) $(singlebld)=$(build-dir) $(target-dir)$(notdir $@)
 %.symtypes: %.c prepare scripts FORCE
 	$(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@)
 
 # Modules
 / %/: prepare scripts FORCE
 	$(Q)$(MAKE) KBUILD_MODULES=$(if $(CONFIG_MODULES),1) \
-	$(build)=$(build-dir)
+	$(singlebld)=$(build-dir)
 %.ko: prepare scripts FORCE
 	$(Q)$(MAKE) KBUILD_MODULES=$(if $(CONFIG_MODULES),1)   \
-	$(build)=$(build-dir) $(@:.ko=.o)
+	$(singlebld)=$(build-dir) $(@:.ko=.o)
 	$(Q)$(MAKE) -rR -f $(srctree)/scripts/Makefile.modpost
 
 # FIXME Should go into a make.lib or something 
diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile
index 01667d1..db9e79c 100644
--- a/arch/powerpc/Makefile
+++ b/arch/powerpc/Makefile
@@ -51,6 +51,7 @@ SZ	:= 32
 endif
 
 UTS_MACHINE := $(OLDARCH)
+KLIBCARCH   := $(OLDARCH)
 
 ifeq ($(HAS_BIARCH),y)
 override AS	+= -a$(SZ)
diff --git a/arch/s390/Makefile b/arch/s390/Makefile
index b3791fb..30832b3 100644
--- a/arch/s390/Makefile
+++ b/arch/s390/Makefile
@@ -20,6 +20,7 @@ AFLAGS		+= -m31
 UTS_MACHINE	:= s390
 STACK_SIZE	:= 8192
 CHECKFLAGS	+= -D__s390__
+KLIBCARCH	:= s390
 else
 LDFLAGS		:= -m elf64_s390
 MODFLAGS	+= -fpic -D__PIC__
@@ -28,8 +29,11 @@ AFLAGS		+= -m64
 UTS_MACHINE	:= s390x
 STACK_SIZE	:= 16384
 CHECKFLAGS	+= -D__s390__ -D__s390x__
+KLIBCARCH	:= s390x
 endif
 
+KLIBCARCHDIR	:= s390
+
 cflags-$(CONFIG_MARCH_G5)   += $(call cc-option,-march=g5)
 cflags-$(CONFIG_MARCH_Z900) += $(call cc-option,-march=z900)
 cflags-$(CONFIG_MARCH_Z990) += $(call cc-option,-march=z990)
diff --git a/arch/um/Makefile b/arch/um/Makefile
index f6ad832..f8e96f2 100644
--- a/arch/um/Makefile
+++ b/arch/um/Makefile
@@ -50,6 +50,8 @@ ARCH_INCLUDE	+= -I$(srctree)/$(ARCH_DIR)
 endif
 SYS_DIR		:= $(ARCH_DIR)/include/sysdep-$(SUBARCH)
 
+KLIBCARCH	:= $(SUBARCH)
+
 # -Dvmap=kernel_vmap prevents anything from referencing the libpcap.o symbol so
 # named - it's a common symbol in libpcap, so we get a binary which crashes.
 #

  parent reply	other threads:[~2006-06-28  5:18 UTC|newest]

Thread overview: 58+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-06-28  5:17 [klibc 00/31] klibc as a historyless patchset (updated and reorganized) H. Peter Anvin
2006-06-28  5:17 ` [klibc 01/31] Add klibc/kinit to MAINTAINERS file H. Peter Anvin
2006-06-28  5:17 ` H. Peter Anvin [this message]
2006-06-28  5:17 ` [klibc 03/31] Core klibc code H. Peter Anvin
2006-06-28  5:17 ` [klibc 04/31] alpha support for klibc H. Peter Anvin
2006-06-28 15:43   ` Richard Henderson
2006-06-28 15:51     ` H. Peter Anvin
2006-06-28  5:17 ` [klibc 05/31] arm " H. Peter Anvin
2006-06-28  5:17 ` [klibc 06/31] cris " H. Peter Anvin
2006-06-28  5:17 ` [klibc 07/31] i386 " H. Peter Anvin
2006-06-28  7:37   ` Jan Engelhardt
2006-06-28 15:33     ` H. Peter Anvin
2006-06-28 16:44       ` H. Peter Anvin
2006-06-29  0:14       ` Roman Zippel
2006-06-29  0:45         ` H. Peter Anvin
2006-06-29 23:43           ` Roman Zippel
2006-06-29 23:54             ` H. Peter Anvin
2006-06-30  0:23               ` Roman Zippel
2006-06-30  1:28                 ` [klibc] " Aaron Griffin
2006-06-30 13:56                   ` Jan Engelhardt
2006-06-28  5:17 ` [klibc 08/31] ia64 " H. Peter Anvin
2006-06-28  5:17 ` [klibc 09/31] m32r " H. Peter Anvin
2006-06-28  5:17 ` [klibc 10/31] m68k " H. Peter Anvin
2006-06-28  5:17 ` [klibc 11/31] mips " H. Peter Anvin
2006-06-28  5:17 ` [klibc 12/31] mips64 " H. Peter Anvin
2006-06-28  5:17 ` [klibc 13/31] parisc " H. Peter Anvin
2006-06-28  5:17 ` [klibc 14/31] ppc " H. Peter Anvin
2006-06-28  5:17 ` [klibc 15/31] ppc64 " H. Peter Anvin
2006-06-28  5:17 ` [klibc 16/31] s390 " H. Peter Anvin
2006-06-28  5:17 ` [klibc 17/31] sh " H. Peter Anvin
2006-06-28  5:17 ` [klibc 18/31] sparc " H. Peter Anvin
2006-06-28  5:17 ` [klibc 19/31] sparc64 " H. Peter Anvin
2006-06-28  5:17 ` [klibc 20/31] x86_64 " H. Peter Anvin
2006-06-28  5:17 ` [klibc 21/31] Simple test suite " H. Peter Anvin
2006-06-28  5:17 ` [klibc 22/31] zlib " H. Peter Anvin
2006-06-28  5:17 ` [klibc 23/31] kinit: replacement for in-kernel do_mount, ipconfig, nfsroot H. Peter Anvin
2006-06-28  5:17 ` [klibc 24/31] klibc basic build infrastructure H. Peter Anvin
2006-06-28  5:17 ` [klibc 25/31] Miscellaneous utilities for klibc H. Peter Anvin
2006-06-28  5:17 ` [klibc 26/31] dash - a small POSIX shell " H. Peter Anvin
2006-06-28  5:17 ` [klibc 27/31] A port of gzip to klibc H. Peter Anvin
2006-06-28  5:17 ` [klibc 28/31] sparc64: transmit arch-specific options to kinit via /arch.cmd H. Peter Anvin
2006-06-28  5:17 ` [klibc 29/31] sparc32: transfer arch-specific options to /arch.cmd H. Peter Anvin
2006-06-28  5:17 ` [klibc 30/31] Remove in-kernel resume-from-disk invocation code H. Peter Anvin
2006-07-05 23:40   ` Nigel Cunningham
2006-07-05 23:58     ` Joshua Hudson
2006-07-06  0:11     ` H. Peter Anvin
2006-07-06  0:37       ` Nigel Cunningham
2006-07-06  0:54         ` H. Peter Anvin
2006-07-06  1:45           ` Nigel Cunningham
2006-07-06  2:18             ` Nigel Cunningham
2006-07-06  3:11               ` H. Peter Anvin
2006-07-06  3:28                 ` Nigel Cunningham
2006-07-06 10:26             ` Pavel Machek
     [not found]             ` <200607061028.k66AS8UB012207@smtp.micromuse.com>
2006-07-06 10:58               ` IBM spam Re: " Pavel Machek
2006-07-06 13:02                 ` Sean Young
2006-07-06  8:31       ` [klibc] " maximilian attems
2006-07-06  8:37         ` H. Peter Anvin
2006-06-28  5:17 ` [klibc 31/31] Remove in-kernel root-mounting code H. Peter Anvin

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=klibc.200606272217.02@tazenda.hos.anvin.org \
    --to=hpa@zytor.com \
    --cc=klibc@zytor.com \
    --cc=linux-kernel@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®