From ffc7bb39cce77ae6243aa903f0cc1a96ab42bce8 Mon Sep 17 00:00:00 2001 From: Eric Andersen Date: Thu, 12 Jul 2001 21:41:31 +0000 Subject: This commit merges David Schleef's updates to the build system, which a few tiny fixups here and there from me. Seems to work just fine and will hopefully be a bit better behaved. -Erik --- Makefile | 102 ++++++++++++++++++--------------- README | 52 ++++++++++++++--- Rules.mak | 14 +++-- extra/Configs/Config.arm | 45 +++++++++------ extra/Configs/Config.cross.arm.uclinux | 45 +++++++++------ extra/Configs/Config.i386 | 46 +++++++++------ extra/Configs/Config.m68k | 50 +++++++++------- extra/Configs/Config.m68k.coff | 51 ++++++++++------- extra/Configs/Config.mips | 46 +++++++++------ extra/Configs/Config.mipsel | 46 +++++++++------ extra/Configs/Config.powerpc | 52 ++++++++++------- extra/Configs/Config.sh | 46 +++++++++------ extra/gcc-uClibc/Makefile | 33 +++++------ extra/gcc-uClibc/gcc-uClibc.c | 12 ++-- ldso/ldso/Makefile | 4 +- ldso/util/Makefile | 4 +- 16 files changed, 384 insertions(+), 264 deletions(-) diff --git a/Makefile b/Makefile index 98ab12ede..a092b1ba5 100644 --- a/Makefile +++ b/Makefile @@ -32,10 +32,6 @@ include Rules.mak DIRS = extra ldso libc libcrypt libresolv libutil libm -ifndef $(TARGET_PREFIX) - TARGET_PREFIX = `pwd`/_install -endif - all: headers uClibc_config.h subdirs $(DO_SHARED) done Config: @@ -64,12 +60,12 @@ done: $(DO_SHARED) headers: dummy @rm -f include/asm include/linux include/bits @if [ $(TARGET_ARCH) = "powerpc" ];then \ - ln -s $(KERNEL_SOURCE)/include/asm-ppc include/asm; \ + ln -fs $(KERNEL_SOURCE)/include/asm-ppc include/asm; \ else \ if [ $(HAS_MMU) != "true" ]; then \ - ln -s $(KERNEL_SOURCE)/include/asm-$(TARGET_ARCH)nommu include/asm;\ + ln -fs $(KERNEL_SOURCE)/include/asm-$(TARGET_ARCH)nommu include/asm;\ else \ - ln -s $(KERNEL_SOURCE)/include/asm-$(TARGET_ARCH) include/asm; \ + ln -fs $(KERNEL_SOURCE)/include/asm-$(TARGET_ARCH) include/asm; \ fi; \ fi; @if [ ! -f include/asm/unistd.h ] ; then \ @@ -86,8 +82,8 @@ headers: dummy echo " "; \ sleep 10; \ fi; - @ln -s $(KERNEL_SOURCE)/include/linux include/linux - @ln -s ../libc/sysdeps/linux/$(TARGET_ARCH)/bits include/bits + @ln -fs $(KERNEL_SOURCE)/include/linux include/linux + @ln -fs ../libc/sysdeps/linux/$(TARGET_ARCH)/bits include/bits (cd include/bits; ln -sf ../../../../../uClibc_config.h uClibc_config.h) $(MAKE) -C libc/sysdeps/linux/$(TARGET_ARCH) headers @@ -173,54 +169,70 @@ $(patsubst %, _dir_%, $(DIRS)) : dummy tags: ctags -R -install: install_dev +install: install_dev install_runtime install_gcc -# Installs shared libraries for a target. +# install_target: +# Installs run-time libraries and helper apps (ldconfig) to the +# locations that one would expect on a host that is running uClibc +# as the primary libc. TARGET_PREFIX is the location of the root +# directory. install_target: ifeq ($(DO_SHARED),shared) - install -d $(TARGET_PREFIX)$(ROOT_DIR)/lib - cp -fa lib/*.so* $(TARGET_PREFIX)$(ROOT_DIR)/lib; - install -d $(TARGET_PREFIX)$(ROOT_DIR)/etc - install -d $(TARGET_PREFIX)$(ROOT_DIR)/sbin - install -d $(TARGET_PREFIX)$(ROOT_DIR)/usr/bin - cp -f ldso/util/ldd $(TARGET_PREFIX)$(ROOT_DIR)/usr/bin - cp -f ldso/util/ldconfig $(TARGET_PREFIX)$(ROOT_DIR)/sbin + install -d $(TARGET_PREFIX)/lib + install -d $(TARGET_PREFIX)/etc + install -d $(TARGET_PREFIX)/sbin + install -d $(TARGET_PREFIX)/usr/bin + install -m 644 lib/lib*-0.9.5.so $(TARGET_PREFIX)/lib + cp -a lib/*.so.* $(TARGET_PREFIX)/lib +ifeq ($(LDSO_PRESENT),$(TARGET_ARCH)) + install -m 755 lib/ld-uClibc-0.9.5.so $(TARGET_PREFIX)/lib + install -m 755 ldso/util/ldd $(TARGET_PREFIX)/usr/bin + install -m 755 ldso/util/ldconfig $(TARGET_PREFIX)/sbin +endif ifeq ($(NATIVE_ARCH), $(TARGET_ARCH)) - -@if [ -x ldso/util/ldconfig ] ; then ldso/util/ldconfig; fi +# -@if [ -x ldso/util/ldconfig ] ; then ldso/util/ldconfig; fi +endif +endif + +# install_runtime: +# Installs run-time libraries and helper apps (ldconfig) to the +# locations one would expect on a host that is running a different +# libary as the primary libc. +install_runtime: +ifeq ($(DO_SHARED),shared) + install -d $(DEVEL_PREFIX)/lib + install -d $(DEVEL_PREFIX)/etc + install -d $(DEVEL_PREFIX)/bin + install -m 644 lib/lib*-0.9.5.so $(DEVEL_PREFIX)/lib + cp -a lib/*.so.* $(DEVEL_PREFIX)/lib +ifeq ($(LDSO_PRESENT),$(TARGET_ARCH)) + install -m 755 lib/ld-uClibc-0.9.5.so $(DEVEL_PREFIX)/lib + install -m 755 ldso/util/ldd $(DEVEL_PREFIX)/bin + install -m 755 ldso/util/ldconfig $(DEVEL_PREFIX)/bin + install -d $(PREFIX)/bin + ln -fs $(DEVEL_PREFIX)/bin/ldd $(PREFIX)/bin/$(TARGET_ARCH)-uclibc-ldd + install -d $(PREFIX)/sbin + ln -fs $(DEVEL_PREFIX)/sbin/ldconfig $(PREFIX)/sbin/$(TARGET_ARCH)-uclibc-ldconfig endif endif -# Installs development library and headers -# This is done with the assumption that it can blow away anything -# in $(DEVEL_PREFIX)$(ROOT_DIR)/include. Probably true only if you're using -# a packaging system. +# install_dev: +# Installs header files and development library links. +# DEVEL_PREFIX should be $(PREFIX)/$(target)-linux-uclibc/ install_dev: - install -d $(DEVEL_PREFIX)$(ROOT_DIR)/usr/lib - cp -fa lib/*.[ao] $(DEVEL_PREFIX)$(ROOT_DIR)/usr/lib; + install -d $(DEVEL_PREFIX)/lib + install -m 644 lib/*.[ao] $(DEVEL_PREFIX)/lib/ ifeq ($(DO_SHARED),shared) - install -d $(DEVEL_PREFIX)$(ROOT_DIR)/lib - cp -fa lib/*.so* $(DEVEL_PREFIX)$(ROOT_DIR)/lib; - install -d $(DEVEL_PREFIX)$(ROOT_DIR)/etc - install -d $(DEVEL_PREFIX)$(ROOT_DIR)/sbin - install -d $(DEVEL_PREFIX)$(ROOT_DIR)/usr/bin - cp -f ldso/util/ldd $(DEVEL_PREFIX)$(ROOT_DIR)/usr/bin - cp -f ldso/util/ldconfig $(DEVEL_PREFIX)$(ROOT_DIR)/sbin + find lib/ -type l -name '*.so' -exec cp -a {} $(DEVEL_PREFIX)/lib ';' ifeq ($(NATIVE_ARCH), $(TARGET_ARCH)) - -@if [ -x ldso/util/ldconfig ] ; then ldso/util/ldconfig; fi +# -@if [ -x ldso/util/ldconfig ] ; then ldso/util/ldconfig; fi endif endif - install -d $(DEVEL_PREFIX)$(ROOT_DIR)/etc - install -d $(DEVEL_PREFIX)$(ROOT_DIR)/usr/include - install -d $(DEVEL_PREFIX)$(ROOT_DIR)/usr/include/bits - rm -f $(DEVEL_PREFIX)$(ROOT_DIR)/usr/include/asm - rm -f $(DEVEL_PREFIX)$(ROOT_DIR)/usr/include/linux - ln -s $(KERNEL_SOURCE)/include/asm $(DEVEL_PREFIX)$(ROOT_DIR)/usr/include/asm - ln -s $(KERNEL_SOURCE)/include/linux $(DEVEL_PREFIX)$(ROOT_DIR)/usr/include/linux - find include/ -type f -depth -not -path "*CVS*" -exec install \ - -D -m 644 {} $(DEVEL_PREFIX)$(ROOT_DIR)/usr/'{}' ';' - find include/bits/ -type f -depth -not -path "*CVS*" -exec install \ - -D -m 644 {} $(DEVEL_PREFIX)$(ROOT_DIR)/usr/'{}' ';' - install -m 644 include/bits/uClibc_config.h $(DEVEL_PREFIX)$(ROOT_DIR)/usr/include/bits/ + install -d $(DEVEL_PREFIX)/include + find include/ -name '*.h' -depth -follow -exec install \ + -D -m 644 {} $(DEVEL_PREFIX)/'{}' ';' + +install_gcc: $(MAKE) -C extra/gcc-uClibc install clean: diff --git a/README b/README index 4e3ff9aec..3581e6502 100644 --- a/README +++ b/README @@ -1,20 +1,56 @@ -To build and install the uClibc development environment, -1) cp ./extra/Configs/Config. ./Config -2) Edit ./Config for your setup. -3) make -4) make install_dev (as root if necessary, depending on your Config) +* Configuration: + cp ./extra/Configs/Config. .Config -To install the runtime environment, - make install_target (again, as root if necessary) +Then edit ./Config for your setup. In particular, modify +CROSS and KERNEL_SOURCE as necessary. You may also want +to modify PREFIX if you want to install the development +environment to /usr/local/ or elsewhere. By default, the +development environment is installed into /usr and +/usr/-linux-uclibc/. + + +* Building: + + make + + +* Installing the development environment: + +(As root, if necessary,) + + make install + +This will install the header files, libraries, and the gcc +wrapper into the directories defined in Config. + +If you are targetting the same architecture as the host machine, +you may want to add a link from /lib/ld-uclibc.0 to the location +where ld-uclibc.0 was installed. This allows you to run binaries +compiled against uClibc without contaminating /lib too much. + + +* Installing the target runtime environment: + +(As root, if necessary,) + + make TARGET_PREFIX=`pwd`/_install install_target + +This installs only the files that are necessary to run binaries +compiled against uClibc. Hint: You really don't want to install +the target runtime environment on the host machine. + + +* Using uClibc: To compile programs with uClibc, - export PATH={uClibc DEVEL_PREFIX/ROOT_DIR}/bin:$PATH + export PATH={uClibc DEVEL_PREFIX}/bin:$PATH and then just ./configure and make as usual. Note: You may also want to look at extra/gcc-uclibc/gcc-uclibc.c for additional information concerning what options and environment variables the gcc wrapper handles. + diff --git a/Rules.mak b/Rules.mak index 7b8223950..38408731e 100644 --- a/Rules.mak +++ b/Rules.mak @@ -30,7 +30,7 @@ MINOR_VERSION=9.5 LIBNAME=libc.a SHARED_FULLNAME=libuClibc-$(MAJOR_VERSION).$(MINOR_VERSION).so SHARED_MAJORNAME=libc.so.$(MAJOR_VERSION) -UCLIBC_LDSO=ld-uclibc.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") @@ -65,12 +65,14 @@ else TARGET_LDFLAGS = --uclibc-use-build-dir -s -Wl,-warn-common endif ifeq ($(strip $(DOPIC)),true) - CFLAGS += -fPIC -D__PIC__ + CFLAGS += -fPIC endif -ifndef $(PREFIX) - PREFIX = `pwd`/_install +ifndef PREFIX + PREFIX = `pwd`/_install/ + DEVEL_PREFIX = $(PREFIX) + TARGET_PREFIX = $(PREFIX) 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') @@ -90,10 +92,12 @@ endif ifeq ($(LDSO_PRESENT), $(TARGET_ARCH)) LDSO=$(TOPDIR)lib/$(UCLIBC_LDSO) - DYNAMIC_LINKER=$(ROOT_DIR)/lib/$(UCLIBC_LDSO) + DYNAMIC_LINKER=/lib/$(UCLIBC_LDSO) + BUILD_DYNAMIC_LINKER=$(shell cd $(TOPDIR)lib; pwd)/$(UCLIBC_LDSO) else LDSO=$(SYSTEM_LDSO) DYNAMIC_LINKER=$(SYSTEM_LDSO) + BUILD_DYNAMIC_LINKER=$(shell cd $(TOPDIR)lib; pwd)/$(UCLIBC_LDSO) endif # Disable libm if HAS_FLOATING_POINT isn't true. diff --git a/extra/Configs/Config.arm b/extra/Configs/Config.arm index 408a23f60..d47d3c033 100644 --- a/extra/Configs/Config.arm +++ b/extra/Configs/Config.arm @@ -139,22 +139,31 @@ INCLUDE_IPV6 = false # If you want to compile the library as PIC code, turn this on. DOPIC = false -# ROOT_DIR is the base directory which will be compiled into the uClibc -# runtime environment. When compiled as a shared library, the shared -# library loader will look in /lib and /usr/lib -# for shared libraries. +# PREFIX is the directory prefix that is applied to all installed +# files. Typically, it is set to /usr or /usr/local, although it +# could also be /opt/vendor_name_here/some/random/path/. The +# install_runtime makefile target installs a few symbolic links +# based on PREFIX, not DEVEL_PREFIX. # -# DEVEL_PREFIX is the base directory which will be compiled into the uClibc -# development environment. The uClibc development environment will -# look for the uClibc header files under /usr/include, -# and for static libs and crt0.o in /usr/lib. -# Also, 'make install' will install the compiler tools to -# /bin and /usr/bin. -# -# TARGET_PREFIX is the directory under which 'make install' will install the -# uClibc runtime environment. This path does not get compiled into anything, -# and is provided simply to make it easier to build standalone target systems. -# Note: This doesn't do anything if there are no shared libs. -DEVEL_PREFIX = -ROOT_DIR = /usr/$(TARGET_ARCH)-linux-uclibc -TARGET_PREFIX = +# DEVEL_PREFIX is the directory into which the development environment +# will be installed. Include files are installed into +# $(DEVEL_PREFIX)/include, libraries into $(DEVEL_PREFIX)/lib, etc. +# This directory is compiled into the uclibc cross compiler spoofer. +# Generally, DEVEL_PREFIX should be $(PREFIX)/$(TARGET_ARCH)-uclibc-linux. +# DEVEL_PREFIX is used by the Makefile install targets install_gcc, +# install_dev, and install_runtime. +# +# TARGET_PREFIX is the directory into which the target runtime +# environment is installed. The target runtime environment is +# what one would use for a embedded system where uclibc is the +# native libaray. This will typically be a staging area for +# creating a root filesystem for the target system, so the default +# is in the local directory. +# +# If you want to install to a temporary directory before copying +# files to their final location, you can change PREFIX after build +# but before 'make install'. +PREFIX = /usr +DEVEL_PREFIX = $(PREFIX)/$(TARGET_ARCH)-linux-uclibc +TARGET_PREFIX = $(TOPDIR)/_install + diff --git a/extra/Configs/Config.cross.arm.uclinux b/extra/Configs/Config.cross.arm.uclinux index f61a8d2dd..ea6fcd16b 100644 --- a/extra/Configs/Config.cross.arm.uclinux +++ b/extra/Configs/Config.cross.arm.uclinux @@ -139,22 +139,31 @@ INCLUDE_IPV6 = false # If you want to compile the library as PIC code, turn this on. DOPIC = false -# ROOT_DIR is the base directory which will be compiled into the uClibc -# runtime environment. When compiled as a shared library, the shared -# library loader will look in /lib and /usr/lib -# for shared libraries. +# PREFIX is the directory prefix that is applied to all installed +# files. Typically, it is set to /usr or /usr/local, although it +# could also be /opt/vendor_name_here/some/random/path/. The +# install_runtime makefile target installs a few symbolic links +# based on PREFIX, not DEVEL_PREFIX. # -# DEVEL_PREFIX is the base directory which will be compiled into the uClibc -# development environment. The uClibc development environment will -# look for the uClibc header files under /usr/include, -# and for static libs and crt0.o in /usr/lib. -# Also, 'make install' will install the compiler tools to -# /bin and /usr/bin. -# -# TARGET_PREFIX is the directory under which 'make install' will install the -# uClibc runtime environment. This path does not get compiled into anything, -# and is provided simply to make it easier to build standalone target systems. -# Note: This doesn't do anything if there are no shared libs. -DEVEL_PREFIX = /opt/uClinux/arm-elf -ROOT_DIR = /opt/uClinux/arm-elf -TARGET_PREFIX = /opt/uClinux/arm-elf +# DEVEL_PREFIX is the directory into which the development environment +# will be installed. Include files are installed into +# $(DEVEL_PREFIX)/include, libraries into $(DEVEL_PREFIX)/lib, etc. +# This directory is compiled into the uclibc cross compiler spoofer. +# Generally, DEVEL_PREFIX should be $(PREFIX)/$(TARGET_ARCH)-uclibc-linux. +# DEVEL_PREFIX is used by the Makefile install targets install_gcc, +# install_dev, and install_runtime. +# +# TARGET_PREFIX is the directory into which the target runtime +# environment is installed. The target runtime environment is +# what one would use for a embedded system where uclibc is the +# native libaray. This will typically be a staging area for +# creating a root filesystem for the target system, so the default +# is in the local directory. +# +# If you want to install to a temporary directory before copying +# files to their final location, you can change PREFIX after build +# but before 'make install'. +PREFIX = /opt/uClinux +DEVEL_PREFIX = $(PREFIX)/$(TARGET_ARCH)-elf +TARGET_PREFIX = $(TOPDIR)/_install + diff --git a/extra/Configs/Config.i386 b/extra/Configs/Config.i386 index b383ebda8..387240fdc 100644 --- a/extra/Configs/Config.i386 +++ b/extra/Configs/Config.i386 @@ -139,23 +139,31 @@ INCLUDE_IPV6 = false # If you want to compile the library as PIC code, turn this on. DOPIC = false -# ROOT_DIR is the base directory which will be compiled into the uClibc -# runtime environment. When compiled as a shared library, the shared -# library loader will look in /lib and /usr/lib -# for shared libraries. +# PREFIX is the directory prefix that is applied to all installed +# files. Typically, it is set to /usr or /usr/local, although it +# could also be /opt/vendor_name_here/some/random/path/. The +# install_runtime makefile target installs a few symbolic links +# based on PREFIX, not DEVEL_PREFIX. # -# DEVEL_PREFIX is the base directory which will be compiled into the uClibc -# development environment. The uClibc development environment will -# look for the uClibc header files under /usr/include, -# and for static libs and crt0.o in /usr/lib. -# Also, 'make install' will install the compiler tools to -# /bin and /usr/bin. -# -# TARGET_PREFIX is the directory under which 'make install' will install the -# uClibc runtime environment. This path does not get compiled into anything, -# and is provided simply to make it easier to build standalone target systems. -# Note: This doesn't do anything if there are no shared libs. - -DEVEL_PREFIX = -ROOT_DIR = /usr/$(TARGET_ARCH)-linux-uclibc -TARGET_PREFIX = +# DEVEL_PREFIX is the directory into which the development environment +# will be installed. Include files are installed into +# $(DEVEL_PREFIX)/include, libraries into $(DEVEL_PREFIX)/lib, etc. +# This directory is compiled into the uclibc cross compiler spoofer. +# Generally, DEVEL_PREFIX should be $(PREFIX)/$(TARGET_ARCH)-uclibc-linux. +# DEVEL_PREFIX is used by the Makefile install targets install_gcc, +# install_dev, and install_runtime. +# +# TARGET_PREFIX is the directory into which the target runtime +# environment is installed. The target runtime environment is +# what one would use for a embedded system where uclibc is the +# native libaray. This will typically be a staging area for +# creating a root filesystem for the target system, so the default +# is in the local directory. +# +# If you want to install to a temporary directory before copying +# files to their final location, you can change PREFIX after build +# but before 'make install'. +PREFIX = /usr +DEVEL_PREFIX = $(PREFIX)/$(TARGET_ARCH)-linux-uclibc +TARGET_PREFIX = $(TOPDIR)/_install + diff --git a/extra/Configs/Config.m68k b/extra/Configs/Config.m68k index dc6e107dc..ef8f4045d 100644 --- a/extra/Configs/Config.m68k +++ b/extra/Configs/Config.m68k @@ -139,27 +139,6 @@ INCLUDE_IPV6 = false # If you want to compile the library as PIC code, turn this on. DOPIC = false -# ROOT_DIR is the base directory which will be compiled into the uClibc -# runtime environment. When compiled as a shared library, the shared -# library loader will look in /lib and /usr/lib -# for shared libraries. -# -# DEVEL_PREFIX is the base directory which will be compiled into the uClibc -# development environment. The uClibc development environment will -# look for the uClibc header files under /usr/include, -# and for static libs and crt0.o in /usr/lib. -# Also, 'make install' will install the compiler tools to -# /bin and /usr/bin. -# -# TARGET_PREFIX is the directory under which 'make install' will install the -# uClibc runtime environment. This path does not get compiled into anything, -# and is provided simply to make it easier to build standalone target systems. -# Note: This doesn't do anything if there are no shared libs. - -DEVEL_PREFIX = -ROOT_DIR = /opt/uClinux/$(TARGET_ARCH)-pic-elf -TARGET_PREFIX = - # # ARCH_CFLAGS if your have something special to add to the CFLAGS # @@ -173,3 +152,32 @@ ARCH_CFLAGS2 = -I$(KERNEL_SOURCE)/include # OPTIMIZATION = $(DEBUG_CFLAGS) + +# PREFIX is the directory prefix that is applied to all installed +# files. Typically, it is set to /usr or /usr/local, although it +# could also be /opt/vendor_name_here/some/random/path/. The +# install_runtime makefile target installs a few symbolic links +# based on PREFIX, not DEVEL_PREFIX. +# +# DEVEL_PREFIX is the directory into which the development environment +# will be installed. Include files are installed into +# $(DEVEL_PREFIX)/include, libraries into $(DEVEL_PREFIX)/lib, etc. +# This directory is compiled into the uclibc cross compiler spoofer. +# Generally, DEVEL_PREFIX should be $(PREFIX)/$(TARGET_ARCH)-uclibc-linux. +# DEVEL_PREFIX is used by the Makefile install targets install_gcc, +# install_dev, and install_runtime. +# +# TARGET_PREFIX is the directory into which the target runtime +# environment is installed. The target runtime environment is +# what one would use for a embedded system where uclibc is the +# native libaray. This will typically be a staging area for +# creating a root filesystem for the target system, so the default +# is in the local directory. +# +# If you want to install to a temporary directory before copying +# files to their final location, you can change PREFIX after build +# but before 'make install'. +PREFIX = /opt/uClinux +DEVEL_PREFIX = $(PREFIX)/$(TARGET_ARCH)-elf +TARGET_PREFIX = $(TOPDIR)/_install + diff --git a/extra/Configs/Config.m68k.coff b/extra/Configs/Config.m68k.coff index c0bbd3f77..8fb8b83f2 100644 --- a/extra/Configs/Config.m68k.coff +++ b/extra/Configs/Config.m68k.coff @@ -139,27 +139,6 @@ INCLUDE_IPV6 = false # If you want to compile the library as PIC code, turn this on. DOPIC = false -# ROOT_DIR is the base directory which will be compiled into the uClibc -# runtime environment. When compiled as a shared library, the shared -# library loader will look in /lib and /usr/lib -# for shared libraries. -# -# DEVEL_PREFIX is the base directory which will be compiled into the uClibc -# development environment. The uClibc development environment will -# look for the uClibc header files under /usr/include, -# and for static libs and crt0.o in /usr/lib. -# Also, 'make install' will install the compiler tools to -# /bin and /usr/bin. -# -# TARGET_PREFIX is the directory under which 'make install' will install the -# uClibc runtime environment. This path does not get compiled into anything, -# and is provided simply to make it easier to build standalone target systems. -# Note: This doesn't do anything if there are no shared libs. - -DEVEL_PREFIX = -ROOT_DIR = /opt/uClinux -TARGET_PREFIX = - # # ARCH_CFLAGS if your have something special to add to the CFLAGS # @@ -175,3 +154,33 @@ OPTIMIZATION = $(DEBUG_CFLAGS) # This is a COFF compiler (ick), so disable all the cool stuff HAVE_ELF = false + +# PREFIX is the directory prefix that is applied to all installed +# files. Typically, it is set to /usr or /usr/local, although it +# could also be /opt/vendor_name_here/some/random/path/. The +# install_runtime makefile target installs a few symbolic links +# based on PREFIX, not DEVEL_PREFIX. +# +# DEVEL_PREFIX is the directory into which the development environment +# will be installed. Include files are installed into +# $(DEVEL_PREFIX)/include, libraries into $(DEVEL_PREFIX)/lib, etc. +# This directory is compiled into the uclibc cross compiler spoofer. +# Generally, DEVEL_PREFIX should be $(PREFIX)/$(TARGET_ARCH)-uclibc-linux. +# DEVEL_PREFIX is used by the Makefile install targets install_gcc, +# install_dev, and install_runtime. +# +# TARGET_PREFIX is the directory into which the target runtime +# environment is installed. The target runtime environment is +# what one would use for a embedded system where uclibc is the +# native libaray. This will typically be a staging area for +# creating a root filesystem for the target system, so the default +# is in the local directory. +# +# If you want to install to a temporary directory before copying +# files to their final location, you can change PREFIX after build +# but before 'make install'. + +PREFIX = /opt/uClinux +DEVEL_PREFIX = $(PREFIX)/$(TARGET_ARCH)-coff +TARGET_PREFIX = $(TOPDIR)/_install + diff --git a/extra/Configs/Config.mips b/extra/Configs/Config.mips index 163a9aa4e..7c111a505 100644 --- a/extra/Configs/Config.mips +++ b/extra/Configs/Config.mips @@ -139,23 +139,31 @@ INCLUDE_IPV6 = false # If you want to compile the library as PIC code, turn this on. DOPIC = false -# ROOT_DIR is the base directory which will be compiled into the uClibc -# runtime environment. When compiled as a shared library, the shared -# library loader will look in /lib and /usr/lib -# for shared libraries. +# PREFIX is the directory prefix that is applied to all installed +# files. Typically, it is set to /usr or /usr/local, although it +# could also be /opt/vendor_name_here/some/random/path/. The +# install_runtime makefile target installs a few symbolic links +# based on PREFIX, not DEVEL_PREFIX. # -# DEVEL_PREFIX is the base directory which will be compiled into the uClibc -# development environment. The uClibc development environment will -# look for the uClibc header files under /usr/include, -# and for static libs and crt0.o in /usr/lib. -# Also, 'make install' will install the compiler tools to -# /bin and /usr/bin. -# -# TARGET_PREFIX is the directory under which 'make install' will install the -# uClibc runtime environment. This path does not get compiled into anything, -# and is provided simply to make it easier to build standalone target systems. -# Note: This doesn't do anything if there are no shared libs. - -DEVEL_PREFIX = -ROOT_DIR = /usr/$(TARGET_ARCH)-linux-uclibc -TARGET_PREFIX = +# DEVEL_PREFIX is the directory into which the development environment +# will be installed. Include files are installed into +# $(DEVEL_PREFIX)/include, libraries into $(DEVEL_PREFIX)/lib, etc. +# This directory is compiled into the uclibc cross compiler spoofer. +# Generally, DEVEL_PREFIX should be $(PREFIX)/$(TARGET_ARCH)-uclibc-linux. +# DEVEL_PREFIX is used by the Makefile install targets install_gcc, +# install_dev, and install_runtime. +# +# TARGET_PREFIX is the directory into which the target runtime +# environment is installed. The target runtime environment is +# what one would use for a embedded system where uclibc is the +# native libaray. This will typically be a staging area for +# creating a root filesystem for the target system, so the default +# is in the local directory. +# +# If you want to install to a temporary directory before copying +# files to their final location, you can change PREFIX after build +# but before 'make install'. +PREFIX = /usr +DEVEL_PREFIX = $(PREFIX)/$(TARGET_ARCH)-linux-uclibc +TARGET_PREFIX = $(TOPDIR)/_install + diff --git a/extra/Configs/Config.mipsel b/extra/Configs/Config.mipsel index 163a9aa4e..7c111a505 100644 --- a/extra/Configs/Config.mipsel +++ b/extra/Configs/Config.mipsel @@ -139,23 +139,31 @@ INCLUDE_IPV6 = false # If you want to compile the library as PIC code, turn this on. DOPIC = false -# ROOT_DIR is the base directory which will be compiled into the uClibc -# runtime environment. When compiled as a shared library, the shared -# library loader will look in /lib and /usr/lib -# for shared libraries. +# PREFIX is the directory prefix that is applied to all installed +# files. Typically, it is set to /usr or /usr/local, although it +# could also be /opt/vendor_name_here/some/random/path/. The +# install_runtime makefile target installs a few symbolic links +# based on PREFIX, not DEVEL_PREFIX. # -# DEVEL_PREFIX is the base directory which will be compiled into the uClibc -# development environment. The uClibc development environment will -# look for the uClibc header files under /usr/include, -# and for static libs and crt0.o in /usr/lib. -# Also, 'make install' will install the compiler tools to -# /bin and /usr/bin. -# -# TARGET_PREFIX is the directory under which 'make install' will install the -# uClibc runtime environment. This path does not get compiled into anything, -# and is provided simply to make it easier to build standalone target systems. -# Note: This doesn't do anything if there are no shared libs. - -DEVEL_PREFIX = -ROOT_DIR = /usr/$(TARGET_ARCH)-linux-uclibc -TARGET_PREFIX = +# DEVEL_PREFIX is the directory into which the development environment +# will be installed. Include files are installed into +# $(DEVEL_PREFIX)/include, libraries into $(DEVEL_PREFIX)/lib, etc. +# This directory is compiled into the uclibc cross compiler spoofer. +# Generally, DEVEL_PREFIX should be $(PREFIX)/$(TARGET_ARCH)-uclibc-linux. +# DEVEL_PREFIX is used by the Makefile install targets install_gcc, +# install_dev, and install_runtime. +# +# TARGET_PREFIX is the directory into which the target runtime +# environment is installed. The target runtime environment is +# what one would use for a embedded system where uclibc is the +# native libaray. This will typically be a staging area for +# creating a root filesystem for the target system, so the default +# is in the local directory. +# +# If you want to install to a temporary directory before copying +# files to their final location, you can change PREFIX after build +# but before 'make install'. +PREFIX = /usr +DEVEL_PREFIX = $(PREFIX)/$(TARGET_ARCH)-linux-uclibc +TARGET_PREFIX = $(TOPDIR)/_install + diff --git a/extra/Configs/Config.powerpc b/extra/Configs/Config.powerpc index 659231db9..1bc4978d6 100644 --- a/extra/Configs/Config.powerpc +++ b/extra/Configs/Config.powerpc @@ -35,7 +35,7 @@ TARGET_ARCH=powerpc # If you are running a cross compiler, you may want to set this # to something more interesting... NATIVE_CC = gcc -CROSS = #powerpc-linux- +CROSS = #$(TARGET_ARCH)-linux- CC = $(CROSS)gcc AR = $(CROSS)ar LD = $(CROSS)ld @@ -73,11 +73,11 @@ HAS_FLOATING_POINT = true # Set this to `false' if you don't have/need float functions in libm. # Set it to `true' otherwise, and make sure HAS_FLOATING_POINT is true as well. -HAS_LIBM_FLOAT = false +HAS_LIBM_FLOAT = true # Set this to `false' if you don't have/need double functions in libm. # Set it to `true' otherwise, and make sure HAS_FLOATING_POINT is true as well. -HAS_LIBM_DOUBLE = false +HAS_LIBM_DOUBLE = true # Set this to `false' if you don't have/need long double functions in libm. # Set it to `true' otherwise, and make sure HAS_FLOATING_POINT is true as well. @@ -139,23 +139,31 @@ INCLUDE_IPV6 = false # If you want to compile the library as PIC code, turn this on. DOPIC = false -# ROOT_DIR is the base directory which will be compiled into the uClibc -# runtime environment. When compiled as a shared library, the shared -# library loader will look in /lib and /usr/lib -# for shared libraries. +# PREFIX is the directory prefix that is applied to all installed +# files. Typically, it is set to /usr or /usr/local, although it +# could also be /opt/vendor_name_here/some/random/path/. The +# install_runtime makefile target installs a few symbolic links +# based on PREFIX, not DEVEL_PREFIX. # -# DEVEL_PREFIX is the base directory which will be compiled into the uClibc -# development environment. The uClibc development environment will -# look for the uClibc header files under /usr/include, -# and for static libs and crt0.o in /usr/lib. -# Also, 'make install' will install the compiler tools to -# /bin and /usr/bin. -# -# TARGET_PREFIX is the directory under which 'make install' will install the -# uClibc runtime environment. This path does not get compiled into anything, -# and is provided simply to make it easier to build standalone target systems. -# Note: This doesn't do anything if there are no shared libs. - -DEVEL_PREFIX = -ROOT_DIR = /usr/$(TARGET_ARCH)-linux-uclibc -TARGET_PREFIX = +# DEVEL_PREFIX is the directory into which the development environment +# will be installed. Include files are installed into +# $(DEVEL_PREFIX)/include, libraries into $(DEVEL_PREFIX)/lib, etc. +# This directory is compiled into the uclibc cross compiler spoofer. +# Generally, DEVEL_PREFIX should be $(PREFIX)/$(TARGET_ARCH)-uclibc-linux. +# DEVEL_PREFIX is used by the Makefile install targets install_gcc, +# install_dev, and install_runtime. +# +# TARGET_PREFIX is the directory into which the target runtime +# environment is installed. The target runtime environment is +# what one would use for a embedded system where uclibc is the +# native libaray. This will typically be a staging area for +# creating a root filesystem for the target system, so the default +# is in the local directory. +# +# If you want to install to a temporary directory before copying +# files to their final location, you can change PREFIX after build +# but before 'make install'. +PREFIX = /usr +DEVEL_PREFIX = $(PREFIX)/$(TARGET_ARCH)-linux-uclibc +TARGET_PREFIX = $(TOPDIR)/_install + diff --git a/extra/Configs/Config.sh b/extra/Configs/Config.sh index 9012530c2..6e36ccee8 100644 --- a/extra/Configs/Config.sh +++ b/extra/Configs/Config.sh @@ -160,23 +160,31 @@ INCLUDE_IPV6 = false # If you want to compile the library as PIC code, turn this on. DOPIC = false -# ROOT_DIR is the base directory which will be compiled into the uClibc -# runtime environment. When compiled as a shared library, the shared -# library loader will look in /lib and /usr/lib -# for shared libraries. +# PREFIX is the directory prefix that is applied to all installed +# files. Typically, it is set to /usr or /usr/local, although it +# could also be /opt/vendor_name_here/some/random/path/. The +# install_runtime makefile target installs a few symbolic links +# based on PREFIX, not DEVEL_PREFIX. # -# DEVEL_PREFIX is the base directory which will be compiled into the uClibc -# development environment. The uClibc development environment will -# look for the uClibc header files under /usr/include, -# and for static libs and crt0.o in /usr/lib. -# Also, 'make install' will install the compiler tools to -# /bin and /usr/bin. -# -# TARGET_PREFIX is the directory under which 'make install' will install the -# uClibc runtime environment. This path does not get compiled into anything, -# and is provided simply to make it easier to build standalone target systems. -# Note: This doesn't do anything if there are no shared libs. - -DEVEL_PREFIX = -ROOT_DIR = /opt/uClinux/$(TARGET_ARCH)-pic-elf -TARGET_PREFIX = +# DEVEL_PREFIX is the directory into which the development environment +# will be installed. Include files are installed into +# $(DEVEL_PREFIX)/include, libraries into $(DEVEL_PREFIX)/lib, etc. +# This directory is compiled into the uclibc cross compiler spoofer. +# Generally, DEVEL_PREFIX should be $(PREFIX)/$(TARGET_ARCH)-uclibc-linux. +# DEVEL_PREFIX is used by the Makefile install targets install_gcc, +# install_dev, and install_runtime. +# +# TARGET_PREFIX is the directory into which the target runtime +# environment is installed. The target runtime environment is +# what one would use for a embedded system where uclibc is the +# native libaray. This will typically be a staging area for +# creating a root filesystem for the target system, so the default +# is in the local directory. +# +# If you want to install to a temporary directory before copying +# files to their final location, you can change PREFIX after build +# but before 'make install'. +PREFIX = /opt/uClinux +DEVEL_PREFIX = $(PREFIX)/$(TARGET_ARCH)-elf +TARGET_PREFIX = $(TOPDIR)/_install + diff --git a/extra/gcc-uClibc/Makefile b/extra/gcc-uClibc/Makefile index 0eb6cbc8a..0e3829a3e 100644 --- a/extra/gcc-uClibc/Makefile +++ b/extra/gcc-uClibc/Makefile @@ -11,7 +11,6 @@ all: gcc-uClibc ld-uClibc gcc-uClibc.h: $(TOPDIR)/Config @echo "/* this file was autogenerated by make */" > gcc-uClibc.h - @echo "#define UCLIBC_ROOT_DIR " \"$(ROOT_DIR)\" >> gcc-uClibc.h @echo "#define UCLIBC_DEVEL_PREFIX " \"$(DEVEL_PREFIX)\" >> gcc-uClibc.h @echo "#define UCLIBC_BUILD_DIR " \"$(UCLIBC_DIR)/\" >> gcc-uClibc.h @echo "#define GCC_BIN " \"$(GCC_BIN)\" >> gcc-uClibc.h @@ -27,30 +26,24 @@ gcc-uClibc: gcc-uClibc.h gcc-uClibc.c ld-uClibc: @echo "#!/bin/sh" > $(TARGET_ARCH)-uclibc-ld @echo "# This file was autogenerated by make" >> $(TARGET_ARCH)-uclibc-ld - @echo "$(LD_BIN) -L- -L$(DEVEL_PREFIX)$(ROOT_DIR)/lib -L$(DEVEL_PREFIX)$(ROOT_DIR)/usr/lib "\ + @echo "$(LD_BIN) -L- -L$(DEVEL_PREFIX)/lib -L$(DEVEL_PREFIX)/usr/lib "\ "-L$(UCLIBC_DIR) \$$@" >> $(TARGET_ARCH)-uclibc-ld chmod a+x $(TARGET_ARCH)-uclibc-ld install: all - install -d $(DEVEL_PREFIX)$(ROOT_DIR)/bin; - install -d $(DEVEL_PREFIX)$(ROOT_DIR)/usr/bin; - if [ -x ./$(TARGET_ARCH)-uclibc-gcc ] ; then \ - install -m 755 $(TARGET_ARCH)-uclibc-gcc $(DEVEL_PREFIX)$(ROOT_DIR)/usr/bin/ ; \ - install -m 755 $(TARGET_ARCH)-uclibc-ld $(DEVEL_PREFIX)$(ROOT_DIR)/usr/bin/ ; \ - ln -fs ../usr/bin/$(TARGET_ARCH)-uclibc-gcc $(DEVEL_PREFIX)$(ROOT_DIR)/bin/cc; \ - ln -fs ../usr/bin/$(TARGET_ARCH)-uclibc-gcc $(DEVEL_PREFIX)$(ROOT_DIR)/bin/gcc; \ - ln -fs ../usr/bin/$(TARGET_ARCH)-uclibc-ld $(DEVEL_PREFIX)$(ROOT_DIR)/bin/ld; \ - ln -fs $(TARGET_ARCH)-uclibc-gcc $(DEVEL_PREFIX)$(ROOT_DIR)/usr/bin/$(TARGET_ARCH)-uclibc-cc; \ - fi; + install -d $(DEVEL_PREFIX)/bin; + install -d $(PREFIX)/bin; + install -m 755 $(TARGET_ARCH)-uclibc-gcc $(PREFIX)/bin/ + install -m 755 $(TARGET_ARCH)-uclibc-ld $(PREFIX)/bin/ + ln -fs $(TARGET_ARCH)-uclibc-gcc $(PREFIX)/bin/$(TARGET_ARCH)-uclibc-cc + ln -fs $(PREFIX)/bin/$(TARGET_ARCH)-uclibc-gcc $(DEVEL_PREFIX)/bin/gcc + ln -fs $(PREFIX)/bin/$(TARGET_ARCH)-uclibc-gcc $(DEVEL_PREFIX)/bin/cc + ln -fs $(PREFIX)/bin/$(TARGET_ARCH)-uclibc-ld $(DEVEL_PREFIX)/bin/ld for app in addr2line ar as cpp gasp nm objcopy \ - objdump ranlib size strings strip; do \ - ln -fs `which $(CROSS)$${app}` $(DEVEL_PREFIX)$(ROOT_DIR)/bin/$${app}; \ - done; - for app in addr2line ar as cpp gasp nm objcopy \ - objdump ranlib size strings strip; do \ - ln -fs `which $(CROSS)$${app}` $(DEVEL_PREFIX)$(ROOT_DIR)/usr/bin/$(TARGET_ARCH)-uclibc-$${app}; \ - done; - + objdump ranlib size strings strip; do \ + ln -fs `which $(CROSS)$${app}` $(DEVEL_PREFIX)/bin/$${app}; \ + ln -fs `which $(CROSS)$${app}` $(PREFIX)/bin/$(TARGET_ARCH)-uclibc-$${app}; \ + done clean: rm -f gcc-uClibc.h *-uclibc-gcc *-uclibc-ld core diff --git a/extra/gcc-uClibc/gcc-uClibc.c b/extra/gcc-uClibc/gcc-uClibc.c index 719cf621c..fc3a58dd7 100644 --- a/extra/gcc-uClibc/gcc-uClibc.c +++ b/extra/gcc-uClibc/gcc-uClibc.c @@ -78,31 +78,31 @@ #include "gcc-uClibc.h" static char *rpath_link[] = { - "-Wl,-rpath-link,"UCLIBC_DEVEL_PREFIX UCLIBC_ROOT_DIR"/lib", + "-Wl,-rpath-link,"UCLIBC_DEVEL_PREFIX"/lib", "-Wl,-rpath-link,"UCLIBC_BUILD_DIR"/lib" }; static char *rpath[] = { - "-Wl,-rpath,"UCLIBC_DEVEL_PREFIX UCLIBC_ROOT_DIR"/lib", + "-Wl,-rpath,"UCLIBC_DEVEL_PREFIX"/lib", "-Wl,-rpath,"UCLIBC_BUILD_DIR"/lib" }; static char *uClibc_inc[] = { - "-I"UCLIBC_DEVEL_PREFIX UCLIBC_ROOT_DIR"/usr/include/", + "-I"UCLIBC_DEVEL_PREFIX"/include/", "-I"UCLIBC_BUILD_DIR"/include/" }; static char *crt0_path[] = { - UCLIBC_DEVEL_PREFIX UCLIBC_ROOT_DIR"/usr/lib/crt0.o", + UCLIBC_DEVEL_PREFIX"/lib/crt0.o", UCLIBC_BUILD_DIR"/lib/crt0.o" }; static char *lib_path[] = { - "-L"UCLIBC_DEVEL_PREFIX UCLIBC_ROOT_DIR"/lib", + "-L"UCLIBC_DEVEL_PREFIX"/lib", "-L"UCLIBC_BUILD_DIR"/lib" }; -static char *usr_lib_path = "-L"UCLIBC_DEVEL_PREFIX UCLIBC_ROOT_DIR"/usr/lib"; +static char *usr_lib_path = "-L"UCLIBC_DEVEL_PREFIX"/lib"; static char static_linking[] = "-static"; static char nostdinc[] = "-nostdinc"; diff --git a/ldso/ldso/Makefile b/ldso/ldso/Makefile index 7128b0185..b0586fc30 100644 --- a/ldso/ldso/Makefile +++ b/ldso/ldso/Makefile @@ -28,8 +28,8 @@ TARGET_CFLAGS += #-DDL_DEBUG #-funroll-loops -LDSO_FULLNAME=ld-uclibc-$(MAJOR_VERSION).$(MINOR_VERSION).so -TARGET_CFLAGS+=-fPIC -D__PIC__ -DUCLIBC_ROOT_DIR=\"$(ROOT_DIR)\" -DUCLIBC_BUILD_DIR=\"$(shell cd $(TOPDIR); pwd)\" +LDSO_FULLNAME=ld-uClibc-$(MAJOR_VERSION).$(MINOR_VERSION).so +TARGET_CFLAGS+=-fPIC -D__PIC__ -DUCLIBC_ROOT_DIR=\"$(DEVEL_PREFIX)\" -DUCLIBC_BUILD_DIR=\"$(shell cd $(TOPDIR); pwd)\" CSRC= boot1.c hash.c readelflib1.c vsprintf.c $(TARGET_ARCH)/elfinterp.c COBJS=$(patsubst %.c,%.o, $(CSRC)) ASRC=$(shell ls $(TARGET_ARCH)/*.S) diff --git a/ldso/util/Makefile b/ldso/util/Makefile index 646fd69b6..f1485d50e 100644 --- a/ldso/util/Makefile +++ b/ldso/util/Makefile @@ -8,7 +8,7 @@ readsoname.o: readsoname.c readsoname2.c $(STRIPTOOL) -x -R .note -R .comment $*.o ldconfig.o: ldconfig.c - $(TARGET_CC) $(TARGET_CFLAGS) -DUCLIBC_ROOT_DIR=\"$(ROOT_DIR)\" \ + $(TARGET_CC) $(TARGET_CFLAGS) -DUCLIBC_ROOT_DIR=\"$(DEVEL_PREFIX)\" \ -c $< -o $@ $(STRIPTOOL) -x -R .note -R .comment $*.o @@ -21,7 +21,7 @@ ldconfig: ldconfig.o readsoname.o $(STRIPTOOL) -x -R .note -R .comment $@ ldd: ldd.c - $(TARGET_CC) $(TARGET_CFLAGS) -DUCLIBC_ROOT_DIR=\"$(ROOT_DIR)\" \ + $(TARGET_CC) $(TARGET_CFLAGS) -DUCLIBC_ROOT_DIR=\"$(DEVEL_PREFIX)\" \ -DUCLIBC_BUILD_DIR=\"$(shell cd $(TOPDIR); pwd)\" \ -static ldd.c -o $@ $(STRIPTOOL) -x -R .note -R .comment $@ -- cgit v1.2.3