Temporary hack for Qemu and MIPSsim until they get a proper ELF loader.
[safe/jmp/linux-2.6] / arch / mips / Makefile
index d27b825..7527093 100644 (file)
@@ -52,6 +52,21 @@ ifdef CONFIG_CROSSCOMPILE
 CROSS_COMPILE          := $(tool-prefix)
 endif
 
+CHECKFLAGS-y                           += -D__linux__ -D__mips__ \
+                                          -D_ABIO32=1 \
+                                          -D_ABIN32=2 \
+                                          -D_ABI64=3
+CHECKFLAGS-$(CONFIG_32BIT)             += -D_MIPS_SIM=_ABIO32 \
+                                          -D_MIPS_SZLONG=32 \
+                                          -D__PTRDIFF_TYPE__=int
+CHECKFLAGS-$(CONFIG_64BIT)             += -m64 -D_MIPS_SIM=_ABI64 \
+                                          -D_MIPS_SZLONG=64 \
+                                          -D__PTRDIFF_TYPE__="long int"
+CHECKFLAGS-$(CONFIG_CPU_BIG_ENDIAN)    += -D__MIPSEB__
+CHECKFLAGS-$(CONFIG_CPU_LITTLE_ENDIAN) += -D__MIPSEL__
+
+CHECKFLAGS                             = $(CHECKFLAGS-y)
+
 ifdef CONFIG_BUILD_ELF64
 gas-abi                        = 64
 ld-emul                        = $(64bit-emul)
@@ -79,9 +94,18 @@ endif
 cflags-y                       += -I $(TOPDIR)/include/asm/gcc
 cflags-y                       += -G 0 -mno-abicalls -fno-pic -pipe
 cflags-y                       += $(call cc-option, -finline-limit=100000)
-LDFLAGS_vmlinux                        += -G 0 -static -n
+LDFLAGS_vmlinux                        += -G 0 -static -n -nostdlib
 MODFLAGS                       += -mlong-calls
 
+#
+# We explicitly add the endianness specifier if needed, this allows
+# to compile kernels with a toolchain for the other endianness. We
+# carefully avoid to add it redundantly because gcc 3.3/3.4 complains
+# when fed the toolchain default!
+#
+cflags-$(CONFIG_CPU_BIG_ENDIAN)                += $(shell $(CC) -dumpmachine |grep -q 'mips.*el-.*' && echo -EB)
+cflags-$(CONFIG_CPU_LITTLE_ENDIAN)     += $(shell $(CC) -dumpmachine |grep -q 'mips.*el-.*' || echo -EL)
+
 cflags-$(CONFIG_SB1XXX_CORELIS)        += -mno-sched-prolog -fno-omit-frame-pointer
 
 #
@@ -167,11 +191,11 @@ cflags-$(CONFIG_CPU_TX49XX)       += \
                        $(call set_gccflags,r4600,mips3,r4600,mips3,mips2)  \
                        -Wa,--trap
 
-cflags-$(CONFIG_CPU_MIPS32)    += \
+cflags-$(CONFIG_CPU_MIPS32_R1) += \
                        $(call set_gccflags,mips32,mips32,r4600,mips3,mips2) \
                        -Wa,--trap
 
-cflags-$(CONFIG_CPU_MIPS64)    += \
+cflags-$(CONFIG_CPU_MIPS64_R1) += \
                        $(call set_gccflags,mips64,mips64,r4600,mips3,mips2) \
                        -Wa,--trap
 
@@ -266,6 +290,13 @@ cflags-$(CONFIG_MIPS_PB1550)       += -Iinclude/asm-mips/mach-pb1x00
 load-$(CONFIG_MIPS_PB1550)     += 0xffffffff80100000
 
 #
+# AMD Alchemy Pb1200 eval board
+#
+libs-$(CONFIG_MIPS_PB1200)     += arch/mips/au1000/pb1200/
+cflags-$(CONFIG_MIPS_PB1200)   += -Iinclude/asm-mips/mach-pb1x00
+load-$(CONFIG_MIPS_PB1200)     += 0xffffffff80100000
+
+#
 # AMD Alchemy Db1000 eval board
 #
 libs-$(CONFIG_MIPS_DB1000)     += arch/mips/au1000/db1x00/
@@ -294,6 +325,13 @@ cflags-$(CONFIG_MIPS_DB1550)       += -Iinclude/asm-mips/mach-db1x00
 load-$(CONFIG_MIPS_DB1550)     += 0xffffffff80100000
 
 #
+# AMD Alchemy Db1200 eval board
+#
+libs-$(CONFIG_MIPS_DB1200)     += arch/mips/au1000/pb1200/
+cflags-$(CONFIG_MIPS_DB1200)   += -Iinclude/asm-mips/mach-db1x00
+load-$(CONFIG_MIPS_DB1200)     += 0xffffffff80100000
+
+#
 # AMD Alchemy Bosporus eval board
 #
 libs-$(CONFIG_MIPS_BOSPORUS)   += arch/mips/au1000/db1x00/
@@ -323,6 +361,7 @@ load-$(CONFIG_MIPS_XXS1500) += 0xffffffff80100000
 # Cobalt Server
 #
 core-$(CONFIG_MIPS_COBALT)     += arch/mips/cobalt/
+cflags-$(CONFIG_MIPS_COBALT)   += -Iinclude/asm-mips/cobalt
 load-$(CONFIG_MIPS_COBALT)     += 0xffffffff80080000
 
 #
@@ -673,7 +712,7 @@ drivers-$(CONFIG_OPROFILE)  += arch/mips/oprofile/
 
 ifdef CONFIG_LASAT
 rom.bin rom.sw: vmlinux
-       $(call descend,arch/mips/lasat/image,$@)
+       $(Q)$(MAKE) $(build)=arch/mips/lasat/image $@
 endif
 
 #
@@ -701,6 +740,18 @@ ifdef CONFIG_BOOT_ELF64
 all:   $(vmlinux-64)
 endif
 
+ifdef CONFIG_MIPS_ATLAS
+all:   vmlinux.srec
+endif
+
+ifdef CONFIG_MIPS_MALTA
+all:   vmlinux.srec
+endif
+
+ifdef CONFIG_MIPS_SEAD
+all:   vmlinux.srec
+endif
+
 ifdef CONFIG_SNI_RM200_PCI
 all:   vmlinux.ecoff
 endif
@@ -720,38 +771,7 @@ archclean:
        @$(MAKE) $(clean)=arch/mips/boot
        @$(MAKE) $(clean)=arch/mips/lasat
 
-# Generate <asm/offset.h
-#
-# The default rule is suffering from funny problems on MIPS so we using our
-# own ...
-#
-# ---------------------------------------------------------------------------
-
-define filechk_gen-asm-offset.h
-       (set -e; \
-        echo "#ifndef _ASM_OFFSET_H"; \
-        echo "#define _ASM_OFFSET_H"; \
-        echo "/*"; \
-        echo " * DO NOT MODIFY."; \
-        echo " *"; \
-        echo " * This file was generated by arch/$(ARCH)/Makefile"; \
-        echo " *"; \
-        echo " */"; \
-        echo ""; \
-        sed -ne "/^@@@/s///p"; \
-        echo "#endif /* _ASM_OFFSET_H */" )
-endef
-
-prepare: include/asm-$(ARCH)/offset.h
-
-arch/$(ARCH)/kernel/offset.s: include/asm include/linux/version.h \
-                                  include/config/MARKER
-
-include/asm-$(ARCH)/offset.h: arch/$(ARCH)/kernel/offset.s
-       $(call filechk,gen-asm-offset.h)
 
-CLEAN_FILES += include/asm-$(ARCH)/offset.h.tmp \
-              include/asm-$(ARCH)/offset.h \
-              vmlinux.32 \
+CLEAN_FILES += vmlinux.32 \
               vmlinux.64 \
               vmlinux.ecoff