summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2001-05-12 06:19:18 +0000
committerEric Andersen <andersen@codepoet.org>2001-05-12 06:19:18 +0000
commitf0da4aa1d854ca9c2a0e652dcb1d81bbf4d971f4 (patch)
tree39dd87100094d48dbc7e8557f26d5c02d331606f
parent249cb00d9f655778aa8a4519ee3e610a904d694d (diff)
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
-rw-r--r--Makefile132
-rw-r--r--Rules.mak10
-rw-r--r--extra/gcc-uClibc/gcc-uClibc.c6
-rw-r--r--ldso/Makefile18
-rw-r--r--ldso/Rules.mak1
-rw-r--r--ldso/ldso/Makefile49
-rw-r--r--ldso/libdl/Makefile72
-rw-r--r--ldso/util/Makefile4
-rw-r--r--libc/Makefile112
-rw-r--r--libc/inet/Makefile3
-rw-r--r--libc/inet/rpc/Makefile3
-rw-r--r--libc/misc/Makefile3
-rw-r--r--libc/misc/assert/Makefile3
-rw-r--r--libc/misc/ctype/Makefile3
-rw-r--r--libc/misc/dirent/Makefile3
-rw-r--r--libc/misc/fnmatch/Makefile3
-rw-r--r--libc/misc/glob/Makefile3
-rw-r--r--libc/misc/internals/Makefile3
-rw-r--r--libc/misc/locale/Makefile3
-rw-r--r--libc/misc/lock/Makefile3
-rw-r--r--libc/misc/lsearch/Makefile3
-rw-r--r--libc/misc/mntent/Makefile3
-rw-r--r--libc/misc/regex/Makefile3
-rw-r--r--libc/misc/syslog/Makefile3
-rw-r--r--libc/misc/sysvipc/Makefile3
-rw-r--r--libc/misc/time/Makefile3
-rw-r--r--libc/misc/tsearch/Makefile3
-rw-r--r--libc/misc/utmp/Makefile3
-rw-r--r--libc/pwd_grp/Makefile3
-rw-r--r--libc/signal/Makefile3
-rw-r--r--libc/stdio/Makefile3
-rw-r--r--libc/stdlib/Makefile3
-rw-r--r--libc/stdlib/malloc-930716/Makefile3
-rw-r--r--libc/stdlib/malloc-simple/Makefile3
-rw-r--r--libc/stdlib/malloc/Makefile3
-rw-r--r--libc/string/Makefile3
-rw-r--r--libc/sysdeps/Makefile4
-rw-r--r--libc/sysdeps/linux/Makefile6
-rw-r--r--libc/sysdeps/linux/arm/Makefile6
-rw-r--r--libc/sysdeps/linux/common/Makefile3
-rw-r--r--libc/sysdeps/linux/i386/Makefile5
-rw-r--r--libc/sysdeps/linux/m68k/Makefile5
-rw-r--r--libc/sysdeps/linux/powerpc/Makefile8
-rw-r--r--libc/sysdeps/linux/sh/Makefile6
-rw-r--r--libc/sysdeps/linux/sparc/Makefile5
-rw-r--r--libc/termios/Makefile3
-rw-r--r--libc/unistd/Makefile3
-rw-r--r--libcrypt/Makefile7
-rw-r--r--libm/Makefile10
-rw-r--r--libm/double/Makefile7
-rw-r--r--libm/float/Makefile9
-rw-r--r--libm/ldouble/Makefile7
-rw-r--r--libutil/Makefile3
53 files changed, 333 insertions, 249 deletions
diff --git a/Makefile b/Makefile
index 4957111ab..6f95ee400 100644
--- a/Makefile
+++ b/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
diff --git a/Rules.mak b/Rules.mak
index 9fa518bfe..1b065a1a5 100644
--- a/Rules.mak
+++ b/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.
diff --git a/extra/gcc-uClibc/gcc-uClibc.c b/extra/gcc-uClibc/gcc-uClibc.c
index 1a0eb1da7..710be8df0 100644
--- a/extra/gcc-uClibc/gcc-uClibc.c
+++ b/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";
diff --git a/ldso/Makefile b/ldso/Makefile
index d7af33f89..dab0025f4 100644
--- a/ldso/Makefile
+++ b/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:
diff --git a/ldso/Rules.mak b/ldso/Rules.mak
index 4c58ff928..b853c1426 100644
--- a/ldso/Rules.mak
+++ b/ldso/Rules.mak
@@ -1,7 +1,6 @@
include $(TOPDIR)Rules.mak
LDSO_VERSION=1.9.11
-LIBDL = libdl.so
DEVEL=true
diff --git a/ldso/ldso/Makefile b/ldso/ldso/Makefile
index ae181bb0a..d69823c9c 100644
--- a/ldso/ldso/Makefile
+++ b/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 *~
diff --git a/ldso/libdl/Makefile b/ldso/libdl/Makefile
index 6aac97002..1e1a0ac36 100644
--- a/ldso/libdl/Makefile
+++ b/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 *~
diff --git a/ldso/util/Makefile b/ldso/util/Makefile
index ac80544e9..a8f482f20 100644
--- a/ldso/util/Makefile
+++ b/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
diff --git a/libc/Makefile b/libc/Makefile
new file mode 100644
index 000000000..695e8ebe1
--- /dev/null
+++ b/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
+
diff --git a/libc/inet/Makefile b/libc/inet/Makefile
index fe5134558..e6ffff694 100644
--- a/libc/inet/Makefile
+++ b/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
diff --git a/libc/inet/rpc/Makefile b/libc/inet/rpc/Makefile
index b3acc3b08..f2c63bb88 100644
--- a/libc/inet/rpc/Makefile
+++ b/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 \
diff --git a/libc/misc/Makefile b/libc/misc/Makefile
index de8b9b3f5..7733c5b80 100644
--- a/libc/misc/Makefile
+++ b/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 \
diff --git a/libc/misc/assert/Makefile b/libc/misc/assert/Makefile
index d6023490f..ad08d3dc9 100644
--- a/libc/misc/assert/Makefile
+++ b/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
C