From f0da4aa1d854ca9c2a0e652dcb1d81bbf4d971f4 Mon Sep 17 00:00:00 2001 From: Eric Andersen Date: Sat, 12 May 2001 06:19:18 +0000 Subject: 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 --- Makefile | 132 +++++++++++++----------------------- Rules.mak | 10 ++- extra/gcc-uClibc/gcc-uClibc.c | 6 +- ldso/Makefile | 18 ++--- ldso/Rules.mak | 1 - ldso/ldso/Makefile | 49 +++++++++---- ldso/libdl/Makefile | 72 ++++++++++++++------ ldso/util/Makefile | 4 +- libc/Makefile | 112 ++++++++++++++++++++++++++++++ libc/inet/Makefile | 3 +- libc/inet/rpc/Makefile | 3 +- libc/misc/Makefile | 3 +- libc/misc/assert/Makefile | 3 +- libc/misc/ctype/Makefile | 3 +- libc/misc/dirent/Makefile | 3 +- libc/misc/fnmatch/Makefile | 3 +- libc/misc/glob/Makefile | 3 +- libc/misc/internals/Makefile | 3 +- libc/misc/locale/Makefile | 3 +- libc/misc/lock/Makefile | 3 +- libc/misc/lsearch/Makefile | 3 +- libc/misc/mntent/Makefile | 3 +- libc/misc/regex/Makefile | 3 +- libc/misc/syslog/Makefile | 3 +- libc/misc/sysvipc/Makefile | 3 +- libc/misc/time/Makefile | 3 +- libc/misc/tsearch/Makefile | 3 +- libc/misc/utmp/Makefile | 3 +- libc/pwd_grp/Makefile | 3 +- libc/signal/Makefile | 3 +- libc/stdio/Makefile | 3 +- libc/stdlib/Makefile | 3 +- libc/stdlib/malloc-930716/Makefile | 3 +- libc/stdlib/malloc-simple/Makefile | 3 +- libc/stdlib/malloc/Makefile | 3 +- libc/string/Makefile | 3 +- libc/sysdeps/Makefile | 4 +- libc/sysdeps/linux/Makefile | 6 +- libc/sysdeps/linux/arm/Makefile | 6 +- libc/sysdeps/linux/common/Makefile | 3 +- libc/sysdeps/linux/i386/Makefile | 5 +- libc/sysdeps/linux/m68k/Makefile | 5 +- libc/sysdeps/linux/powerpc/Makefile | 8 +-- libc/sysdeps/linux/sh/Makefile | 6 +- libc/sysdeps/linux/sparc/Makefile | 5 +- libc/termios/Makefile | 3 +- libc/unistd/Makefile | 3 +- libcrypt/Makefile | 7 +- libm/Makefile | 10 +-- libm/double/Makefile | 7 +- libm/float/Makefile | 9 +-- libm/ldouble/Makefile | 7 +- libutil/Makefile | 3 +- 53 files changed, 333 insertions(+), 249 deletions(-) create mode 100644 libc/Makefile 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 , +# +# 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 CSRC=__assert.c COBJS=$(patsubst %.c,%.o, $(CSRC)) diff --git a/libc/misc/ctype/Makefile b/libc/misc/ctype/Makefile index a9d5837e5..e0343ba00 100644 --- a/libc/misc/ctype/Makefile +++ b/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 \ diff --git a/libc/misc/dirent/Makefile b/libc/misc/dirent/Makefile index 8de2054b6..23b024b63 100644 --- a/libc/misc/dirent/Makefile +++ b/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)) diff --git a/libc/misc/fnmatch/Makefile b/libc/misc/fnmatch/Makefile index ce2ac2a47..d5484f864 100644 --- a/libc/misc/fnmatch/Makefile +++ b/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)) diff --git a/libc/misc/glob/Makefile b/libc/misc/glob/Makefile index 8254381ea..d6ea09b7e 100644 --- a/libc/misc/glob/Makefile +++ b/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)) diff --git a/libc/misc/internals/Makefile b/libc/misc/internals/Makefile index b5d23f734..2d0be502c 100644 --- a/libc/misc/internals/Makefile +++ b/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) diff --git a/libc/misc/locale/Makefile b/libc/misc/locale/Makefile index a54a0e38a..e90ada064 100644 --- a/libc/misc/locale/Makefile +++ b/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)) diff --git a/libc/misc/lock/Makefile b/libc/misc/lock/Makefile index 041ca5404..e197bbb52 100644 --- a/libc/misc/lock/Makefile +++ b/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)) diff --git a/libc/misc/lsearch/Makefile b/libc/misc/lsearch/Makefile index 5ea47e14d..6506c8c49 100644 --- a/libc/misc/lsearch/Makefile +++ b/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)) diff --git a/libc/misc/mntent/Makefile b/libc/misc/mntent/Makefile index ee163c182..297e19f1f 100644 --- a/libc/misc/mntent/Makefile +++ b/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)) diff --git a/libc/misc/regex/Makefile b/libc/misc/regex/Makefile index 89912aa74..30d9d4da0 100644 --- a/libc/misc/regex/Makefile +++ b/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)) diff --git a/libc/misc/syslog/Makefile b/libc/misc/syslog/Makefile index a52d413ed..deca334f2 100644 --- a/libc/misc/syslog/Makefile +++ b/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)) diff --git a/libc/misc/sysvipc/Makefile b/libc/misc/sysvipc/Makefile index 326535576..d94531788 100644 --- a/libc/misc/sysvipc/Makefile +++ b/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= diff --git a/libc/misc/time/Makefile b/libc/misc/time/Makefile index 25dbab14e..4ac8976a1 100644 --- a/libc/misc/time/Makefile +++ b/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 \ diff --git a/libc/misc/tsearch/Makefile b/libc/misc/tsearch/Makefile index c897d2781..3055f6458 100644 --- a/libc/misc/tsearch/Makefile +++ b/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 diff --git a/libc/misc/utmp/Makefile b/libc/misc/utmp/Makefile index 01b070f3e..438b5bd78 100644 --- a/libc/misc/utmp/Makefile +++ b/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)) diff --git a/libc/pwd_grp/Makefile b/libc/pwd_grp/Makefile index d37efbdf3..d4dd97f01 100644 --- a/libc/pwd_grp/Makefile +++ b/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 \ diff --git a/libc/signal/Makefile b/libc/signal/Makefile index bab67594d..4e588c780 100644 --- a/libc/signal/Makefile +++ b/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 \ diff --git a/libc/stdio/Makefile b/libc/stdio/Makefile index 3aec83dd1..c9130c0d7 100644 --- a/libc/stdio/Makefile +++ b/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 \ diff --git a/libc/stdlib/Makefile b/libc/stdlib/Makefile index 7bf0d5331..c8fde662b 100644 --- a/libc/stdlib/Makefile +++ b/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 diff --git a/libc/stdlib/malloc-930716/Makefile b/libc/stdlib/malloc-930716/Makefile index a4ae21798..208c1a68d 100644 --- a/libc/stdlib/malloc-930716/Makefile +++ b/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)) diff --git a/libc/stdlib/malloc-simple/Makefile b/libc/stdlib/malloc-simple/Makefile index cc2c132b2..a84578a0a 100644 --- a/libc/stdlib/malloc-simple/Makefile +++ b/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 diff --git a/libc/stdlib/malloc/Makefile b/libc/stdlib/malloc/Makefile index c2190dcdc..a280144d3 100644 --- a/libc/stdlib/malloc/Makefile +++ b/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 diff --git a/libc/string/Makefile b/libc/string/Makefile index 4d0a95da8..e2d04c3f9 100644 --- a/libc/string/Makefile +++ b/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 \ diff --git a/libc/sysdeps/Makefile b/libc/sysdeps/Makefile index 51f86ea4c..cf35e3752 100644 --- a/libc/sysdeps/Makefile +++ b/libc/sysdeps/Makefile @@ -22,9 +22,7 @@ DIRS = linux -all: libc.a - -libc.a: subdirs +all: subdirs tags: ctags -R diff --git a/libc/sysdeps/linux/Makefile b/libc/sysdeps/linux/Makefile index 87aa1f3a3..db3fcb36c 100644 --- a/libc/sysdeps/linux/Makefile +++ b/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 diff --git a/libc/sysdeps/linux/arm/Makefile b/libc/sysdeps/linux/arm/Makefile index 7dee13aa9..f63b5ff62 100644 --- a/libc/sysdeps/linux/arm/Makefile +++ b/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 $@ diff --git a/libc/sysdeps/linux/common/Makefile b/libc/sysdeps/linux/common/Makefile index 8617c0b71..1e1957227 100644 --- a/libc/sysdeps/linux/common/Makefile +++ b/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 \ diff --git a/libc/sysdeps/linux/i386/Makefile b/libc/sysdeps/linux/i386/Makefile index 45aa84777..afca6bd82 100644 --- a/libc/sysdeps/linux/i386/Makefile +++ b/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 $@ diff --git a/libc/sysdeps/linux/m68k/Makefile b/libc/sysdeps/linux/m68k/Makefile index 3dccba6ee..d79f0e33c 100644 --- a/libc/sysdeps/linux/m68k/Makefile +++ b/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 $@ diff --git a/libc/sysdeps/linux/powerpc/Makefile b/libc/sysdeps/linux/powerpc/Makefile index c738d449b..d877b85e3 100644 --- a/libc/sysdeps/linux/powerpc/Makefile +++ b/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 diff --git a/libc/sysdeps/linux/sh/Makefile b/libc/sysdeps/linux/sh/Makefile index e936ee1b7..f36dca0fa 100644 --- a/libc/sysdeps/linux/sh/Makefile +++ b/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 $@ diff --git a/libc/sysdeps/linux/sparc/Makefile b/libc/sysdeps/linux/sparc/Makefile index fdc802b89..ba1c37f99 100644 --- a/libc/sysdeps/linux/sparc/Makefile +++ b/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 $@ diff --git a/libc/termios/Makefile b/libc/termios/Makefile index 8b1f9e2ea..77adfdcfc 100644 --- a/libc/termios/Makefile +++ b/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 \ diff --git a/libc/unistd/Makefile b/libc/unistd/Makefile index 7376b73a9..5b7e8df34 100644 --- a/libc/unistd/Makefile +++ b/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 \ diff --git a/libcrypt/Makefile b/libcrypt/Makefile index a3cff4fc6..6eac3299a 100644 --- a/libcrypt/Makefile +++ b/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: diff --git a/libm/Makefile b/libm/Makefile index 7227e664f..419e365c2 100644 --- a/libm/Makefile +++ b/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 +# # 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; \ diff --git a/libm/double/Makefile b/libm/double/Makefile index be3c5878a..b64116df8 100644 --- a/libm/double/Makefile +++ b/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 +# # 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 diff --git a/libm/float/Makefile b/libm/float/Makefile index 389ac1a5d..bae5fecea 100644 --- a/libm/float/Makefile +++ b/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 +# # 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) diff --git a/libm/ldouble/Makefile b/libm/ldouble/Makefile index 43395a140..04b3aacac 100644 --- a/libm/ldouble/Makefile +++ b/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 +# # 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 diff --git a/libutil/Makefile b/libutil/Makefile index f98a4c46d..70c274233 100644 --- a/libutil/Makefile +++ b/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/; -- cgit v1.2.3