1 # $Id: Makefile,v 1.1.1.1 2005/04/11 02:49:58 jack Exp $
4 # This file is included by the global makefile so that you can add your own
5 # architecture-specific flags and dependencies. Remember to do have actions
6 # for "archclean" and "archdep" for cleaning up and making dependencies for
9 # This file is subject to the terms and conditions of the GNU General Public
10 # License. See the file "COPYING" in the main directory of this archive
13 LD_SCRIPT=$(TOPDIR)/arch/cris/cris.ld
15 # A bug in ld prevents us from having a (constant-value) symbol in a
16 # "ORIGIN =" or "LENGTH =" expression. We fix that by generating a
17 # linker file with the symbolic part of those expressions evaluated.
18 # Unfortunately, there is trouble making vmlinux depend on anything we
19 # generate here, so we *always* regenerate the final linker script and
20 # replace the LD macro to get what we want. Thankfully(?) vmlinux is
21 # always rebuilt (due to calling make recursively and not knowing if
22 # anything was rebuilt).
23 # The shell script to build in some kind of dependency is really not
24 # necessary for reasons of speed. It's there because always
25 # regenerating stuff (even for incremental linking of subsystems!) is
26 # even more nauseating.
27 LD = if [ ! -e $(LD_SCRIPT).tmp -o $(LD_SCRIPT) -nt $(LD_SCRIPT).tmp ]; then \
28 sed -e s/@CONFIG_ETRAX_DRAM_VIRTUAL_BASE@/0x$(CONFIG_ETRAX_DRAM_VIRTUAL_BASE)/ \
29 -e s/@CONFIG_ETRAX_DRAM_SIZE_M@/$(CONFIG_ETRAX_DRAM_SIZE)/ \
30 < $(LD_SCRIPT) > $(LD_SCRIPT).tmp; \
32 fi && $(CROSS_COMPILE)ld -mcrislinux
34 LINKFLAGS = -T $(LD_SCRIPT).tmp
36 # objcopy is used to make binary images from the resulting linked file
38 OBJCOPY := $(CROSS_COMPILE)objcopy -O binary -R .note -R .comment -S
40 # -mlinux enables -march=v10, -fno-underscores, -D__linux__ among others
42 CFLAGS := $(CFLAGS) -mlinux -pipe
44 ifdef CONFIG_ETRAX_KGDB
45 CFLAGS := $(subst -fomit-frame-pointer,,$(CFLAGS)) -g
46 CFLAGS += -fno-omit-frame-pointer
51 HEAD := arch/cris/kernel/head.o
53 SUBDIRS += arch/cris/kernel arch/cris/mm arch/cris/lib arch/cris/drivers
54 ifdef CONFIG_ETRAX_AXISFLASHMAP
55 # only build this if axis flash map is used, because they depend on
56 # each others config options
57 SUBDIRS += arch/cris/boot/rescue
59 CORE_FILES += arch/cris/kernel/kernel.o arch/cris/mm/mm.o
60 DRIVERS += arch/cris/drivers/drivers.o
61 LIBGCC = $(shell $(CC) $(CFLAGS) -print-file-name=libgcc.a)
62 LIBS := $(TOPDIR)/arch/cris/lib/lib.a $(LIBS) $(TOPDIR)/arch/cris/lib/lib.a $(LIBGCC)
64 arch/cris/kernel: dummy
65 $(MAKE) linuxsubdirs SUBDIRS=arch/cris/kernel
68 $(MAKE) linuxsubdirs SUBDIRS=arch/cris/mm
70 MAKEBOOT = $(MAKE) -C arch/$(ARCH)/boot
73 $(OBJCOPY) vmlinux vmlinux.bin
76 cat vmlinux.bin cramfs.img >timage
79 cp vmlinux.bin simvmlinux.bin
81 # the following will remake timage without compiling the kernel
82 # it does of course require that all object files exist...
85 ## cramfs - Creates a cramfs image
86 mkcramfs -b 8192 -m romfs_meta.txt root cramfs.img
87 cat vmlinux.bin cramfs.img >timage
89 clinux: vmlinux.bin decompress.bin rescue.bin
92 @make -C arch/cris/boot/compressed decompress.bin
95 @make -C arch/cris/boot/rescue rescue.bin
98 ## zImage - Compressed kernel (gzip)
105 rm -f timage vmlinux.bin cramfs.img
106 rm -rf $(LD_SCRIPT).tmp