From 6737908f74ff566748864548cf35bb1da8e64af6 Mon Sep 17 00:00:00 2001 From: Eric Andersen Date: Thu, 31 Oct 2002 18:20:21 +0000 Subject: Ok, this commit is _huge_ and its gonna change the world. I've been working on a new config system on and off for about 6 months now, but I've never been fully satisfied. Well, I'm finally am happy with the new config system, so here it is. This completely removes the old uClibc configuration system, and replaces it with an entirely new system based on LinuxKernelConf, from http://www.xs4all.nl/~zippel/lc/ As it turns out, Linus has just merged LinuxKernelConf into Linux 2.5.45, so it looks like I made the right choice. I have thus far updated only x86. I'll be updating the other architectures shortly. -Erik --- Rules.mak | 53 +++++++++++++++++++++++++++++++++-------------------- 1 file changed, 33 insertions(+), 20 deletions(-) (limited to 'Rules.mak') diff --git a/Rules.mak b/Rules.mak index 4c27771b6..3a8dcec56 100644 --- a/Rules.mak +++ b/Rules.mak @@ -21,22 +21,41 @@ # along with this program; if not, write to the Free Software Foundation, Inc., # 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA --include $(TOPDIR)Config +# If you are running a cross compiler, you may want to set this +# to something more interesting... Target architecture is determined +# by asking this compiler what arch it compiles stuff for. +CROSS= +CC = $(CROSS)gcc-3.2 +AR = $(CROSS)ar +LD = $(CROSS)ld +NM = $(CROSS)nm +STRIPTOOL = $(CROSS)strip +#STRIPTOOL = /bin/true + +# Select the compiler needed to build binaries for your development system +NATIVE_CC = gcc + # Be sure to update include/features.h when changing this... MAJOR_VERSION:=0 MINOR_VERSION:=9 SUBLEVEL:=15 VERSION:=$(MAJOR_VERSION).$(MINOR_VERSION).$(SUBLEVEL) +export MAJOR_VERSION MINOR_VERSION SUBLEVEL VERSION - -LIBNAME:=libc.a SHARED_FULLNAME:=libuClibc-$(MAJOR_VERSION).$(MINOR_VERSION).$(SUBLEVEL).so SHARED_MAJORNAME:=libc.so.$(MAJOR_VERSION) UCLIBC_LDSO:=ld-uClibc.so.$(MAJOR_VERSION) -LIBC:=$(TOPDIR)libc/libc.a +LIBNAME:=libc.a +LIBC:=$(TOPDIR)libc/$(LIBNAME) LIBGCC:=$(shell $(CC) $(LIBGCC_CFLAGS) -print-libgcc-file-name) +# Pull in the user's uClibc configuration +ifeq ($(filter $(noconfig_targets),$(MAKECMDGOALS)),) +include-config := 1 +-include $(TOPDIR).config +endif + # A nifty macro to make testing gcc features easier check_gcc=$(shell if $(CC) $(1) -S -o /dev/null -xc /dev/null > /dev/null 2>&1; \ then echo "$(1)"; else echo "$(2)"; fi) @@ -45,7 +64,7 @@ check_gcc=$(shell if $(CC) $(1) -S -o /dev/null -xc /dev/null > /dev/null 2>&1; AWK:=$(shell if [ -x /usr/bin/nawk ]; then echo "/usr/bin/nawk"; \ else echo "/usr/bin/awk"; fi) -NATIVE_ARCH:= ${shell uname -m | sed \ +NATIVE_ARCH:= $(shell uname -m | sed \ -e 's/i.86/i386/' \ -e 's/sparc.*/sparc/' \ -e 's/arm.*/arm/g' \ @@ -54,9 +73,9 @@ NATIVE_ARCH:= ${shell uname -m | sed \ -e 's/v850.*/v850/g' \ -e 's/sh[234].*/sh/' \ -e 's/mips.*/mips/' \ - } + ) ifeq ($(strip $(TARGET_ARCH)),) -TARGET_ARCH:=${shell $(CC) -dumpmachine | sed -e s'/-.*//' \ +TARGET_ARCH:=$(shell $(CC) -dumpmachine | sed -e s'/-.*//' \ -e 's/i.86/i386/' \ -e 's/sparc.*/sparc/' \ -e 's/arm.*/arm/g' \ @@ -66,7 +85,7 @@ TARGET_ARCH:=${shell $(CC) -dumpmachine | sed -e s'/-.*//' \ -e 's/sh[234]/sh/' \ -e 's/mips.*/mips/' \ -e 's/cris.*/cris/' \ - } + ) endif # Ensure consistent filename sort order @@ -80,7 +99,7 @@ ifndef OPTIMIZATION # use '-Os' optimization if available, else use -O2, allow Config to override OPTIMIZATION:= -OPTIMIZATION+=${call check_gcc,-Os,-O2} +OPTIMIZATION+=$(call check_gcc,-Os,-O2) ifeq ($(strip $(TARGET_ARCH)),arm) OPTIMIZATION+=-fstrict-aliasing endif @@ -100,7 +119,7 @@ CFLAGS:=$(WARNINGS) $(OPTIMIZATION) -fno-builtin -nostdinc $(CPUFLAGS) \ -I$(TOPDIR)include -iwithprefix include -I. -D_LIBC $(ARCH_CFLAGS) NATIVE_CFLAGS:=-O2 -Wall -ifeq ($(strip $(DODEBUG)),true) +ifeq ($(strip $(DODEBUG)),y) CFLAGS += -g LDFLAGS:= -shared --warn-common --warn-once -z combreloc STRIPTOOL:= true -Since_we_are_debugging @@ -109,27 +128,21 @@ else LDFLAGS := -s -shared --warn-common --warn-once -z combreloc endif -ifeq ($(strip $(HAVE_SHARED)),true) - DOPIC:=true +ifeq ($(strip $(HAVE_SHARED)),y) LIBRARY_CACHE:=#-DUSE_CACHE - ifeq ($(strip $(BUILD_UCLIBC_LDSO)),true) + ifeq ($(strip $(BUILD_UCLIBC_LDSO)),y) LDSO:=$(TOPDIR)lib/$(UCLIBC_LDSO) DYNAMIC_LINKER:=$(SHARED_LIB_LOADER_PATH)/$(UCLIBC_LDSO) - BUILD_DYNAMIC_LINKER:=${shell cd $(TOPDIR) && pwd}/lib/$(UCLIBC_LDSO) + BUILD_DYNAMIC_LINKER:=$(shell cd $(TOPDIR) && pwd)/lib/$(UCLIBC_LDSO) else LDSO:=$(SYSTEM_LDSO) - BUILD_UCLIBC_LDSO:=false DYNAMIC_LINKER:=/lib/$(notdir $(SYSTEM_LDSO)) BUILD_DYNAMIC_LINKER:=/lib/$(notdir $(SYSTEM_LDSO)) endif endif -ifeq ($(strip $(DOPIC)),true) +ifeq ($(strip $(DOPIC)),y) CFLAGS += -fPIC endif -# Currently locale support requires wide char support. -ifeq ($(strip $(HAS_LOCALE)),true) - HAS_WCHAR:=true -endif # TARGET_PREFIX is the directory under which which the uClibc runtime # environment will be installed and used on the target system. The -- cgit v1.2.3