OSDN Git Service

Fix the manditory typo in my last minute untested fix.
[uclinux-h8/uClibc.git] / Rules.mak
index c29a4e2..bca1dc8 100644 (file)
--- a/Rules.mak
+++ b/Rules.mak
@@ -31,8 +31,8 @@
 # your compiler is broken, you should not need to specify TARGET_ARCH
 #
 # Most people will set this stuff on the command line, i.e.
-#        make CROSS=mipsel-linux-
-# will build uClibc for 'mipsel'.
+#        make CROSS=arm-linux-
+# will build uClibc for 'arm'.
 
 ifndef CROSS
 CROSS=
@@ -58,7 +58,7 @@ HOSTCFLAGS=-O2 -Wall
 # this stuff alone.
 MAJOR_VERSION:=0
 MINOR_VERSION:=9
-SUBLEVEL:=22
+SUBLEVEL:=24
 VERSION:=$(MAJOR_VERSION).$(MINOR_VERSION).$(SUBLEVEL)
 # Ensure consistent sort order, 'gcc -print-search-dirs' behavior, etc. 
 LC_ALL:= C
@@ -79,35 +79,11 @@ endif
 check_gcc=$(shell if $(CC) $(1) -S -o /dev/null -xc /dev/null > /dev/null 2>&1; \
        then echo "$(1)"; else echo "$(2)"; fi)
 
-# check if we have nawk, otherwise user awk
-AWK:=$(shell if [ -x /usr/bin/nawk ]; then echo "/usr/bin/nawk"; \
-       else echo "/usr/bin/awk"; fi)
-
-HOST_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' \
-               -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'/-.*//' \
-               -e 's/i.86/i386/' \
-               -e 's/sparc.*/sparc/' \
-               -e 's/arm.*/arm/g' \
-               -e 's/m68k.*/m68k/' \
-               -e 's/ppc/powerpc/g' \
-               -e 's/v850.*/v850/g' \
-               -e 's/sh[234]/sh/' \
-               -e 's/mips-.*/mips/' \
-               -e 's/mipsel-.*/mipsel/' \
-               -e 's/cris.*/cris/' \
-               )
-endif
-export TARGET_ARCH
+# Make certain these contain a final "/", but no "//"s.
+TARGET_ARCH:=$(strip $(subst ",, $(strip $(TARGET_ARCH))))
+RUNTIME_PREFIX:=$(strip $(subst //,/, $(subst ,/, $(subst ",, $(strip $(RUNTIME_PREFIX))))))
+DEVEL_PREFIX:=$(strip $(subst //,/, $(subst ,/, $(subst ",, $(strip $(DEVEL_PREFIX))))))
+export RUNTIME_PREFIX DEVEL_PREFIX
 
 ARFLAGS:=r
 
@@ -151,6 +127,15 @@ ifeq ($(strip $(TARGET_ARCH)),arm)
        CPU_CFLAGS-$(CONFIG_ARM_XSCALE)+=-march=armv4 -Wa,-mcpu=xscale
 endif
 
+ifeq ($(strip $(TARGET_ARCH)),mips)
+       CPU_CFLAGS-$(CONFIG_MIPS_ISA_1)+=-mips1
+       CPU_CFLAGS-$(CONFIG_MIPS_ISA_2)+=-mips2 -mtune=mips2
+       CPU_CFLAGS-$(CONFIG_MIPS_ISA_3)+=-mips3 -mtune=mips3
+       CPU_CFLAGS-$(CONFIG_MIPS_ISA_4)+=-mips4 -mtune=mips4
+       CPU_CFLAGS-$(CONFIG_MIPS_ISA_MIPS32)+=-mips32 -mtune=mips32
+       CPU_CFLAGS-$(CONFIG_MIPS_ISA_MIPS64)+=-mips64 -mtune=mips32
+endif
+
 ifeq ($(strip $(TARGET_ARCH)),sh)
        OPTIMIZATION+=-fstrict-aliasing
        OPTIMIZATION+= $(call check_gcc,-mprefergot,)
@@ -193,6 +178,17 @@ OPTIMIZATION+=$(call check_gcc,-Os,-O2)
 XWARNINGS=$(subst ",, $(strip $(WARNINGS))) -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing
 XARCH_CFLAGS=$(subst ",, $(strip $(ARCH_CFLAGS)))
 CPU_CFLAGS=$(subst ",, $(strip $(CPU_CFLAGS-y)))
+
+LDADD_LIBFLOAT=
+ifeq ($(strip $(UCLIBC_HAS_SOFT_FLOAT)),y)
+# Add -msoft-float to the CPU_FLAGS since ldso and libdl ignore CFLAGS.
+# If -msoft-float isn't supported, we want an error anyway.
+    CPU_CFLAGS += -msoft-float
+ifeq ($(strip $(TARGET_ARCH)),arm)
+    LDADD_LIBFLOAT=-lfloat
+endif
+endif
+
 # Some nice CFLAGS to work with
 CFLAGS=$(XWARNINGS) $(OPTIMIZATION) $(XARCH_CFLAGS) $(CPU_CFLAGS) \
        -fno-builtin -nostdinc -D_LIBC -I$(TOPDIR)include -I.
@@ -218,24 +214,13 @@ ifeq ($(HAVE_SHARED),y)
     LIBRARY_CACHE:=#-DUSE_CACHE
     ifeq ($(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)
+       DYNAMIC_LINKER:=$(SHARED_LIB_LOADER_PREFIX)/$(UCLIBC_LDSO)
     else
        LDSO:=$(SYSTEM_LDSO)
        DYNAMIC_LINKER:=/lib/$(strip $(subst ",, $(notdir $(SYSTEM_LDSO))))
-       BUILD_DYNAMIC_LINKER:=/lib/$(strip $(subst ",, $(notdir $(SYSTEM_LDSO))))
    endif
 endif
 
-LDADD_LIBFLOAT=
-ifeq ($(strip $(UCLIBC_HAS_SOFT_FLOAT)),y)
-    CFLAGS += $(call check_gcc,-msoft-float,)
-    #LDFLAGS+= -Wa,-mno-fpu
-ifeq ($(strip $(TARGET_ARCH)),arm)
-    LDADD_LIBFLOAT=-lfloat
-endif
-endif
-
 CFLAGS_NOPIC:=$(CFLAGS)
 ifeq ($(DOPIC),y)
     CFLAGS += $(PICFLAG)
@@ -245,17 +230,6 @@ LIBGCC_CFLAGS ?= $(CFLAGS) $(CPU_CFLAGS-y)
 LIBGCC:=$(shell $(CC) $(LIBGCC_CFLAGS) -print-libgcc-file-name)
 LIBGCC_DIR:=$(dir $(LIBGCC))
 
-# TARGET_PREFIX is the directory under which which the uClibc runtime
-# environment will be installed and used on the target system.   The 
-# result will look something like the following:
-#   TARGET_PREFIX/
-#      lib/            <contains all runtime and static libs>
-#      usr/lib/        <this directory is searched for runtime libs>
-#      etc/            <weher the shared library cache and configuration 
-#                      information go if you enabled LIBRARY_CACHE above>
-# Very few people will need to change this value from the default...
-TARGET_PREFIX = /
-
 ########################################
 #
 # uClinux shared lib support
@@ -269,3 +243,5 @@ ifeq ($(CONFIG_BINFMT_SHARED_FLAT),y)
   SHARED_TARGET = lib/libc
 endif
 
+TARGET_ARCH:=$(strip $(subst ",, $(strip $(TARGET_ARCH))))
+