[klibc] kbuild: s/USER/KLIBC/g

Sam Ravnborg sam at ravnborg.org
Thu Aug 4 12:43:14 PDT 2005


In general replaced the term USER with the more specific term KLIBC.
When included in the kernel the term USER is ambigious,
especially if kbuild are expanded with specific UML support.

So introduce the common prefix 'KLIBC' as replacement for USER.

While in the process Kbuild.klibc is now more careful to pick up
definitions from arch specific MCONFIG.
This is made backward compatible since we share the arch specific
MCONFIG files with the old klibc buildsystem for now.
Also brought back EMAIN - we may need it soon for klcc.

Signed-off-by: Sam Ravnborg <sam at ravnborg.org>

---
commit 19eaf1b12e932acfc29ae3747c4935bc0800f2aa
tree 253a611c0beaab873a42254782f4b79198d6a83a
parent 157d230bc48c273232b9fab4a51fee425f91dd9c
author Sam Ravnborg <sam at mars.(none)> Thu, 04 Aug 2005 21:42:25 +0200
committer Sam Ravnborg <sam at mars.(none)> Thu, 04 Aug 2005 21:42:25 +0200

 ash/Kbuild               |    2 
 gzip/Kbuild              |    2 
 kinit/Kbuild             |    4 -
 klibc/Kbuild             |   16 ++--
 klibc/socketcalls/Kbuild |   12 +--
 klibc/syscalls/Kbuild    |   30 +++----
 scripts/Kbuild.klibc     |  208 ++++++++++++++++++++++++----------------------
 usr/Kbuild               |    6 +
 8 files changed, 143 insertions(+), 137 deletions(-)

diff --git a/ash/Kbuild b/ash/Kbuild
--- a/ash/Kbuild
+++ b/ash/Kbuild
@@ -29,7 +29,7 @@ cflags-$(CONFIG_KLIBC_SH_MAIL) += -DKLIB
 cflags-y += -DJOBS=$(if $(CONFIG_KLIBC_SH_JOBS),1,0)
     sh-$(CONFIG_KLIBC_SH_JOBS) += kill.o
 
-EXTRA_USERCFLAGS := $(cflags-y)
+EXTRA_KLIBCCFLAGS := $(cflags-y)
 
 # The shared binary
 shared-y    := sh.shared
diff --git a/gzip/Kbuild b/gzip/Kbuild
--- a/gzip/Kbuild
+++ b/gzip/Kbuild
@@ -12,7 +12,7 @@ always := gunzip zcat gzip.stripped
 # Optional ZIP support
 gzip-$(CONFIG_KLIB_ZIP)   += zip.o deflate.o trees.o bits.o
 cflags-$(CONFIG_KLIB_ZIP) += -DSUPPORT_ZIP
-EXTRA_USERCFLAGS := $(cflags-y)
+EXTRA_KLIBCCFLAGS := $(cflags-y)
 
 # Additionally linked targets
 $(obj)/gunzip $(obj)/zcat: $(obj)/gzip
diff --git a/kinit/Kbuild b/kinit/Kbuild
--- a/kinit/Kbuild
+++ b/kinit/Kbuild
@@ -11,9 +11,9 @@ kinit-y  += nfsmount/
 
 
 # kinit.c include ipconfig header file
-USERCFLAGS_kinit.o   := -I$(src)/ipconfig
+KLIBCCFLAGS_kinit.o   := -I$(src)/ipconfig
 # So do nfsroot
-USERCFLAGS_nfsroot.o := -I$(src)/ipconfig -I$(src)/nfsmount
+KLIBCCFLAGS_nfsroot.o := -I$(src)/ipconfig -I$(src)/nfsmount
 
 
 # TODO - stripped image
diff --git a/klibc/Kbuild b/klibc/Kbuild
--- a/klibc/Kbuild
+++ b/klibc/Kbuild
@@ -95,10 +95,10 @@ libc-deps = $(call objectify, $(libc-y) 
 ######
 # Build static library: libc.a
 targets += libc.a __static_init.o
-quiet_cmd_libc = USERAR  $@
+quiet_cmd_libc = KLIBCAR  $@
       cmd_libc = rm -f $@; \
-                 $(USERAR) cq $@ $(filter-out FORCE,$^); \
-                 $(USERRANLIB) $@
+                 $(KLIBCAR) cq $@ $(filter-out FORCE,$^); \
+                 $(KLIBCRANLIB) $@
 
 $(LIB): $(call objectify,__static_init.o) $(libc-deps) FORCE
 	$(call if_changed,libc)
@@ -108,8 +108,8 @@ $(LIB): $(call objectify,__static_init.o
 targets += libc.so __shared_init.o
 
 quiet_cmd_libcso = LD      $@
-      cmd_libcso = $(USERLD) $(USERLDFLAGS) $(USERSHAREDFLAGS) \
-                             -o $@ $(filter-out FORCE,$^) $(USERLIBGCC)
+      cmd_libcso = $(KLIBCLD) $(KLIBCLDFLAGS) $(KLIBCSHAREDFLAGS) \
+                             -o $@ $(filter-out FORCE,$^) $(KLIBCLIBGCC)
 
 $(SOLIB): $(CRT0) $(call objectify,__shared_init.o) $(libc-deps) FORCE
 	$(call if_changed,libcso)
@@ -122,14 +122,14 @@ hostprogs-y := sha1hash
 clean-files += klibc-???????????????????????????.so
 
 quiet_cmd_solibhash = HASH    $@
-      cmd_solibhash = $(USERNM) $< | egrep '^[0-9a-fA-F]+ [ADRTW] ' | \
+      cmd_solibhash = $(KLIBCNM) $< | egrep '^[0-9a-fA-F]+ [ADRTW] ' | \
                                         sort | $(obj)/sha1hash > $@
 $(SOLIB).hash: $(SOLIB) $(obj)/sha1hash FORCE
 	$(call if_changed,solibhash)
 
 quiet_cmd_sohash = GEN     $@
       cmd_sohash = cat $< > $@;                                           \
-                     $(USERSTRIP) $(USERSTRIPFLAGS) $@;                   \
+                     $(KLIBCSTRIP) $(KLIBCSTRIPFLAGS) $@;                   \
                      rm -f $(obj)/klibc-???????????????????????????.so;   \
                      ln -f $@ $(obj)/klibc-`cat $(SOLIB).hash`.so
 $(SOHASH): $(SOLIB) $(SOLIB).hash
@@ -141,7 +141,7 @@ $(SOHASH): $(SOLIB) $(SOLIB).hash
 targets += interp.o
 
 quiet_cmd_interp = BUILD   $@
-      cmd_interp = $(USERCC) $(usercflags) -D__ASSEMBLY__     \
+      cmd_interp = $(KLIBCCC) $(klibccflags) -D__ASSEMBLY__     \
                              -DLIBDIR=\"$(SHLIBDIR)\"         \
 			     -DSOHASH=\"`cat $(SOLIB).hash`\" \
 			     -c -o $@ $<
diff --git a/klibc/socketcalls/Kbuild b/klibc/socketcalls/Kbuild
--- a/klibc/socketcalls/Kbuild
+++ b/klibc/socketcalls/Kbuild
@@ -21,18 +21,18 @@ clean-files += *.S *.o
 
 # Create reloctable composite object file
 $(obj)/socketcalls.o: $(call objectify,$(socketcall-objs)) FORCE
-	$(call if_changed,userld)
+	$(call if_changed,klibcld)
 	
 quiet_cmd_socketcalls = GEN     $@
-      cmd_socketcalls = $(PERL) $(KLIBSRC)/socketcalls.pl          \
-                                $(KLIBSRC)/SOCKETCALLS.def         \
+      cmd_socketcalls = $(PERL) $(KLIBCSRC)/socketcalls.pl          \
+                                $(KLIBCSRC)/SOCKETCALLS.def         \
                                 $(ARCH) $(obj) > $@ || rm -f $@
 
 # Generate socketcall stubs
-$(obj)/socketcalls.mk: $(KLIBSRC)/socketcalls.pl                   \
-                       $(KLIBSRC)/SOCKETCALLS.def                  \
+$(obj)/socketcalls.mk: $(KLIBCSRC)/socketcalls.pl                   \
+                       $(KLIBCSRC)/SOCKETCALLS.def                  \
                        $(call objectify, $(socketcall-objs:.o=.S)) \
-                       $(KLIBSRC)/socketcommon.h 
+                       $(KLIBCSRC)/socketcommon.h 
 	$(call cmd,socketcalls)
 
 
diff --git a/klibc/syscalls/Kbuild b/klibc/syscalls/Kbuild
--- a/klibc/syscalls/Kbuild
+++ b/klibc/syscalls/Kbuild
@@ -22,42 +22,42 @@ targets += SYSCALLS.i syscalls.nrs
 targets += $(syscall-objs)
 
 # Side effect of running syscalls.pl
-clean-files += $(KLIBINC)/klibc/havesyscall.h
+clean-files += $(KLIBCINC)/klibc/havesyscall.h
 # All the syscall stubs
 clean-files += *.o *.S *.c
 
 # Create reloctable composite object file
 $(obj)/syscalls.o: $(call objectify,$(syscall-objs)) FORCE
-	$(call if_changed,userld)
+	$(call if_changed,klibcld)
 
 # Generate assembler file (.i)
 # We pass -ansi to keep cpp from define e.g. "i386" as well as "__i386__"
 quiet_cmd_syscall.i = GEN     $@
-      cmd_syscall.i = $(USERCC) $(usercflags) -D__ASSEMBLY__ \
+      cmd_syscall.i = $(KLIBCCC) $(klibccflags) -D__ASSEMBLY__ \
                                 -ansi -x assembler-with-cpp -E -o $@ $<
-$(obj)/SYSCALLS.i: $(KLIBSRC)/SYSCALLS.def FORCE
+$(obj)/SYSCALLS.i: $(KLIBCSRC)/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: $(KLIBINC)/sys/syscall.h FORCE
+      cmd_syscall.nrs = $(KLIBCCC) $(klibccflags) -Wp,-dM -x c -E -o $@ $<
+$(obj)/syscalls.nrs: $(KLIBCINC)/sys/syscall.h FORCE
 	$(call if_changed_dep,syscall.nrs)
 
 # 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 $(KLIBINC)/klibc/;                           \
-                     $(PERL) $(KLIBSRC)/syscalls.pl $(obj)/SYSCALLS.i      \
-                             $(KLIBSRC)/arch/$(ARCH)/sysstub.ph            \
-                             $(ARCH) $(BITSIZE) $(obj)/syscalls.nrs        \
-                             $(obj)                                        \
-                             $(KLIBINC)/klibc/havesyscall.h > $@           \
+      cmd_syscalls = mkdir -p $(KLIBCINC)/klibc/;                           \
+                     $(PERL) $(KLIBCSRC)/syscalls.pl $(obj)/SYSCALLS.i      \
+                             $(KLIBCSRC)/arch/$(ARCH)/sysstub.ph            \
+                             $(ARCH) $(KLIBCBITSIZE) $(obj)/syscalls.nrs    \
+                             $(obj)                                         \
+                             $(KLIBCINC)/klibc/havesyscall.h > $@           \
                              || rm -f $@
 
-$(obj)/syscalls.mk: $(KLIBSRC)/syscalls.pl $(obj)/SYSCALLS.i \
-                    $(KLIBSRC)/arch/$(ARCH)/sysstub.ph       \
+$(obj)/syscalls.mk: $(KLIBCSRC)/syscalls.pl $(obj)/SYSCALLS.i \
+                    $(KLIBCSRC)/arch/$(ARCH)/sysstub.ph       \
                     $(call objectify, $(syscall-objs:.o=.S))  \
-                    $(KLIBSRC)/syscommon.h $(obj)/syscalls.nrs
+                    $(KLIBCSRC)/syscommon.h $(obj)/syscalls.nrs
 	$(call cmd,syscalls)
 
diff --git a/scripts/Kbuild.klibc b/scripts/Kbuild.klibc
--- a/scripts/Kbuild.klibc
+++ b/scripts/Kbuild.klibc
@@ -14,7 +14,7 @@
 # # This will compile a file named cats.c -> the executable 'cats'
 # # The executable will be linked shared
 #
-# If the user space program consist of more files do the following:
+# If the userspace program consist of more files do the following:
 # Kbuild:
 #
 # static-y   := ipconfig
@@ -23,14 +23,14 @@
 # specified with ipconfig-y.
 #
 # To set directory wide CFLAGS use:
-# EXTRA_USERCFLAGS := -DDEBUG
+# EXTRA_KLIBCCFLAGS := -DDEBUG
 # To set directory wide AFLAGS use:
-# EXTRA_USERAFLAGS := -DDEBUG
+# EXTRA_KLIBCAFLAGS := -DDEBUG
 #
 # To set target specific CFLAGS (for .c files) use
-# USERCFLAGS-main.o := -DDEBUG=3
+# KLIBCCFLAGS-main.o := -DDEBUG=3
 # To set target specific AFLAGS (for .s files) use
-# USERAFLAGS-main.o := -DDEBUG=3
+# KLIBCAFLAGS-main.o := -DDEBUG=3
 
 src := $(obj)
 # Preset target and make sure it is a ':=' variable
@@ -45,38 +45,56 @@ include $(srctree)/scripts/Kbuild.includ
 # Defines used when compiling early userspace (klibc programs)
 # ---------------------------------------------------------------------------
 
-# Arch specific definitions for klibc
-include $(KLIBSRC)/arch/$(ARCH)/MCONFIG
-
-USERWARNFLAGS   := -W -Wall -Wno-sign-compare
+KLIBCREQFLAGS     :=
+KLIBCARCHREQFLAGS :=
+KLIBCOPTFLAGS     :=
+KLIBCWARNFLAGS    := -W -Wall -Wno-sign-compare
+KLIBCSHAREDFLAGS  := 
+KLIBCBITSIZE      :=
 
-USERCROSS       := $(CROSS_COMPILE)
+# Arch specific definitions for klibc
+include $(KLIBCSRC)/arch/$(ARCH)/MCONFIG
 
-USERLD          := $(USERCROSS)ld
-USERCC          := $(USERCROSS)gcc
-USERAR          := $(USERCROSS)ar
-USERRANLIB      := $(USERCROSS)ranlib
-USERSTRIP       := $(USERCROSS)strip
-USERNM          := $(USERCROSS)nm
-
-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                     \
-		   -DBITSIZE=$(BITSIZE)
-USERCFLAGS      := $(USERCPPFLAGS) $(REQFLAGS) $(ARCHREQFLAGS)           \
-                   $(OPTFLAGS) $(USERWARNFLAGS)
-USERAFLAGS      := -D__ASSEMBLY__ $(USERCPPFLAGS)
-USERSTRIPFLAGS  := --strip-all -R .comment -R .note
-
-USERLIBGCC      := $(shell $(USERCC) --print-libgcc)
-USERSHAREDFLAGS := $(SHAREDFLAGS)
-USERCRT0        := $(KLIBOBJ)/arch/$(ARCH)/crt0.o
-USERLIBC        := $(KLIBOBJ)/libc.a
-USERCRTSHARED   := $(KLIBOBJ)/interp.o
-USERLIBCSHARED  := $(KLIBOBJ)/libc.so
+# FIXME - backwards compatibility. Remove when all MCONFIGs are corrected
+KLIBCREQFLAGS     += $(REQFLAGS)
+KLIBCARCHREQFLAGS += $(REQFLAGS)
+KLIBCOPTFLAGS     += $(OPTFLAGS)
+KLIBCWARNFLAGS    += $(WARNFLAGS) -W -Wall -Wno-sign-compare
+KLIBCSHAREDFLAGS  += $(SHAREDFLAGS)
+KLIBCBITSIZE      := $(strip $(KLIBCBITSIZE) $(BITSIZE))
+
+KLIBCROSS        := $(CROSS_COMPILE)
+
+KLIBCLD          := $(KLIBCROSS)ld
+KLIBCCC          := $(KLIBCROSS)gcc
+KLIBCAR          := $(KLIBCROSS)ar
+KLIBCRANLIB      := $(KLIBCROSS)ranlib
+KLIBCSTRIP       := $(KLIBCROSS)strip
+KLIBCNM          := $(KLIBCROSS)nm
+
+
+# klibc include paths
+KLIBCCPPFLAGS    := -I$(KLIBCINC)/arch/$(ARCH)         \
+                    -I$(KLIBCINC)/bits$(KLIBCBITSIZE)  \
+                    -I$(KLIBCINC)
+# kernel include paths
+KLIBCCPPFLAGS    += -I$(KLIBCKERNELSRC)include                              \
+                     $(if $(KBUILD_SRC),-I$include2 -I$(srctree)/include)
+# klibc definitions
+KLIBCCPPFLAGS    += -D__KLIBC__=1 -D__KLIBC_MINOR__=0                       \
+		    -DBITSIZE=$(KLIBCBITSIZE)
+KLIBCCFLAGS      := $(KLIBCCPPFLAGS) $(KLIBCREQFLAGS) $(KLIBCARCHREQFLAGS)  \
+                    $(KLIBCOPTFLAGS) $(KLIBCWARNFLAGS)
+KLIBCAFLAGS      := -D__ASSEMBLY__ $(KLIBCCPPFLAGS)
+KLIBCSTRIPFLAGS  := --strip-all -R .comment -R .note
+
+KLIBCLIBGCC      := $(shell $(KLIBCCC) --print-libgcc)
+KLIBCCRT0        := $(KLIBCOBJ)/arch/$(ARCH)/crt0.o
+KLIBCLIBC        := $(KLIBCOBJ)/libc.a
+KLIBCCRTSHARED   := $(KLIBCOBJ)/interp.o
+KLIBCLIBCSHARED  := $(KLIBCOBJ)/libc.so
+# How to tell the linker main() is the entrypoint
+KLIBCEMAIN	?= -e main
 
 #
 # This indicates the location of the final version of the shared library.
@@ -85,9 +103,9 @@ USERLIBCSHARED  := $(KLIBOBJ)/libc.so
 #
 SHLIBDIR = /lib
 
-export USERLD USERCC USERAR USERSTRIP USERNM
-export USERCFLAGS USERAFLAGS USERLIBGCC USERSHAREDFLAGS USERSTRIPFLAGS
-export USERCRT0 USERLIBC SHLIBDIR
+export KLIBCLD KLIBCCC KLIBCAR KLIBCSTRIP KLIBCNM
+export KLIBCCFLAGS KLIBCAFLAGS KLIBCLIBGCC KLIBCSHAREDFLAGS KLIBCSTRIPFLAGS
+export KLIBCCRT0 KLIBCLIBC SHLIBDIR
 
 # kernel configuration
 include .config
@@ -100,25 +118,25 @@ include $(obj)/Kbuild
 
 #####
 # static-y + shared-y handling
-user-progs := $(static-y) $(shared-y)
-# user-progs based on a single .o file (with same name + .o)
-user-objs := $(foreach p, $(user-progs), $(if $($(p)-y),,$(p)))
-user-objs := $(addsuffix .o, $(user-objs))
-# user-progs which is based on several .o files
-user-multi := $(foreach p, $(user-progs), $(if $($(p)-y),$(p)))
-# objects used for user-progs with more then one .o file
-user-objs += $(foreach p, $(user-multi), $($(p)-y))
+klibc-progs := $(static-y) $(shared-y)
+# klibc-progs based on a single .o file (with same name + .o)
+klibc-objs := $(foreach p, $(klibc-progs), $(if $($(p)-y),,$(p)))
+klibc-objs := $(addsuffix .o, $(klibc-objs))
+# klibc-progs which is based on several .o files
+klibc-multi := $(foreach p, $(klibc-progs), $(if $($(p)-y),$(p)))
+# objects used for klibc-progs with more then one .o file
+klibc-objs += $(foreach p, $(klibc-multi), $($(p)-y))
 # objects build in this dir
-user-real-objs := $(patsubst %/,,$(user-objs))
-# Directories we need to visit before user-objs are up-to-date
-user-dirs :=  $(patsubst %/,%,$(filter %/, $(user-objs))) 
+klibc-real-objs := $(patsubst %/,,$(klibc-objs))
+# Directories we need to visit before klibc-objs are up-to-date
+klibc-dirs :=  $(patsubst %/,%,$(filter %/, $(klibc-objs))) 
 # replace all dir/ with dir/lib.a
-user-objs := $(patsubst %/, %/lib.a, $(user-objs))
+klibc-objs := $(patsubst %/, %/lib.a, $(klibc-objs))
 
 targets += $(static-y) $(shared-y)
 
 # $(output-dirs) are a list of directories that contain object files
-output-dirs := $(dir $(user-dirs))
+output-dirs := $(dir $(klibc-dirs))
 output-dirs += $(foreach f, $(hostprogs-y) $(targets), \
                $(if $(dir $(f)), $(dir $(f))))
 output-dirs := $(strip $(sort $(filter-out ./,$(output-dirs))))
@@ -126,21 +144,21 @@ output-dirs := $(strip $(sort $(filter-o
 # prefix so we get full dir
 static-y        := $(addprefix $(obj)/,$(static-y))
 shared-y        := $(addprefix $(obj)/,$(shared-y))
-user-objs       := $(addprefix $(obj)/,$(user-objs))
-user-real-objs  := $(addprefix $(obj)/,$(user-real-objs))
+klibc-objs      := $(addprefix $(obj)/,$(klibc-objs))
+klibc-real-objs := $(addprefix $(obj)/,$(klibc-real-objs))
 output-dirs     := $(addprefix $(obj)/,$(output-dirs))
-user-dirs       := $(addprefix $(obj)/,$(user-dirs))
+klibc-dirs      := $(addprefix $(obj)/,$(klibc-dirs))
 subdir-y        := $(addprefix $(obj)/,$(subdir-y))
 lib-y           := $(addprefix $(obj)/,$(lib-y))
 always          := $(addprefix $(obj)/,$(always))
 targets         := $(addprefix $(obj)/,$(targets))
 
 
-_usercflags    = $(USERCFLAGS) $(EXTRA_USERCFLAGS) $(USERCFLAGS_$(*F).o)
-_useraflags    = $(USERAFLAGS) $(EXTRA_USERAFLAGS) $(USERAFLAGS_$(*F).o)
+_klibccflags    = $(KLIBCCFLAGS) $(EXTRA_KLIBCCFLAGS) $(KLIBCCFLAGS_$(*F).o)
+_klibcaflags    = $(KLIBCAFLAGS) $(EXTRA_KLIBCAFLAGS) $(KLIBCAFLAGS_$(*F).o)
 
-usercflags     = -Wp,-MD,$(depfile) $(NOSTDINC_FLAGS) $(_usercflags)
-useraflags     = -Wp,-MD,$(depfile) $(NOSTDINC_FLAGS) $(_useraflags)
+klibccflags     = -Wp,-MD,$(depfile) $(NOSTDINC_FLAGS) $(_klibccflags)
+klibcaflags     = -Wp,-MD,$(depfile) $(NOSTDINC_FLAGS) $(_klibcaflags)
 
 # Create output directory if not already present
 _dummy := $(shell [ -d $(obj) ] || mkdir -p $(obj))
@@ -160,20 +178,14 @@ __build: $(subdir-y) $(lib-target) $(alw
 # Compile C sources (.c)
 # ---------------------------------------------------------------------------
 
-quiet_cmd_cc_s_c = USERCC  $@
-      cmd_cc_s_c = $(USERCC) $(usercflags) -S -o $@ $< 
+quiet_cmd_cc_s_c = KLIBCCC $@
+      cmd_cc_s_c = $(KLIBCCC) $(klibccflags) -S -o $@ $< 
 
 %.s: %.c FORCE
 	$(call if_changed_dep,cc_s_c)
 
-quiet_cmd_cc_i_c = USERCPP $@
-      cmd_cc_i_c = $(USERCPP) $(usercflags)   -o $@ $<
-
-%.i: %.c FORCE
-	$(call if_changed_dep,cc_i_c)
-
-quiet_cmd_cc_o_c = USERCC  $@
-      cmd_cc_o_c = $(USERCC) $(usercflags) -c -o $@ $<
+quiet_cmd_cc_o_c = KLIBCCC $@
+      cmd_cc_o_c = $(KLIBCCC) $(klibccflags) -c -o $@ $<
 
 %.o: %.c FORCE
 	$(call if_changed_dep,cc_o_c)
@@ -181,14 +193,8 @@ quiet_cmd_cc_o_c = USERCC  $@
 # Compile assembler sources (.S)
 # ---------------------------------------------------------------------------
 
-quiet_cmd_as_s_S = USERCPP $@
-      cmd_as_s_S = $(USERCPP) $(useraflags)   -o $@ $< 
-
-%.s: %.S FORCE
-	$(call if_changed_dep,as_s_S)
-
-quiet_cmd_as_o_S = USERAS  $@
-      cmd_as_o_S = $(USERCC) $(useraflags) -c -o $@ $<
+quiet_cmd_as_o_S = KLIBCAS $@
+      cmd_as_o_S = $(KLIBCCC) $(klibcaflags) -c -o $@ $<
 
 %.o: %.S FORCE
 	$(call if_changed_dep,as_o_S)
@@ -202,8 +208,8 @@ ifdef lib-target
 quiet_cmd_link_o_target = LD      $@
 # If the list of objects to link is empty, just create an empty lib.a
 cmd_link_o_target = $(if $(strip $(lib-y)),\
-                    rm -f $@; $(USERAR) cru $@ $(filter $(lib-y), $^),\
-                    rm -f $@; $(USERAR) crs $@)
+                    rm -f $@; $(KLIBCAR) cru $@ $(filter $(lib-y), $^),\
+                    rm -f $@; $(KLIBCAR) crs $@)
 
 $(lib-target): $(lib-y) FORCE
 	$(call if_changed,link_o_target)
@@ -211,14 +217,14 @@ targets += $(lib-target) $(lib-y)
 endif # lib-target
 
 
-ifdef user-progs
-# Compile userspace programs for the target
+ifdef klibc-progs
+# Compile klibcspace programs for the target
 # ===========================================================================
 
-__build : $(user-dirs) $(static-y) $(shared-y)
+__build : $(klibc-dirs) $(static-y) $(shared-y)
 
 # Descend if needed
-$(sort $(addsuffix /lib.a,$(user-dirs))): $(user-dirs) ;
+$(sort $(addsuffix /lib.a,$(klibc-dirs))): $(klibc-dirs) ;
 
 # Define dependencies for link of progs
 # For the simple program:
@@ -232,27 +238,27 @@ stripobj  = $(subst $(obj)/,,$@)
 addliba   = $(addprefix $(obj)/, $(patsubst %/, %/lib.a, $(1)))
 link-deps = $(if $($(stripobj)-y), $(call addliba, $($(stripobj)-y)), $@.o) 
 
-quiet_cmd_ld-static = USERLD  $@
-      cmd_ld-static = $(USERLD) $(USERLDFLAGS) -o $@      \
-                       $(EXTRA_USERLDFLAGS)               \
-                       $(USERCRT0)                        \
+quiet_cmd_ld-static = KLIBCLD $@
+      cmd_ld-static = $(KLIBCLD) $(KLIBCLDFLAGS) -o $@    \
+                       $(EXTRA_KLIBCLDFLAGS)              \
+                       $(KLIBCCRT0)                       \
                        $(link-deps)                       \
-                       $(USERLIBC) $(USERLIBGCC)
+                       $(KLIBCLIBC) $(KLIBCLIBGCC)
 
-$(static-y): $(user-objs) $(lib-target) FORCE
+$(static-y): $(klibc-objs) $(lib-target) FORCE
 	$(call if_changed,ld-static)
 
-quiet_cmd_ld-shared = USERLD  $@
-      cmd_ld-shared = $(USERLD) $(USERLDFLAGS) -o $@      \
-                       $(EXTRA_USERLDFLAGS)               \
-                       -e main $(USERCRTSHARED)           \
+quiet_cmd_ld-shared = KLIBCLD $@
+      cmd_ld-shared = $(KLIBCLD) $(KLIBCLDFLAGS) -o $@    \
+                       $(EXTRA_KLIBCLDFLAGS)              \
+                       $(KLIBCEMAIN) $(KLIBCCRTSHARED)    \
                        $(link-deps)                       \
-                       $(USERLIBCSHARED) $(USERLIBGCC)
+                       $(KLIBCLIBCSHARED) $(KLIBCLIBGCC)
 		       
-$(shared-y): $(user-objs) $(lib-target) FORCE
+$(shared-y): $(klibc-objs) $(lib-target) FORCE
 	$(call if_changed,ld-shared)
 	
-targets += $(user-real-objs)
+targets += $(klibc-real-objs)
 endif
 
 # Compile programs on the host
@@ -264,8 +270,8 @@ endif
 # Descending
 # ---------------------------------------------------------------------------
 
-.PHONY: $(subdir-y) $(user-dirs)
-$(subdir-y) $(user-dirs):
+.PHONY: $(subdir-y) $(klibc-dirs)
+$(subdir-y) $(klibc-dirs):
 	$(Q)$(MAKE) $(klibc)=$@
 
 # Add FORCE to the prequisites of a target to force it to be always rebuilt.
@@ -278,9 +284,9 @@ FORCE:
 # Linking
 # Create a reloctable composite object file
 # ---------------------------------------------------------------------------
-quiet_cmd_userld = USERLD  $@
-      cmd_userld = $(USERLD) -r $(USERLDFLAGS) \
-                                $(EXTRA_USERLDFLAGS) $(USERLDFLAGS_$(@F)) \
+quiet_cmd_klibcld = KLIBCLD $@
+      cmd_klibcld = $(KLIBCLD) -r $(KLIBCLDFLAGS) \
+                                $(EXTRA_KLIBCLDFLAGS) $(KLIBCLDFLAGS_$(@F)) \
                                 $(filter-out FORCE,$^) -o $@
 
 
@@ -291,7 +297,7 @@ quiet_cmd_ln = LN      $@
 
 # Strip target (remove all debugging info)
 quiet_cmd_strip = STRIP   $@
-      cmd_strip = $(USERSTRIP) $(USERSTRIPFLAGS) $< -o $@
+      cmd_strip = $(KLIBCSTRIP) $(KLIBCSTRIPFLAGS) $< -o $@
  
 
 # Read all saved command lines and dependencies for the $(targets) we
diff --git a/usr/Kbuild b/usr/Kbuild
--- a/usr/Kbuild
+++ b/usr/Kbuild
@@ -3,9 +3,9 @@
 #
 
 # klibc definitions - to be moved to top-level Makefile later
-export KLIBSRC := $(srctree)/$(src)/klibc
-export KLIBINC := $(srctree)/$(src)/include
-export KLIBOBJ := $(objtree)/$(obj)/klibc
+export KLIBCSRC := $(srctree)/$(src)/klibc
+export KLIBCINC := $(srctree)/$(src)/include
+export KLIBCOBJ := $(objtree)/$(obj)/klibc
 CONFIG_KLIBC := 1
 
 # Klibc binaries



More information about the klibc mailing list