Merge branch 'for-linus' of git://www.jni.nu/cris
[pandora-kernel.git] / arch / cris / Makefile
1 #
2 # cris/Makefile
3 #
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
7 # this architecture
8 #
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
11 # for more details.
12
13 KBUILD_DEFCONFIG := etrax-100lx_v2_defconfig
14
15 arch-y := v10
16 arch-$(CONFIG_ETRAX_ARCH_V10) := v10
17 arch-$(CONFIG_ETRAX_ARCH_V32) := v32
18
19 # No config available for make clean etc
20 mach-y := fs
21 mach-$(CONFIG_CRIS_MACH_ARTPEC3) := a3
22 mach-$(CONFIG_ETRAXFS) := fs
23
24 ifneq ($(arch-y),)
25 SARCH := arch-$(arch-y)
26 else
27 SARCH :=
28 endif
29
30 ifneq ($(mach-y),)
31 MACH := mach-$(mach-y)
32 else
33 MACH :=
34 endif
35
36 LD = $(CROSS_COMPILE)ld -mcrislinux
37
38 OBJCOPYFLAGS := -O binary -R .note -R .comment -S
39
40 CPPFLAGS_vmlinux.lds = -DDRAM_VIRTUAL_BASE=0x$(CONFIG_ETRAX_DRAM_VIRTUAL_BASE)
41
42 KBUILD_AFLAGS += -mlinux -march=$(arch-y) -Iinclude/asm/arch/mach -Iinclude/asm/arch
43
44 KBUILD_CFLAGS += -mlinux -march=$(arch-y) -pipe -Iinclude/asm/arch/mach -Iinclude/asm/arch
45
46 ifdef CONFIG_FRAME_POINTER
47 KBUILD_CFLAGS := $(subst -fomit-frame-pointer,,$(KBUILD_CFLAGS)) -g
48 KBUILD_CFLAGS += -fno-omit-frame-pointer
49 endif
50
51 head-y := arch/$(ARCH)/$(SARCH)/kernel/head.o
52
53 LIBGCC = $(shell $(CC) $(KBUILD_CFLAGS) -print-file-name=libgcc.a)
54
55 core-y          += arch/$(ARCH)/kernel/ arch/$(ARCH)/mm/
56 core-y          += arch/$(ARCH)/$(SARCH)/kernel/ arch/$(ARCH)/$(SARCH)/mm/
57 ifdef CONFIG_ETRAX_ARCH_V32
58 core-y          += arch/$(ARCH)/$(SARCH)/$(MACH)/
59 endif
60 drivers-y       += arch/$(ARCH)/$(SARCH)/drivers/
61 libs-y          += arch/$(ARCH)/$(SARCH)/lib/ $(LIBGCC)
62
63 # cris source path
64 SRC_ARCH              = $(srctree)/arch/$(ARCH)
65 # cris object files path
66 OBJ_ARCH              = $(objtree)/arch/$(ARCH)
67
68 boot := arch/$(ARCH)/boot
69 MACHINE := arch/$(ARCH)/$(SARCH)
70
71 all: zImage
72
73 zImage Image: vmlinux
74         $(Q)$(MAKE) $(build)=$(boot) MACHINE=$(MACHINE) $(boot)/$@
75
76 archprepare: $(SRC_ARCH)/.links $(srctree)/include/asm-$(ARCH)/.arch FORCE
77
78 # Create some links to make all tools happy
79 $(SRC_ARCH)/.links:
80         @rm -rf $(SRC_ARCH)/drivers
81         @ln -sfn $(SARCH)/drivers $(SRC_ARCH)/drivers
82         @rm -rf $(SRC_ARCH)/boot
83         @ln -sfn $(SARCH)/boot $(SRC_ARCH)/boot
84         @rm -rf $(SRC_ARCH)/lib
85         @ln -sfn $(SARCH)/lib $(SRC_ARCH)/lib
86         @rm -f $(SRC_ARCH)/arch/mach
87         @rm -rf $(SRC_ARCH)/arch
88         @ln -sfn $(SARCH) $(SRC_ARCH)/arch
89 ifdef CONFIG_ETRAX_ARCH_V32
90         @ln -sfn ../$(SARCH)/$(MACH) $(SRC_ARCH)/arch/mach
91 endif
92         @rm -rf $(SRC_ARCH)/kernel/vmlinux.lds.S
93         @ln -sfn ../$(SARCH)/vmlinux.lds.S $(SRC_ARCH)/kernel/vmlinux.lds.S
94         @rm -rf $(SRC_ARCH)/kernel/asm-offsets.c
95         @ln -sfn ../$(SARCH)/kernel/asm-offsets.c $(SRC_ARCH)/kernel/asm-offsets.c
96         @touch $@
97
98 # Create link to sub arch includes
99 $(srctree)/include/asm-$(ARCH)/.arch: $(wildcard include/config/arch/*.h)
100         @echo '  SYMLINK include/asm-$(ARCH)/arch -> include/asm-$(ARCH)/$(SARCH)'
101         @rm -f $(srctree)/include/asm-$(ARCH)/arch/mach
102         @rm -f $(srctree)/include/asm-$(ARCH)/arch
103         @ln -sf $(SARCH) $(srctree)/include/asm-$(ARCH)/arch
104 ifdef CONFIG_ETRAX_ARCH_V32
105         @ln -sf $(MACH) $(srctree)/include/asm-$(ARCH)/arch/mach
106 endif
107         @touch $@
108
109 archclean:
110         $(Q)if [ -e arch/$(ARCH)/boot ]; then \
111                 $(MAKE) $(clean)=arch/$(ARCH)/boot; \
112         fi
113
114 CLEAN_FILES += \
115         $(MACHINE)/boot/zImage \
116         $(MACHINE)/boot/compressed/decompress.bin \
117         $(MACHINE)/boot/compressed/piggy.gz \
118         $(MACHINE)/boot/rescue/rescue.bin \
119         $(SRC_ARCH)/.links \
120         $(srctree)/include/asm-$(ARCH)/.arch
121
122 MRPROPER_FILES += \
123         $(SRC_ARCH)/drivers \
124         $(SRC_ARCH)/boot \
125         $(SRC_ARCH)/lib \
126         $(SRC_ARCH)/arch \
127         $(SRC_ARCH)/kernel/vmlinux.lds.S \
128         $(SRC_ARCH)/kernel/asm-offsets.c
129
130 define archhelp
131   echo  '* zImage        - Compressed kernel image (arch/$(ARCH)/boot/zImage)'
132   echo  '* Image         - Uncompressed kernel image (arch/$(ARCH)/boot/Image)'
133 endef