Browse Source

Ok, this should finish off my massive ro-organization. The source
tree is less messy now (which helps), all libraries are placed into
uClibc/lib when compiling, all libraries now use a consistant mechanism
for being built, all libraries use a consistant naming scheme where the
lib name includes the uClibc version number, which makes ldconfig
happy and willing to work with us.
-Erik

Eric Andersen 23 years ago
parent
commit
f0da4aa1d8
53 changed files with 333 additions and 249 deletions
  1. 49 83
      Makefile
  2. 7 3
      Rules.mak
  3. 3 3
      extra/gcc-uClibc/gcc-uClibc.c
  4. 5 13
      ldso/Makefile
  5. 0 1
      ldso/Rules.mak
  6. 37 12
      ldso/ldso/Makefile
  7. 52 20
      ldso/libdl/Makefile
  8. 2 2
      ldso/util/Makefile
  9. 112 0
      libc/Makefile
  10. 1 2
      libc/inet/Makefile
  11. 1 2
      libc/inet/rpc/Makefile
  12. 1 2
      libc/misc/Makefile
  13. 1 2
      libc/misc/assert/Makefile
  14. 1 2
      libc/misc/ctype/Makefile
  15. 1 2
      libc/misc/dirent/Makefile
  16. 1 2
      libc/misc/fnmatch/Makefile
  17. 1 2
      libc/misc/glob/Makefile
  18. 1 2
      libc/misc/internals/Makefile
  19. 1 2
      libc/misc/locale/Makefile
  20. 1 2
      libc/misc/lock/Makefile
  21. 1 2
      libc/misc/lsearch/Makefile
  22. 1 2
      libc/misc/mntent/Makefile
  23. 1 2
      libc/misc/regex/Makefile
  24. 1 2
      libc/misc/syslog/Makefile
  25. 1 2
      libc/misc/sysvipc/Makefile
  26. 1 2
      libc/misc/time/Makefile
  27. 1 2
      libc/misc/tsearch/Makefile
  28. 1 2
      libc/misc/utmp/Makefile
  29. 1 2
      libc/pwd_grp/Makefile
  30. 1 2
      libc/signal/Makefile
  31. 1 2
      libc/stdio/Makefile
  32. 1 2
      libc/stdlib/Makefile
  33. 1 2
      libc/stdlib/malloc-930716/Makefile
  34. 1 2
      libc/stdlib/malloc-simple/Makefile
  35. 1 2
      libc/stdlib/malloc/Makefile
  36. 1 2
      libc/string/Makefile
  37. 1 3
      libc/sysdeps/Makefile
  38. 2 4
      libc/sysdeps/linux/Makefile
  39. 2 4
      libc/sysdeps/linux/arm/Makefile
  40. 1 2
      libc/sysdeps/linux/common/Makefile
  41. 2 3
      libc/sysdeps/linux/i386/Makefile
  42. 2 3
      libc/sysdeps/linux/m68k/Makefile
  43. 3 5
      libc/sysdeps/linux/powerpc/Makefile
  44. 2 4
      libc/sysdeps/linux/sh/Makefile
  45. 2 3
      libc/sysdeps/linux/sparc/Makefile
  46. 1 2
      libc/termios/Makefile
  47. 1 2
      libc/unistd/Makefile
  48. 4 3
      libcrypt/Makefile
  49. 5 5
      libm/Makefile
  50. 3 4
      libm/double/Makefile
  51. 3 6
      libm/float/Makefile
  52. 3 4
      libm/ldouble/Makefile
  53. 2 1
      libutil/Makefile

+ 49 - 83
Makefile

@@ -30,49 +30,23 @@
 TOPDIR=./
 include Rules.mak
 
-DIRS = extra misc pwd_grp stdio string termios inet signal stdlib sysdeps unistd libcrypt libutil libm
-
-ifeq ($(strip $(HAS_MMU)),true)
-	DO_SHARED=shared
-endif
-
-all: halfclean headers uClibc_config.h subdirs $(LIBNAME) $(DO_SHARED) done
-
-$(LIBNAME): subdirs
-	$(CROSS)ranlib $(LIBNAME)
-
-shared: $(LIBNAME)
-	@rm -rf tmp
-	@mkdir tmp
-	@$(MAKE) -C ld.so-1 ldso
-	@(cd tmp; CC=$(CC) /bin/sh ../extra/scripts/get-needed-libgcc-objects.sh)
-	if [ -s ./tmp/libgcc-need.a ] ; then \
-		$(CC) -g $(LDFLAGS) -shared -o $(SHARED_FULLNAME) \
-		    -Wl,-soname,$(SHARED_MAJORNAME) -Wl,--whole-archive \
-		    ./$(LIBNAME) ./tmp/libgcc-need.a \
-		    $(LDSO) ; \
-	else \
-		$(CC) -g $(LDFLAGS) -shared -o $(SHARED_FULLNAME) \
-		    -Wl,-soname,$(SHARED_MAJORNAME) -Wl,--whole-archive \
-		    ./$(LIBNAME) $(LDSO) ; \
-	fi
-	@rm -rf tmp
-	cp -a $(SHARED_FULLNAME) lib;
-	(cd lib; ln -sf $(SHARED_FULLNAME) $(SHARED_MAJORNAME));
+DIRS = extra ldso libc libcrypt libutil libm
+
+all: headers uClibc_config.h subdirs $(DO_SHARED) done
+
+shared:
+	@$(MAKE) -C libc shared
+	@$(MAKE) -C ldso shared
+	@$(MAKE) -C ldso/libdl shared
 	@$(MAKE) -C libcrypt shared
 	@$(MAKE) -C libutil shared
 	@$(MAKE) -C libm shared
-	@$(MAKE) -C ld.so-1
 
-done: $(LIBNAME) $(DO_SHARED)
+done: $(DO_SHARED)
 	@echo
 	@echo Finally finished compiling...
 	@echo
 
-halfclean:
-	@rm -f $(LIBNAME) crt0.o uClibc_config.h
-	@rm -f $(SHARED_FULLNAME) $(SHARED_MAJORNAME) uClibc-0.* libc.so*
-
 headers: dummy
 	@rm -f include/asm include/linux include/bits
 	@ln -s $(KERNEL_SOURCE)/include/asm include/asm
@@ -91,54 +65,8 @@ headers: dummy
 	    sleep 10; \
 	fi;
 	@ln -s $(KERNEL_SOURCE)/include/linux include/linux
-	@ln -s ../sysdeps/linux/$(TARGET_ARCH)/bits include/bits
-	@ln -sf ../../../../uClibc_config.h sysdeps/linux/$(TARGET_ARCH)/bits/uClibc_config.h
-
-
-tags:
-	ctags -R
-
-clean: subdirs_clean halfclean
-	@rm -rf tmp
-	rm -f include/asm include/linux include/bits
-	@$(MAKE) -C ld.so-1 clean
-
-subdirs: $(patsubst %, _dir_%, $(DIRS))
-subdirs_clean: $(patsubst %, _dirclean_%, $(DIRS) test)
-
-$(patsubst %, _dir_%, $(DIRS)) : dummy
-	$(MAKE) -C $(patsubst _dir_%, %, $@)
-
-$(patsubst %, _dirclean_%, $(DIRS) test) : dummy
-	$(MAKE) -C $(patsubst _dirclean_%, %, $@) clean
-
-install: install_runtime install_dev
-
-# Installs shared library
-install_runtime:
-	install -d $(INSTALL_DIR)/lib
-	cp -fa lib/* $(INSTALL_DIR)/lib;
-
-# Installs development library and headers
-# This is done with the assumption that it can blow away anything
-# in $(INSTALL_DIR)/include.  Probably true only if you're using
-# a packaging system.
-install_dev:
-	install -d $(INSTALL_DIR)/include
-	install -d $(INSTALL_DIR)/include/bits
-	rm -f $(INSTALL_DIR)/include/asm
-	rm -f $(INSTALL_DIR)/include/linux
-	ln -s $(KERNEL_SOURCE)/include/asm $(INSTALL_DIR)/include/asm
-	ln -s $(KERNEL_SOURCE)/include/linux $(INSTALL_DIR)/include/linux
-	find include/ -type f -depth -not -path "*CVS*" -exec install -D -m 644 {} $(INSTALL_DIR)/'{}' ';'
-	find include/bits/ -type f -depth -not -path "*CVS*" -exec install -D -m 644 {} $(INSTALL_DIR)/'{}' ';'
-	install -m 644 include/bits/uClibc_config.h $(INSTALL_DIR)/include/bits/
-	install -d $(INSTALL_DIR)/lib
-	rm -f $(INSTALL_DIR)/lib/$(LIBNAME)
-	install -m 644 $(LIBNAME) $(INSTALL_DIR)/lib/
-	@if [ -f crt0.o ] ; then install -m 644 crt0.o $(INSTALL_DIR)/lib/; fi
-	install -d $(INSTALL_DIR)/bin
-	$(MAKE) -C extra/gcc-uClibc install
+	@ln -s ../libc/sysdeps/linux/$(TARGET_ARCH)/bits include/bits
+	(cd include/bits; ln -sf ../../../../../uClibc_config.h uClibc_config.h)
 
 uClibc_config.h: Config
 	@echo "/* WARNING!!! AUTO-GENERATED FILE!!! DO NOT EDIT!!! */" > uClibc_config.h
@@ -199,5 +127,43 @@ uClibc_config.h: Config
 	    echo "#undef __UCLIBC_HAS_RPC__" >> uClibc_config.h ; \
 	fi
 
+subdirs: $(patsubst %, _dir_%, $(DIRS))
+
+$(patsubst %, _dir_%, $(DIRS)) : dummy
+	$(MAKE) -C $(patsubst _dir_%, %, $@)
+
+tags:
+	ctags -R
+
+install: install_runtime install_dev
+
+# Installs shared library
+install_runtime:
+	install -d $(INSTALL_DIR)/lib
+	cp -fa lib/* $(INSTALL_DIR)/lib;
+
+# Installs development library and headers
+# This is done with the assumption that it can blow away anything
+# in $(INSTALL_DIR)/include.  Probably true only if you're using
+# a packaging system.
+install_dev:
+	install -d $(INSTALL_DIR)/include
+	install -d $(INSTALL_DIR)/include/bits
+	rm -f $(INSTALL_DIR)/include/asm
+	rm -f $(INSTALL_DIR)/include/linux
+	ln -s $(KERNEL_SOURCE)/include/asm $(INSTALL_DIR)/include/asm
+	ln -s $(KERNEL_SOURCE)/include/linux $(INSTALL_DIR)/include/linux
+	find include/ -type f -depth -not -path "*CVS*" -exec install \
+	    -D -m 644 {} $(INSTALL_DIR)/'{}' ';'
+	find include/bits/ -type f -depth -not -path "*CVS*" -exec install \
+	    -D -m 644 {} $(INSTALL_DIR)/'{}' ';'
+	install -m 644 include/bits/uClibc_config.h $(INSTALL_DIR)/include/bits/
+	$(MAKE) -C extra/gcc-uClibc install
+
+clean:
+	@rm -rf tmp lib
+	rm -f include/asm include/linux include/bits uClibc_config.h
+	- find . \( -name \*.o -o -name \*.a -o -name \*.so -o -name core \) -exec rm -f {} \;
+
 .PHONY: dummy subdirs
 

+ 7 - 3
Rules.mak

@@ -31,6 +31,7 @@ LIBNAME=libc.a
 SHARED_FULLNAME=libuClibc-$(MAJOR_VERSION).$(MINOR_VERSION).so
 SHARED_MAJORNAME=libc.so.$(MAJOR_VERSION)
 UCLIBC_LDSO=ld-uclibc.so.$(MAJOR_VERSION)
+LIBC=$(TOPDIR)libc/libc.a
 
 BUILDTIME = $(shell TZ=UTC date --utc "+%Y.%m.%d-%H:%M%z")
 
@@ -63,7 +64,11 @@ endif
 
 NATIVE_ARCH = $(shell uname -m | sed -e 's/i.86/i386/' -e 's/sparc.*/sparc/' -e 's/arm.*/arm/g' -e 's/m68k.*/m68k/' -e 's/ppc/powerpc/g')
 
-LDSO_PRESENT=$(strip $(shell cd $(TOPDIR)/ld.so-1/d-link; ls -d $(TARGET_ARCH) 2>/dev/null))
+ifeq ($(strip $(HAS_MMU)),true)
+	DO_SHARED=shared
+endif
+
+LDSO_PRESENT=$(strip $(shell cd $(TOPDIR)/ldso/d-link; ls -d $(TARGET_ARCH) 2>/dev/null))
 
 ifeq ($(NATIVE_ARCH), $(TARGET_ARCH))
 	SYSTEM_LDSO=$(shell ldd `which $(CC)` | sed -ne /ld/p | sed -e s/\ =.*//g)
@@ -72,11 +77,10 @@ else
 endif
 
 ifeq ($(LDSO_PRESENT), $(TARGET_ARCH))
-	LDSO=ld.so-1/d-link/$(UCLIBC_LDSO)
+	LDSO=$(TOPDIR)lib/$(UCLIBC_LDSO)
 else
 	LDSO=$(SYSTEM_LDSO)
 endif
-	
 
 
 # It turns out the currently, function-sections causes ldelf2flt to segfault.

+ 3 - 3
extra/gcc-uClibc/gcc-uClibc.c

@@ -54,12 +54,12 @@
 
 static char *rpath_link[] = {
 	"-Wl,-rpath-link,"UCLIBC_INSTALL_DIR"lib",
-	"-Wl,-rpath-link,"UCLIBC_BUILD_DIR
+	"-Wl,-rpath-link,"UCLIBC_BUILD_DIR"lib"
 };
 
 static char *rpath[] = {
 	"-Wl,-rpath,"UCLIBC_INSTALL_DIR"lib",
-	"-Wl,-rpath,"UCLIBC_BUILD_DIR
+	"-Wl,-rpath,"UCLIBC_BUILD_DIR"lib"
 };
 
 static char *uClibc_inc[] = {
@@ -74,7 +74,7 @@ static char *crt0_path[] = {
 
 static char *lib_path[] = {
 	"-L"UCLIBC_INSTALL_DIR"lib",
-	"-L"UCLIBC_BUILD_DIR
+	"-L"UCLIBC_BUILD_DIR"lib"
 };
 
 static char static_linking[] = "-static";

+ 5 - 13
ldso/Makefile

@@ -3,22 +3,14 @@ include Rules.mak
 
 SUBDIRS = util d-link libdl # man
 
-
 all:
-	@if [ -d $(TOPDIR)ld.so-1/d-link/$(TARGET_ARCH) ] ; then \
-		set -e ; for d in $(SUBDIRS) ; do $(MAKE) -C $$d ; done \
-	fi;
-	@if [ -d $(TOPDIR)ld.so-1/d-link/$(TARGET_ARCH) ] ; then \
-		install -d $(TOPDIR)lib ; \
-		install -m 755 $(TOPDIR)ld.so-1/d-link/$(UCLIBC_LDSO) $(TOPDIR)lib/ld-linux-uclibc.so ; \
-		install -m 644 $(TOPDIR)ld.so-1/libdl/$(LIBDL).$(MAJOR_VERSION) $(TOPDIR)lib  ; \
-		(cd $(TOPDIR)lib;ln -sf ld-linux-uclibc.so $(UCLIBC_LDSO)); \
-		(cd $(TOPDIR)lib;ln -sf $(LIBDL).$(MAJOR_VERSION) $(LIBDL))  ; \
+	@if [ -d $(TOPDIR)ldso/d-link/$(TARGET_ARCH) ] ; then \
+		$(MAKE) -C d-link; \
 	fi;
 
-ldso:
-	@if [ -d $(TOPDIR)ld.so-1/d-link/$(TARGET_ARCH) ] ; then \
-		$(MAKE) -C d-link; \
+shared:
+	@if [ -d $(TOPDIR)ldso/d-link/$(TARGET_ARCH) ] ; then \
+		set -e ; for d in $(SUBDIRS) ; do $(MAKE) -C $$d ; done \
 	fi;
 
 clean:

+ 0 - 1
ldso/Rules.mak

@@ -1,7 +1,6 @@
 include $(TOPDIR)Rules.mak
 
 LDSO_VERSION=1.9.11
-LIBDL = libdl.so
 
 DEVEL=true
 

+ 37 - 12
ldso/ldso/Makefile

@@ -1,7 +1,31 @@
+# Makefile for uClibc
+#
+# Copyright (C) 2000 by Lineo, inc.
+#
+# This program is free software; you can redistribute it and/or modify it under
+# the terms of the GNU Library General Public License as published by the Free
+# Software Foundation; either version 2 of the License, or (at your option) any
+# later version.
+#
+# This program is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+# FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more
+# details.
+#
+# You should have received a copy of the GNU Library General Public License
+# along with this program; if not, write to the Free Software Foundation, Inc.,
+# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# Derived in part from the Linux-8086 C library, the GNU C Library, and several
+# other sundry sources.  Files within this library are copyright by their
+# respective copyright holders.
+
+
 TOPDIR=../../
-include $(TOPDIR)/ld.so-1/Rules.mak
+include $(TOPDIR)/ldso/Rules.mak
+
+LDSO_FULLNAME=ld-uclibc-$(MAJOR_VERSION).$(MINOR_VERSION).so
 
-CFLAGS += -DUSE_CACHE -fPIC -D__PIC__ #-DDL_DEBUG #-funroll-loops
 
 CSRC= boot1.c hash.c readelflib1.c vsprintf.c $(TARGET_ARCH)/elfinterp.c
 COBJS=$(patsubst %.c,%.o, $(CSRC))
@@ -9,24 +33,25 @@ ASRC=$(shell ls $(TARGET_ARCH)/*.S)
 AOBJS=$(patsubst %.S,%.o, $(ASRC))
 OBJS=$(AOBJS) $(COBJS)
 
-ELF_LDFLAGS=--shared # using GNU ld
 
-all: ld.so.h lib
+CFLAGS += -DUSE_CACHE -fPIC -D__PIC__ #-DDL_DEBUG #-funroll-loops
 
-ld.so.h:
-	echo "char *_dl_progname = \""$(UCLIBC_LDSO)"\";" > ld.so.h
+all: lib
 
-lib:: $(OBJS) $(DLINK_OBJS)
-	$(LD) -e _dl_boot $(ELF_LDFLAGS) -o $(UCLIBC_LDSO) \
+lib:: ld.so.h $(OBJS) $(DLINK_OBJS)
+	$(LD) -e _dl_boot --shared -o $(LDSO_FULLNAME) \
 		-soname $(UCLIBC_LDSO) $(OBJS)
+	install -d $(TOPDIR)lib ; \
+	install -m 755 $(LDSO_FULLNAME) $(TOPDIR)lib; \
+	(cd $(TOPDIR)lib;ln -sf $(LDSO_FULLNAME) $(UCLIBC_LDSO));
+
+ld.so.h:
+	echo "char *_dl_progname = \""$(UCLIBC_LDSO)"\";" > ld.so.h
 
 $(COBJS): %.o : %.c
 	$(CC) -I. -I./$(TARGET_ARCH) -I../libdl $(CFLAGS) -c $< -o $@
 	$(STRIPTOOL) -x -R .note -R .comment $*.o
 
-realclean::
-	$(RM) -f .depend $(UCLIBC_LDSO)* core *.o *.a *.s *.i tmp_make foo *~
-
 clean::
-	$(RM) -f $(UCLIBC_LDSO)* $(OBJS) core *.o *.a *.s *.i tmp_make foo *~
+	$(RM) -f $(UCLIBC_LDSO)* $(OBJS) $(LDSO_FULLNAME)* core *.o *.a *.s *.i tmp_make foo *~
 

+ 52 - 20
ldso/libdl/Makefile

@@ -1,32 +1,64 @@
+# Makefile for uClibc
+#
+# Copyright (C) 2000 by Lineo, inc.
+#
+# This program is free software; you can redistribute it and/or modify it under
+# the terms of the GNU Library General Public License as published by the Free
+# Software Foundation; either version 2 of the License, or (at your option) any
+# later version.
+#
+# This program is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+# FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more
+# details.
+#
+# You should have received a copy of the GNU Library General Public License
+# along with this program; if not, write to the Free Software Foundation, Inc.,
+# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# Derived in part from the Linux-8086 C library, the GNU C Library, and several
+# other sundry sources.  Files within this library are copyright by their
+# respective copyright holders.
+
+
 TOPDIR=../../
-include $(TOPDIR)/ld.so-1/Rules.mak
+include $(TOPDIR)/ldso/Rules.mak
 
-CFLAGS += -DUSE_CACHE
-CFLAGS += #-fPIC -D__PIC__ #-funroll-loops
+LIBDL=libdl.a
+LIBDL_SHARED=libdl.so
+LIBDL_SHARED_FULLNAME=libdl-$(MAJOR_VERSION).$(MINOR_VERSION).so
+TARGET_CC= $(TOPDIR)extra/gcc-uClibc/$(TARGET_ARCH)-uclibc-gcc
 
 CSRC= dlib.c
-COBJS=$(patsubst %.c,%.o, $(CSRC))
-OBJS=$(COBJS)
+OBJS=$(patsubst %.c,%.o, $(CSRC))
 
-all: lib
+CFLAGS += -DUSE_CACHE #-fPIC -D__PIC__ #-funroll-loops
 
-$(COBJS): %.o : %.c
-	$(CC) -I../d-link -I../d-link/$(TARGET_ARCH) $(CFLAGS) -c $< -o $@
-	$(STRIPTOOL) -x -R .note -R .comment $*.o
+all: $(OBJS) $(LIBDL)
 
-ELF_LDFLAGS=--shared -nostartfiles -nostdlib # using GNU ld
-#ELF_LDFLAGS=-G  # with SVr4 ld
+$(LIBDL): ar-target
 
-lib:: $(OBJS)
-	$(CC) $(ELF_LDFLAGS) \
-		-o $(LIBDL).$(MAJOR_VERSION) -Wl,-soname -Wl,$(LIBDL).$(MAJOR_VERSION) \
-		*.o $(TOPDIR)$(SHARED_FULLNAME)
+ar-target: $(OBJS)
+	$(AR) $(ARFLAGS) $(LIBDL) $(OBJS)
+	install -d $(TOPDIR)lib
+	rm -f $(TOPDIR)lib/$(LIBDL)
+	install -m 644 $(LIBDL) $(TOPDIR)lib
+
+$(OBJS): %.o : %.c
+	$(TARGET_CC) -I../d-link -I../d-link/$(TARGET_ARCH) $(CFLAGS) -c $< -o $@
+	$(STRIPTOOL) -x -R .note -R .comment $*.o
 
-obj: $(OBJS)
+$(OBJ): Makefile
 
-realclean::
-	$(RM) -f .depend $(LIBDL) core *.o *.a *.s *.i tmp_make foo *~
+shared: all
+	$(TARGET_CC) $(LDFLAGS) -shared -o $(LIBDL_SHARED_FULLNAME) \
+	    -Wl,-soname,$(LIBDL_SHARED).$(MAJOR_VERSION) -Wl,--whole-archive \
+	    $(LIBDL) $(TOPDIR)lib/$(SHARED_FULLNAME)
+	install -d $(TOPDIR)lib
+	rm -f $(TOPDIR)lib/$(LIBDL_SHARED_FULLNAME) $(TOPDIR)lib/$(LIBDL_SHARED).$(MAJOR_VERSION)
+	install -m 644 $(LIBDL_SHARED_FULLNAME) $(TOPDIR)lib;
+	(cd $(TOPDIR)lib; ln -sf $(LIBDL_SHARED_FULLNAME) $(LIBDL_SHARED).$(MAJOR_VERSION)); 
 
-clean::
-	$(RM) -f $(LIBDL)* core *.o *.a *.s *.i tmp_make foo *~
+clean:
+	$(RM) -f .depend $(LIBDL_SHARED)* $(LIBDL_SHARED_FULLNAME) core *.o *.a *.s *.i tmp_make foo *~
 

+ 2 - 2
ldso/util/Makefile

@@ -1,9 +1,9 @@
 TOPDIR=../../
-include $(TOPDIR)/ld.so-1/Rules.mak
+include $(TOPDIR)/ldso/Rules.mak
 
 CFLAGS += -DLDSO_ADDR="0x62f00020" # needed by ldd.o
 CFLAGS += -I./ -I../../include/
-LDFLAGS += -nostdlib ../../libc.a ../../crt0.o $(GCCINCDIR)/../libgcc.a
+LDFLAGS += -nostdlib $(TOPDIR)lib/libc.a $(TOPDIR)lib/crt0.o $(GCCINCDIR)/../libgcc.a
 
 ALL	= ldconfig ldd # lddstub
 

+ 112 - 0
libc/Makefile

@@ -0,0 +1,112 @@
+# Makefile for uClibc
+#
+# Copyright (C) 2000, 2001 by Lineo, inc.
+# Written by Erik Andersen <andersen@lineo.com>, <andersee@debian.org>
+#
+# This program is free software; you can redistribute it and/or modify it under
+# the terms of the GNU Library General Public License as published by the Free
+# Software Foundation; either version 2 of the License, or (at your option) any
+# later version.
+#
+# This program is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+# FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more
+# details.
+#
+# You should have received a copy of the GNU Library General Public License
+# along with this program; if not, write to the Free Software Foundation, Inc.,
+# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# Derived in part from the Linux-8086 C library, the GNU C Library, and several
+# other sundry sources.  Files within this library are copyright by their
+# respective copyright holders.
+
+#--------------------------------------------------------
+#
+#There are a number of configurable options in "Config"
+#
+#--------------------------------------------------------
+
+TOPDIR=../
+include $(TOPDIR)Rules.mak
+
+DIRS = misc pwd_grp stdio string termios inet signal stdlib sysdeps unistd
+
+all: halfclean subdirs $(LIBNAME) $(DO_SHARED) done
+
+$(LIBNAME): subdirs
+	$(CROSS)ranlib $(LIBNAME)
+	install -d $(TOPDIR)lib
+	rm -f $(TOPDIR)lib/$(LIBNAME)
+	install -m 644 crt0.o $(LIBNAME) $(TOPDIR)lib
+
+shared: $(TOPDIR)lib/$(LIBNAME)
+	@rm -rf tmp
+	@mkdir tmp
+	@(cd tmp; CC=$(CC) /bin/sh ../../extra/scripts/get-needed-libgcc-objects.sh)
+	if [ -s ./tmp/libgcc-need.a ] ; then \
+		$(CC) -g $(LDFLAGS) -shared -o $(SHARED_FULLNAME) \
+		    -Wl,-soname,$(SHARED_MAJORNAME) -Wl,--whole-archive \
+		    ./$(LIBNAME) ./tmp/libgcc-need.a \
+		    $(LDSO) ; \
+	else \
+		$(CC) -g $(LDFLAGS) -shared -o $(SHARED_FULLNAME) \
+		    -Wl,-soname,$(SHARED_MAJORNAME) -Wl,--whole-archive \
+		    ./$(LIBNAME) $(LDSO) ; \
+	fi
+	@rm -rf tmp
+	install -d $(TOPDIR)lib
+	rm -f $(TOPDIR)lib/$(SHARED_FULLNAME)
+	install -m 644 $(SHARED_FULLNAME) $(TOPDIR)lib
+	(cd ../lib; ln -sf $(SHARED_FULLNAME) $(SHARED_MAJORNAME));
+
+
+done: $(LIBNAME) $(DO_SHARED)
+	@echo
+	@echo Finally finished compiling...
+	@echo
+
+halfclean:
+	@rm -f $(LIBNAME) crt0.o uClibc_config.h
+	@rm -f $(SHARED_FULLNAME) $(SHARED_MAJORNAME) uClibc-0.* libc.so*
+
+headers: dummy
+	@rm -f include/asm include/linux include/bits
+	@ln -s $(KERNEL_SOURCE)/include/asm include/asm
+	@if [ ! -f include/asm/unistd.h ] ; then \
+	    echo " "; \
+	    echo "The path '$(KERNEL_SOURCE)/include/asm' doesn't exist."; \
+	    echo "I bet you didn't set KERNEL_SOURCE, TARGET_ARCH or HAS_MMU in \`Config'"; \
+	    echo "correctly.  Please edit \`Config' and fix these settings."; \
+	    echo " "; \
+	    /bin/false; \
+	fi;
+	@if [ $(HAS_MMU) != "true" ]  && [ $(TARGET_ARCH) = "i386" ] ; then \
+	    echo "WARNING: I bet your x86 system really has an MMU, right?"; \
+	    echo "         malloc and friends won't work unless you fix \`Config'"; \
+	    echo " "; \
+	    sleep 10; \
+	fi;
+	@ln -s $(KERNEL_SOURCE)/include/linux include/linux
+	@ln -s ../sysdeps/linux/$(TARGET_ARCH)/bits include/bits
+	@ln -sf ../../../../uClibc_config.h sysdeps/linux/$(TARGET_ARCH)/bits/uClibc_config.h
+
+
+tags:
+	ctags -R
+
+clean: subdirs_clean halfclean
+	@rm -rf tmp
+	rm -f include/asm include/linux include/bits
+
+subdirs: $(patsubst %, _dir_%, $(DIRS))
+subdirs_clean: $(patsubst %, _dirclean_%, $(DIRS))
+
+$(patsubst %, _dir_%, $(DIRS)) : dummy
+	$(MAKE) -C $(patsubst _dir_%, %, $@)
+
+$(patsubst %, _dirclean_%, $(DIRS)) : dummy
+	$(MAKE) -C $(patsubst _dirclean_%, %, $@) clean
+
+.PHONY: dummy subdirs
+

+ 1 - 2
libc/inet/Makefile

@@ -20,9 +20,8 @@
 # other sundry sources.  Files within this library are copyright by their
 # respective copyright holders.
 
-TOPDIR=../
+TOPDIR=../../
 include $(TOPDIR)Rules.mak
-LIBC=$(TOPDIR)libc.a
 
 ifeq ($(strip $(INCLUDE_RPC)),true)
 	DIRS=rpc

+ 1 - 2
libc/inet/rpc/Makefile

@@ -20,9 +20,8 @@
 # other sundry sources.  Files within this library are copyright by their
 # respective copyright holders.
 
-TOPDIR=../../
+TOPDIR=../../../
 include $(TOPDIR)Rules.mak
-LIBC=$(TOPDIR)libc.a
 CFLAGS+=-I$(TOPDIR)include/linux
 
 CSRC = auth_none.c auth_unix.c authunix_prot.c \

+ 1 - 2
libc/misc/Makefile

@@ -20,9 +20,8 @@
 # other sundry sources.  Files within this library are copyright by their
 # respective copyright holders.
 
-TOPDIR=../
+TOPDIR=../../
 include $(TOPDIR)Rules.mak
-LIBC=$(TOPDIR)libc.a
 
 
 DIRS = assert ctype dirent fnmatch glob internals lsearch mntent syslog \

+ 1 - 2
libc/misc/assert/Makefile

@@ -20,9 +20,8 @@
 # other sundry sources.  Files within this library are copyright by their
 # respective copyright holders.
 
-TOPDIR=../../
+TOPDIR=../../../
 include $(TOPDIR)Rules.mak
-LIBC=$(TOPDIR)libc.a
 
 CSRC=__assert.c
 COBJS=$(patsubst %.c,%.o, $(CSRC))

+ 1 - 2
libc/misc/ctype/Makefile

@@ -20,9 +20,8 @@
 # other sundry sources.  Files within this library are copyright by their
 # respective copyright holders.
 
-TOPDIR=../../
+TOPDIR=../../../
 include $(TOPDIR)Rules.mak
-LIBC=$(TOPDIR)libc.a
 
 MSRC=ctype.c
 MOBJ= isalnum.o isalpha.o isascii.o iscntrl.o isdigit.o isgraph.o \

+ 1 - 2
libc/misc/dirent/Makefile

@@ -20,9 +20,8 @@
 # other sundry sources.  Files within this library are copyright by their
 # respective copyright holders.
 
-TOPDIR=../../
+TOPDIR=../../../
 include $(TOPDIR)Rules.mak
-LIBC=$(TOPDIR)libc.a
 
 CSRC=alphasort.c closedir.c dirfd.c opendir.c readdir.c rewinddir.c scandir.c seekdir.c telldir.c
 COBJS=$(patsubst %.c,%.o, $(CSRC))

+ 1 - 2
libc/misc/fnmatch/Makefile

@@ -20,9 +20,8 @@
 # other sundry sources.  Files within this library are copyright by their
 # respective copyright holders.
 
-TOPDIR=../../
+TOPDIR=../../../
 include $(TOPDIR)Rules.mak
-LIBC=$(TOPDIR)libc.a
 
 CSRC=fnmatch.c
 COBJS=$(patsubst %.c,%.o, $(CSRC))

+ 1 - 2
libc/misc/glob/Makefile

@@ -20,9 +20,8 @@
 # other sundry sources.  Files within this library are copyright by their
 # respective copyright holders.
 
-TOPDIR=../../
+TOPDIR=../../../
 include $(TOPDIR)Rules.mak
-LIBC=$(TOPDIR)libc.a
 
 CSRC=glob.c
 COBJS=$(patsubst %.c,%.o, $(CSRC))

+ 1 - 2
libc/misc/internals/Makefile

@@ -20,9 +20,8 @@
 # other sundry sources.  Files within this library are copyright by their
 # respective copyright holders.
 
-TOPDIR=../../
+TOPDIR=../../../
 include $(TOPDIR)Rules.mak
-LIBC=$(TOPDIR)libc.a
 
 CSRC=ultostr.c ltostr.c __uClibc_main.c tempname.c
 ifeq ($(HAS_FLOATS),true)

+ 1 - 2
libc/misc/locale/Makefile

@@ -20,9 +20,8 @@
 # other sundry sources.  Files within this library are copyright by their
 # respective copyright holders.
 
-TOPDIR=../../
+TOPDIR=../../../
 include $(TOPDIR)Rules.mak
-LIBC=$(TOPDIR)libc.a
 
 CSRC=locale.c localeconv.c
 COBJS=$(patsubst %.c,%.o, $(CSRC))

+ 1 - 2
libc/misc/lock/Makefile

@@ -20,9 +20,8 @@
 # other sundry sources.  Files within this library are copyright by their
 # respective copyright holders.
 
-TOPDIR=../../
+TOPDIR=../../../
 include $(TOPDIR)Rules.mak
-LIBC=$(TOPDIR)libc.a
 
 CSRC=flock.c
 COBJS=$(patsubst %.c,%.o, $(CSRC))

+ 1 - 2
libc/misc/lsearch/Makefile

@@ -20,9 +20,8 @@
 # other sundry sources.  Files within this library are copyright by their
 # respective copyright holders.
 
-TOPDIR=../../
+TOPDIR=../../../
 include $(TOPDIR)Rules.mak
-LIBC=$(TOPDIR)libc.a
 
 CSRC=lsearch.c
 COBJS=$(patsubst %.c,%.o, $(CSRC))

+ 1 - 2
libc/misc/mntent/Makefile

@@ -20,9 +20,8 @@
 # other sundry sources.  Files within this library are copyright by their
 # respective copyright holders.
 
-TOPDIR=../../
+TOPDIR=../../../
 include $(TOPDIR)Rules.mak
-LIBC=$(TOPDIR)libc.a
 
 CSRC=mntent.c
 COBJS=$(patsubst %.c,%.o, $(CSRC))

+ 1 - 2
libc/misc/regex/Makefile

@@ -20,9 +20,8 @@
 # other sundry sources.  Files within this library are copyright by their
 # respective copyright holders.
 
-TOPDIR=../../
+TOPDIR=../../../
 include $(TOPDIR)Rules.mak
-LIBC=$(TOPDIR)libc.a
 
 CSRC=regex.c
 COBJS=$(patsubst %.c,%.o, $(CSRC))

+ 1 - 2
libc/misc/syslog/Makefile

@@ -20,9 +20,8 @@
 # other sundry sources.  Files within this library are copyright by their
 # respective copyright holders.
 
-TOPDIR=../../
+TOPDIR=../../../
 include $(TOPDIR)Rules.mak
-LIBC=$(TOPDIR)libc.a
 
 CSRC=syslog.c
 COBJS=$(patsubst %.c,%.o, $(CSRC))

+ 1 - 2
libc/misc/sysvipc/Makefile

@@ -20,9 +20,8 @@
 # other sundry sources.  Files within this library are copyright by their
 # respective copyright holders.
 
-TOPDIR=../../
+TOPDIR=../../../
 include $(TOPDIR)Rules.mak
-LIBC=$(TOPDIR)libc.a
 
 DIRS=
 

+ 1 - 2
libc/misc/time/Makefile

@@ -20,9 +20,8 @@
 # other sundry sources.  Files within this library are copyright by their
 # respective copyright holders.
 
-TOPDIR=../../
+TOPDIR=../../../
 include $(TOPDIR)Rules.mak
-LIBC=$(TOPDIR)libc.a
 
 CSRC=localtime.c gmtime.c asctime.c ctime.c asc_conv.c tm_conv.c mktime.c \
 	localtime_r.c gmtime_r.c asctime_r.c ctime_r.c utimes.c adjtime.c \

+ 1 - 2
libc/misc/tsearch/Makefile

@@ -20,9 +20,8 @@
 # other sundry sources.  Files within this library are copyright by their
 # respective copyright holders.
 
-TOPDIR=../../
+TOPDIR=../../../
 include $(TOPDIR)Rules.mak
-LIBC=$(TOPDIR)libc.a
 
 MSRC=tsearch.c
 MOBJ=tsearch.o tfind.o tdelete.o twalk.o

+ 1 - 2
libc/misc/utmp/Makefile

@@ -20,9 +20,8 @@
 # other sundry sources.  Files within this library are copyright by their
 # respective copyright holders.
 
-TOPDIR=../../
+TOPDIR=../../../
 include $(TOPDIR)Rules.mak
-LIBC=$(TOPDIR)libc.a
 
 CSRC=utent.c
 COBJS=$(patsubst %.c,%.o, $(CSRC))

+ 1 - 2
libc/pwd_grp/Makefile

@@ -20,9 +20,8 @@
 # other sundry sources.  Files within this library are copyright by their
 # respective copyright holders.
 
-TOPDIR=../
+TOPDIR=../../
 include $(TOPDIR)Rules.mak
-LIBC=$(TOPDIR)libc.a
 
 CSRC= pwent.c getpwnam.c getpwuid.c putpwent.c getpw.c fgetpwent.c \
 	__getgrent.c grent.c getgrnam.c getgrgid.c fgetgrent.c \

+ 1 - 2
libc/signal/Makefile

@@ -20,9 +20,8 @@
 # other sundry sources.  Files within this library are copyright by their
 # respective copyright holders.
 
-TOPDIR=../
+TOPDIR=../../
 include $(TOPDIR)Rules.mak
-LIBC=$(TOPDIR)libc.a
 
 CSRC=bsd_sig.c raise.c sigblock.c siggtmsk.c sigjmp.c signal.c sigintr.c\
 	sigpause.c sigstmsk.c sigaddset.c sigdelset.c sigismem.c \

+ 1 - 2
libc/stdio/Makefile

@@ -20,9 +20,8 @@
 # other sundry sources.  Files within this library are copyright by their
 # respective copyright holders.
 
-TOPDIR=../
+TOPDIR=../../
 include $(TOPDIR)Rules.mak
-LIBC=$(TOPDIR)libc.a
 
 MSRC=stdio.c
 MOBJ=_stdio_init.o \

+ 1 - 2
libc/stdlib/Makefile

@@ -20,9 +20,8 @@
 # other sundry sources.  Files within this library are copyright by their
 # respective copyright holders.
 
-TOPDIR=../
+TOPDIR=../../
 include $(TOPDIR)Rules.mak
-LIBC=$(TOPDIR)libc.a
 
 DIRS = $(MALLOC)
 ALL_SUBDIRS = malloc malloc-930716 malloc-simple

+ 1 - 2
libc/stdlib/malloc-930716/Makefile

@@ -20,9 +20,8 @@
 # other sundry sources.  Files within this library are copyright by their
 # respective copyright holders.
 
-TOPDIR=../../
+TOPDIR=../../../
 include $(TOPDIR)Rules.mak
-LIBC=$(TOPDIR)libc.a
 
 CSRC=calloc.c free.c malloc.c memalign.c morecore.c realloc.c valloc.c
 COBJS=$(patsubst %.c,%.o, $(CSRC))

+ 1 - 2
libc/stdlib/malloc-simple/Makefile

@@ -20,9 +20,8 @@
 # other sundry sources.  Files within this library are copyright by their
 # respective copyright holders.
 
-TOPDIR=../../
+TOPDIR=../../../
 include $(TOPDIR)Rules.mak
-LIBC=$(TOPDIR)libc.a
 
 MSRC=alloc.c
 MOBJ=malloc.o realloc.o free.o calloc.o malloc_dbg.o free_dbg.o calloc_dbg.o

+ 1 - 2
libc/stdlib/malloc/Makefile

@@ -20,9 +20,8 @@
 # other sundry sources.  Files within this library are copyright by their
 # respective copyright holders.
 
-TOPDIR=../../
+TOPDIR=../../../
 include $(TOPDIR)Rules.mak
-LIBC=$(TOPDIR)libc.a
 
 MSRC=alloc.c
 MOBJ=malloc_dbg.o free_dbg.o calloc_dbg.o realloc_dbg.o

+ 1 - 2
libc/string/Makefile

@@ -20,9 +20,8 @@
 # other sundry sources.  Files within this library are copyright by their
 # respective copyright holders.
 
-TOPDIR=../
+TOPDIR=../../
 include $(TOPDIR)Rules.mak
-LIBC=$(TOPDIR)libc.a
 
 MSRC=string.c
 MOBJ=strlen.o strcat.o strcpy.o strchr.o strcmp.o strncat.o strncpy.o \

+ 1 - 3
libc/sysdeps/Makefile

@@ -22,9 +22,7 @@
 
 DIRS = linux
 
-all: libc.a
-
-libc.a: subdirs
+all: subdirs
 
 tags:
 	ctags -R

+ 2 - 4
libc/sysdeps/linux/Makefile

@@ -20,15 +20,13 @@
 # other sundry sources.  Files within this library are copyright by their
 # respective copyright holders.
 
-TOPDIR=../../
+TOPDIR=../../../
 include $(TOPDIR)Rules.mak
 
 DIRS = common $(TARGET_ARCH)
 ALL_SUBDIRS = arm common i386 m68k powerpc sh sparc 
 
-all: libc.a
-
-libc.a: subdirs
+all: subdirs
 
 tags:
 	ctags -R

+ 2 - 4
libc/sysdeps/linux/arm/Makefile

@@ -20,9 +20,8 @@
 # other sundry sources.  Files within this library are copyright by their
 # respective copyright holders.
 
-TOPDIR=../../../
+TOPDIR=../../../../
 include $(TOPDIR)Rules.mak
-LIBC=$(TOPDIR)libc.a
 ASFLAGS=$(CFLAGS)
 
 TARGET_MACHINE_TYPE=$(shell $(CC) -dumpmachine)
@@ -32,7 +31,6 @@ ifeq ($(TARGET_MACHINE_TYPE),arm-pic-elf)
 else
     CRT0=crt0.S
 endif
-
 CRT0_OBJ=$(patsubst %.S,%.o, $(CRT0))
 
 SSRC=longjmp.S setjmp.S vfork.S
@@ -50,7 +48,7 @@ $(LIBC): ar-target
 
 ar-target: $(OBJS) $(CRT0_OBJ)
 	$(AR) $(ARFLAGS) $(LIBC) $(OBJS)
-	cp $(CRT0_OBJ) $(TOPDIR)crt0.o
+	cp $(CRT0_OBJ) $(TOPDIR)libc/$(CRT0_OBJ)
 
 $(CRT0_OBJ): %.o : %.S
 	$(CC) $(CFLAGS) -c $< -o $@

+ 1 - 2
libc/sysdeps/linux/common/Makefile

@@ -21,9 +21,8 @@
 # other sundry sources.  Files within this library are copyright by their
 # respective copyright holders.
 
-TOPDIR=../../../
+TOPDIR=../../../../
 include $(TOPDIR)Rules.mak
-LIBC=$(TOPDIR)libc.a
 
 CSRC=	waitpid.c getdents.c kernel_version.c statfix.c getdnnm.c tell.c gethstnm.c \
 	mkfifo.c setegid.c wait.c errno.c getpagesize.c  seteuid.c wait3.c setpgrp.c \

+ 2 - 3
libc/sysdeps/linux/i386/Makefile

@@ -20,9 +20,8 @@
 # other sundry sources.  Files within this library are copyright by their
 # respective copyright holders.
 
-TOPDIR=../../../
+TOPDIR=../../../../
 include $(TOPDIR)Rules.mak
-LIBC=$(TOPDIR)libc.a
 ASFLAGS=$(CFLAGS)
 
 CRT0=crt0.S
@@ -46,7 +45,7 @@ $(LIBC): ar-target
 
 ar-target: $(OBJS) $(CRT0_OBJ)
 	$(AR) $(ARFLAGS) $(LIBC) $(OBJS)
-	cp $(CRT0_OBJ) $(TOPDIR)$(CRT0_OBJ)
+	cp $(CRT0_OBJ) $(TOPDIR)libc/$(CRT0_OBJ)
 
 $(CRT0_OBJ): %.o : %.S
 	$(CC) $(CFLAGS) -c $< -o $@

+ 2 - 3
libc/sysdeps/linux/m68k/Makefile

@@ -20,9 +20,8 @@
 # other sundry sources.  Files within this library are copyright by their
 # respective copyright holders.
 
-TOPDIR=../../../
+TOPDIR=../../../../
 include $(TOPDIR)Rules.mak
-LIBC=$(TOPDIR)libc.a
 ASFLAGS=$(CFLAGS)
 
 # If you're looking for vfork(), it is defined in include/unistd.h
@@ -46,7 +45,7 @@ $(LIBC): ar-target
 
 ar-target: $(OBJS) $(CRT0_OBJ)
 	$(AR) $(ARFLAGS) $(LIBC) $(OBJS)
-	cp $(CRT0_OBJ) $(TOPDIR)$(CRT0_OBJ)
+	cp $(CRT0_OBJ) $(TOPDIR)libc/$(CRT0_OBJ)
 
 $(CRT0_OBJ): %.o : %.S
 	$(CC) $(CFLAGS) -c $< -o $@

+ 3 - 5
libc/sysdeps/linux/powerpc/Makefile

@@ -22,9 +22,8 @@
 
 USE_CRT0_C=y
 
-TOPDIR=../../../
+TOPDIR=../../../../
 include $(TOPDIR)Rules.mak
-LIBC=$(TOPDIR)libc.a
 ASFLAGS=$(CFLAGS)
 
 TARGET_MACHINE_TYPE=$(shell $(CC) -dumpmachine)
@@ -34,8 +33,7 @@ CRT0=crt0.c
 else
 CRT0=crt0.S
 endif
-
-CRT0_OBJ=crt0.o
+CRT0_OBJ=$(patsubst %.S,%.o, $(CRT0))
 
 SSRC=longjmp.S setjmp.S vfork.S
 SOBJS=$(patsubst %.S,%.o, $(SSRC))
@@ -53,7 +51,7 @@ $(LIBC): ar-target
 
 ar-target: $(OBJS) $(CRT0_OBJ)
 	$(AR) $(ARFLAGS) $(LIBC) $(OBJS)
-	cp $(CRT0_OBJ) $(TOPDIR)crt0.o
+	cp $(CRT0_OBJ) $(TOPDIR)libc/$(CRT0_OBJ)
 
 ifeq ($(USE_CRT0_C),y)
 $(CRT0_OBJ): %.o : %.c

+ 2 - 4
libc/sysdeps/linux/sh/Makefile

@@ -21,9 +21,8 @@
 # other sundry sources.  Files within this library are copyright by their
 # respective copyright holders.
 
-TOPDIR=../../../
+TOPDIR=../../../../
 include $(TOPDIR)Rules.mak
-LIBC=$(TOPDIR)libc.a
 ASFLAGS=$(CFLAGS)
 
 CFLAGS+= -I../ -D__ASSEMBLER__ -DASM_GLOBAL_DIRECTIVE=.globl
@@ -31,7 +30,6 @@ CFLAGS+= -I../ -D__ASSEMBLER__ -DASM_GLOBAL_DIRECTIVE=.globl
 TARGET_MACHINE_TYPE=$(shell $(CC) -dumpmachine)
 
 CRT0=crt0.S
-
 CRT0_OBJ=$(patsubst %.S,%.o, $(CRT0))
 
 SSRC=setjmp.S bsd-setjmp.S bsd-_setjmp.S __longjmp.S
@@ -49,7 +47,7 @@ $(LIBC): ar-target
 
 ar-target: $(OBJS) $(CRT0_OBJ)
 	$(AR) $(ARFLAGS) $(LIBC) $(OBJS)
-	cp $(CRT0_OBJ) $(TOPDIR)crt0.o
+	cp $(CRT0_OBJ) $(TOPDIR)libc/$(CRT0_OBJ)
 
 $(CRT0_OBJ): %.o : %.S
 	$(CC) $(CFLAGS) -c $< -o $@

+ 2 - 3
libc/sysdeps/linux/sparc/Makefile

@@ -20,9 +20,8 @@
 # other sundry sources.  Files within this library are copyright by their
 # respective copyright holders.
 
-TOPDIR=../../../
+TOPDIR=../../../../
 include $(TOPDIR)Rules.mak
-LIBC=$(TOPDIR)libc.a
 ASFLAGS=$(CFLAGS)
 
 CRT0=crt0.S
@@ -46,7 +45,7 @@ $(LIBC): ar-target
 
 ar-target: $(OBJS) $(CRT0_OBJ)
 	$(AR) $(ARFLAGS) $(LIBC) $(OBJS)
-	cp $(CRT0_OBJ) $(TOPDIR)$(CRT0_OBJ)
+	cp $(CRT0_OBJ) $(TOPDIR)libc/$(CRT0_OBJ)
 
 $(CRT0_OBJ): %.o : %.S
 	$(CC) $(CFLAGS) -c $< -o $@

+ 1 - 2
libc/termios/Makefile

@@ -20,9 +20,8 @@
 # other sundry sources.  Files within this library are copyright by their
 # respective copyright holders.
 
-TOPDIR=../
+TOPDIR=../../
 include $(TOPDIR)Rules.mak
-LIBC=$(TOPDIR)libc.a
 
 MSRC=termios.c
 MOBJ= tcdrain.o tcflow.o tcflush.o tcsendbreak.o tcsetpgrp.o tcgetpgrp.o \

+ 1 - 2
libc/unistd/Makefile

@@ -20,9 +20,8 @@
 # other sundry sources.  Files within this library are copyright by their
 # respective copyright holders.
 
-TOPDIR=../
+TOPDIR=../../
 include $(TOPDIR)Rules.mak
-LIBC=$(TOPDIR)libc.a
 DIRS:=
 
 CSRC=execl.c execlp.c execv.c execvep.c execvp.c execle.c getcwd.c getopt.c \

+ 4 - 3
libcrypt/Makefile

@@ -39,7 +39,7 @@ ar-target: $(OBJS)
 	$(AR) $(ARFLAGS) $(LIBCRYPT) $(OBJS)
 	install -d $(TOPDIR)lib
 	rm -f $(TOPDIR)lib/$(LIBCRYPT)
-	install -m 644 $(LIBCRYPT) $(TOPDIR)lib/
+	install -m 644 $(LIBCRYPT) $(TOPDIR)lib
 
 $(OBJS): %.o : %.c
 	$(TARGET_CC) $(CFLAGS) -c $< -o $@
@@ -49,10 +49,11 @@ $(OBJ): Makefile
 
 shared: all
 	$(TARGET_CC) $(LDFLAGS) -shared -o $(LIBCRYPT_SHARED_FULLNAME) \
-	    -Wl,-soname,$(LIBCRYPT_SHARED).$(MAJOR_VERSION) $(OBJS) $(TOPDIR)$(SHARED_FULLNAME)
+	    -Wl,-soname,$(LIBCRYPT_SHARED).$(MAJOR_VERSION) -Wl,--whole-archive \
+	    $(LIBCRYPT) $(TOPDIR)lib/$(SHARED_FULLNAME)
 	install -d $(TOPDIR)lib
 	rm -f $(TOPDIR)lib/$(LIBCRYPT_SHARED_FULLNAME) $(TOPDIR)lib/$(LIBCRYPT_SHARED).$(MAJOR_VERSION)
-	install -m 644 $(LIBCRYPT_SHARED_FULLNAME) $(TOPDIR)lib/;
+	install -m 644 $(LIBCRYPT_SHARED_FULLNAME) $(TOPDIR)lib;
 	(cd $(TOPDIR)lib; ln -sf $(LIBCRYPT_SHARED_FULLNAME) $(LIBCRYPT_SHARED).$(MAJOR_VERSION)); 
 
 clean: 

+ 5 - 5
libm/Makefile

@@ -1,7 +1,9 @@
 # Makefile for uClibc's math library
-#
 # Copyright (C) 2001 by Lineo, inc.
 #
+# This math library is derived primarily from the Cephes Math Library,
+# copyright by Stephen L. Moshier <moshier@world.std.com>
+#
 # This program is free software; you can redistribute it and/or modify it under
 # the terms of the GNU Library General Public License as published by the Free
 # Software Foundation; either version 2 of the License, or (at your option) any
@@ -16,9 +18,6 @@
 # along with this program; if not, write to the Free Software Foundation, Inc.,
 # 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 #
-# Derived in part from the Linux-8086 C library, the GNU C Library, and several
-# other sundry sources.  Files within this library are copyright by their
-# respective copyright holders.
 
 TOPDIR=../
 include $(TOPDIR)Rules.mak
@@ -55,7 +54,8 @@ tags:
 shared: all
 	@if [ -f $(LIBM) ] ; then \
 		$(TARGET_CC) $(LDFLAGS) -shared -o $(LIBM_SHARED_FULLNAME) \
-		    -Wl,-soname,$(LIBM_SHARED).$(MAJOR_VERSION) $(OBJS) $(TOPDIR)$(SHARED_FULLNAME); \
+		    -Wl,-soname,$(LIBM_SHARED).$(MAJOR_VERSION) -Wl,--whole-archive \
+		    $(LIBM) $(TOPDIR)lib/$(SHARED_FULLNAME); \
 		install -d $(TOPDIR)lib; \
 		rm -f $(TOPDIR)lib/$(LIBM_SHARED_FULLNAME) $(TOPDIR)lib/$(LIBM_SHARED).$(MAJOR_VERSION); \
 		install -m 644 $(LIBM_SHARED_FULLNAME) $(TOPDIR)lib; \

+ 3 - 4
libm/double/Makefile

@@ -1,7 +1,9 @@
 # Makefile for uClibc's math library
-#
 # Copyright (C) 2001 by Lineo, inc.
 #
+# This math library is derived primarily from the Cephes Math Library,
+# copyright by Stephen L. Moshier <moshier@world.std.com>
+#
 # This program is free software; you can redistribute it and/or modify it under
 # the terms of the GNU Library General Public License as published by the Free
 # Software Foundation; either version 2 of the License, or (at your option) any
@@ -16,9 +18,6 @@
 # along with this program; if not, write to the Free Software Foundation, Inc.,
 # 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 #
-# Derived in part from the Linux-8086 C library, the GNU C Library, and several
-# other sundry sources.  Files within this library are copyright by their
-# respective copyright holders.
 
 TOPDIR=../../
 include $(TOPDIR)Rules.mak

+ 3 - 6
libm/float/Makefile

@@ -1,7 +1,9 @@
 # Makefile for uClibc's math library
-#
 # Copyright (C) 2001 by Lineo, inc.
 #
+# This math library is derived primarily from the Cephes Math Library,
+# copyright by Stephen L. Moshier <moshier@world.std.com>
+#
 # This program is free software; you can redistribute it and/or modify it under
 # the terms of the GNU Library General Public License as published by the Free
 # Software Foundation; either version 2 of the License, or (at your option) any
@@ -16,9 +18,6 @@
 # along with this program; if not, write to the Free Software Foundation, Inc.,
 # 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 #
-# Derived in part from the Linux-8086 C library, the GNU C Library, and several
-# other sundry sources.  Files within this library are copyright by their
-# respective copyright holders.
 
 TOPDIR=../../
 include $(TOPDIR)Rules.mak
@@ -40,8 +39,6 @@ CSRC= acoshf.c airyf.c asinf.c asinhf.c atanf.c \
 	struvef.c tandgf.c tanf.c tanhf.c ynf.c zetaf.c \
 	zetacf.c polevlf.c setprec.c mtherr.c
 COBJS=$(patsubst %.c,%.o, $(CSRC))
-
-
 OBJS=$(COBJS)
 
 all: $(OBJS) $(LIBM)

+ 3 - 4
libm/ldouble/Makefile

@@ -1,7 +1,9 @@
 # Makefile for uClibc's math library
-#
 # Copyright (C) 2001 by Lineo, inc.
 #
+# This math library is derived primarily from the Cephes Math Library,
+# copyright by Stephen L. Moshier <moshier@world.std.com>
+#
 # This program is free software; you can redistribute it and/or modify it under
 # the terms of the GNU Library General Public License as published by the Free
 # Software Foundation; either version 2 of the License, or (at your option) any
@@ -16,9 +18,6 @@
 # along with this program; if not, write to the Free Software Foundation, Inc.,
 # 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 #
-# Derived in part from the Linux-8086 C library, the GNU C Library, and several
-# other sundry sources.  Files within this library are copyright by their
-# respective copyright holders.
 
 TOPDIR=../../
 include $(TOPDIR)Rules.mak

+ 2 - 1
libutil/Makefile

@@ -48,7 +48,8 @@ $(OBJS): %.o : %.c
 
 shared: all
 	$(TARGET_CC) $(LDFLAGS) -shared -o $(LIBUTIL_SHARED_FULLNAME) \
-	    -Wl,-soname,$(LIBUTIL_SHARED).$(MAJOR_VERSION) $(OBJS) $(TOPDIR)$(SHARED_FULLNAME)
+	    -Wl,-soname,$(LIBUTIL_SHARED).$(MAJOR_VERSION) -Wl,--whole-archive \
+	    $(LIBUTIL) $(TOPDIR)lib/$(SHARED_FULLNAME)
 	install -d $(TOPDIR)lib
 	rm -f $(TOPDIR)lib/$(LIBUTIL_SHARED_FULLNAME) $(TOPDIR)lib/$(LIBUTIL_SHARED).$(MAJOR_VERSION)
 	install -m 644 $(LIBUTIL_SHARED_FULLNAME) $(TOPDIR)lib/;