[klibc] [patch 2/3] kbuild: use KLIBSRC + KLIBINC consistent in kbuild files

Sam Ravnborg sam at ravnborg.org
Sat Jul 30 13:28:22 PDT 2005


Using KLIBSRC + KLIBINC all over the place allow os to centralize
to a single place where we hardcode where in the kernel tree
klibc is placed.

While visiting the files alignment was fixed in a few spots.

Signed-off-by: Sam Ravnborg <sam at ravnborg.org>
---
commit 6327408a6bf07cf284adb344e982cb91b6eed4a7
tree 11a1bfe0719c8ebc39cfb95fce0bc0f8fa2a6d18
parent 3d669f9229cb75affb2c13df3fff98f3c71dd94c
author Sam Ravnborg <sam at mars.(none)> Sat, 30 Jul 2005 22:07:11 +0200
committer Sam Ravnborg <sam at mars.(none)> Sat, 30 Jul 2005 22:07:11 +0200

 kernel/Kbuild            |    4 ++++
 kernel/Kbuild.klibc      |   11 +++++------
 klibc/socketcalls/Kbuild |   14 ++++++--------
 klibc/syscalls/Kbuild    |   30 ++++++++++++++----------------
 4 files changed, 29 insertions(+), 30 deletions(-)

diff --git a/kernel/Kbuild b/kernel/Kbuild
--- a/kernel/Kbuild
+++ b/kernel/Kbuild
@@ -2,6 +2,10 @@
 # kbuild file for usr/ - including initramfs image and klibc
 #
 
+klibc definitions - to be moved to top-level Makefile later
+export KLIBSRC := $(srctree)/$(src)/klibc
+export KLIBINC := $(srctree)/$(src)/include
+
 obj-y        := initramfs_data.o
 always       := klibc/libc.a
 hostprogs-y  := gen_init_cpio
diff --git a/kernel/Kbuild.klibc b/kernel/Kbuild.klibc
--- a/kernel/Kbuild.klibc
+++ b/kernel/Kbuild.klibc
@@ -26,7 +26,6 @@ include $(srctree)/scripts/Kbuild.includ
 
 # Defines used when compiling early userspace (klibc programs)
 # ---------------------------------------------------------------------------
-KLIBSRC         := usr/klibc
 
 # Arch specific definitions for klibc
 include $(KLIBSRC)/arch/$(ARCH)/MCONFIG
@@ -42,9 +41,9 @@ USERRANLIB      := $(USERCROSS)ranlib
 USERSTRIP       := $(USERCROSS)strip
 USERNM          := $(USERCROSS)nm
 
-USERCPPFLAGS    := -I$(srctree)/usr/include/arch/$(ARCH)                 \
-                   -I$(srctree)/usr/include/bits$(BITSIZE)               \
-                   -I$(srctree)/usr/include                              \
+USERCPPFLAGS    := -I$(KLIBINC)/arch/$(ARCH)                             \
+                   -I$(KLIBINC)/bits$(BITSIZE)                           \
+                   -I$(KLIBINC)                                          \
                    -Iinclude                                             \
                    $(if $(KBUILD_SRC),-Iinclude2 -I$(srctree)/include)   \
                    -D__KLIBC__=1 -D__KLIBC_MINOR__=0                     \
@@ -56,8 +55,8 @@ USERSTRIPFLAGS  := --strip-all -R .comme
 
 USERLIBGCC      := $(shell $(USERCC) --print-libgcc)
 USERSHAREDFLAGS := $(SHAREDFLAGS)
-USERCRT0        := $(objtree)/$(KLIBSRC)/arch/$(ARCH)/crt0.o
-USERLIBC        := $(objtree)/$(KLIBSRC)/libc.a
+USERCRT0        := $(KLIBSRC)/arch/$(ARCH)/crt0.o
+USERLIBC        := $(KLIBSRC)/libc.a
 
 #
 # This indicates the location of the final version of the shared library.
diff --git a/klibc/socketcalls/Kbuild b/klibc/socketcalls/Kbuild
--- a/klibc/socketcalls/Kbuild
+++ b/klibc/socketcalls/Kbuild
@@ -11,8 +11,6 @@ endif
 # Composite object containing all .o file
 always := socketcalls.o
 
-klibc-dir := $(srctree)/usr/klibc
-
 #####
 # Generate socket calls stubs
 # Based on input from SOCKETCALLS.def generate socket call stubs
@@ -26,15 +24,15 @@ $(obj)/socketcalls.o: $(call objectify,$
 	$(call if_changed,userld)
 	
 quiet_cmd_socketcalls = GEN     $@
-      cmd_socketcalls = $(PERL) $(klibc-dir)/socketcalls.pl        \
-			        $(klibc-dir)/SOCKETCALLS.def       \
+      cmd_socketcalls = $(PERL) $(KLIBSRC)/socketcalls.pl          \
+                                $(KLIBSRC)/SOCKETCALLS.def         \
                                 $(ARCH) $(obj) > $@ || rm -f $@
 
 # Generate socketcall stubs
-$(obj)/socketcalls.mk: $(klibc-dir)/socketcalls.pl                 \
-                       $(klibc-dir)/SOCKETCALLS.def                \
-		       $(call objectify, $(socketcall-objs:.o=.S)) \
-                       $(klibc-dir)/socketcommon.h 
+$(obj)/socketcalls.mk: $(KLIBSRC)/socketcalls.pl                   \
+                       $(KLIBSRC)/SOCKETCALLS.def                  \
+                       $(call objectify, $(socketcall-objs:.o=.S)) \
+                       $(KLIBSRC)/socketcommon.h 
 	$(call cmd,socketcalls)
 
 
diff --git a/klibc/syscalls/Kbuild b/klibc/syscalls/Kbuild
--- a/klibc/syscalls/Kbuild
+++ b/klibc/syscalls/Kbuild
@@ -11,8 +11,6 @@ endif
 # Composite object containing all .o file
 always := syscalls.o
 
-klibc-dir := $(srctree)/usr/klibc
-
 
 #####
 # Generate syscalls stubs
@@ -24,7 +22,7 @@ targets += SYSCALLS.i syscalls.nrs
 targets += $(syscall-objs)
 
 # Side effect of running syscalls.pl
-clean-files += $(objtree)/usr/include/klibc/havesyscall.h
+clean-files += $(KLIBINC)/klibc/havesyscall.h
 # All the syscall stubs
 clean-files += *.o *.S *.c
 
@@ -37,29 +35,29 @@ $(obj)/syscalls.o: $(call objectify,$(sy
 quiet_cmd_syscall.i = GEN     $@
       cmd_syscall.i = $(USERCC) $(usercflags) -D__ASSEMBLY__ \
                                 -ansi -x assembler-with-cpp -E -o $@ $<
-$(obj)/SYSCALLS.i: $(klibc-dir)/SYSCALLS.def FORCE
+$(obj)/SYSCALLS.i: $(KLIBSRC)/SYSCALLS.def FORCE
 	$(call if_changed_dep,syscall.i)
 
 # Get syscalls numbers
 quiet_cmd_syscall.nrs = GEN     $@
       cmd_syscall.nrs = $(USERCC) $(usercflags) -Wp,-dM -x c -E -o $@ $<
-$(obj)/syscalls.nrs: $(srctree)/usr/include/sys/syscall.h FORCE
+$(obj)/syscalls.nrs: $(KLIBINC)/sys/syscall.h FORCE
 	$(call if_changed_dep,syscall.nrs)
 
-# Generate usr/include/klibc/havesyscall.h + makefile fragment
+# Generate $(KLIBINC)/klibc/havesyscall.h + makefile fragment
 # Using sysstub.pl in arch dir generate all .S files
 quiet_cmd_syscalls = GEN     $@
-      cmd_syscalls = mkdir -p $(objtree)/usr/include/klibc/;                 \
-                     $(PERL) $(klibc-dir)/syscalls.pl $(obj)/SYSCALLS.i      \
-                             $(klibc-dir)/arch/$(ARCH)/sysstub.ph            \
-                             $(ARCH) $(BITSIZE) $(obj)/syscalls.nrs          \
-			     $(obj)                                          \
-                             $(objtree)/usr/include/klibc/havesyscall.h > $@ \
+      cmd_syscalls = mkdir -p $(KLIBINC)/klibc/;                           \
+                     $(PERL) $(KLIBSRC)/syscalls.pl $(obj)/SYSCALLS.i      \
+                             $(KLIBSRC)/arch/$(ARCH)/sysstub.ph            \
+                             $(ARCH) $(BITSIZE) $(obj)/syscalls.nrs        \
+                             $(obj)                                        \
+                             $(KLIBINC)/klibc/havesyscall.h > $@           \
                              || rm -f $@
 
-$(obj)/syscalls.mk: $(klibc-dir)/syscalls.pl $(obj)/SYSCALLS.i \
-                    $(klibc-dir)/arch/$(ARCH)/sysstub.ph       \
-		    $(call objectify, $(syscall-objs:.o=.S))  \
-                    $(klibc-dir)/syscommon.h $(obj)/syscalls.nrs
+$(obj)/syscalls.mk: $(KLIBSRC)/syscalls.pl $(obj)/SYSCALLS.i \
+                    $(KLIBSRC)/arch/$(ARCH)/sysstub.ph       \
+                    $(call objectify, $(syscall-objs:.o=.S))  \
+                    $(KLIBSRC)/syscommon.h $(obj)/syscalls.nrs
 	$(call cmd,syscalls)
 



More information about the klibc mailing list