blob: c6f5f5a2ffdfe73adc51fdff67f3ea10f9c9ec7a [file] [log] [blame]
Jesper Nilsson2c2314b2007-11-30 16:07:06 +01001#
Linus Torvalds1da177e2005-04-16 15:20:36 -07002# 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
Adrian Bunk8f808412008-02-26 19:47:03 +020013KBUILD_DEFCONFIG := etrax-100lx_v2_defconfig
14
Linus Torvalds1da177e2005-04-16 15:20:36 -070015arch-y := v10
16arch-$(CONFIG_ETRAX_ARCH_V10) := v10
Mikael Starvik3e41d652005-07-27 11:44:30 -070017arch-$(CONFIG_ETRAX_ARCH_V32) := v32
Linus Torvalds1da177e2005-04-16 15:20:36 -070018
Jesper Nilsson2c2314b2007-11-30 16:07:06 +010019# No config available for make clean etc
20mach-y := fs
21mach-$(CONFIG_CRIS_MACH_ARTPEC3) := a3
22mach-$(CONFIG_ETRAXFS) := fs
23
Linus Torvalds1da177e2005-04-16 15:20:36 -070024ifneq ($(arch-y),)
25SARCH := arch-$(arch-y)
26else
27SARCH :=
28endif
29
Jesper Nilsson2c2314b2007-11-30 16:07:06 +010030ifneq ($(mach-y),)
31MACH := mach-$(mach-y)
32else
33MACH :=
34endif
35
Linus Torvalds1da177e2005-04-16 15:20:36 -070036LD = $(CROSS_COMPILE)ld -mcrislinux
37
38OBJCOPYFLAGS := -O binary -R .note -R .comment -S
39
40CPPFLAGS_vmlinux.lds = -DDRAM_VIRTUAL_BASE=0x$(CONFIG_ETRAX_DRAM_VIRTUAL_BASE)
Linus Torvalds1da177e2005-04-16 15:20:36 -070041
Jesper Nilsson2c2314b2007-11-30 16:07:06 +010042KBUILD_AFLAGS += -mlinux -march=$(arch-y) -Iinclude/asm/arch/mach -Iinclude/asm/arch
43
44KBUILD_CFLAGS += -mlinux -march=$(arch-y) -pipe -Iinclude/asm/arch/mach -Iinclude/asm/arch
Linus Torvalds1da177e2005-04-16 15:20:36 -070045
46ifdef CONFIG_FRAME_POINTER
Sam Ravnborga0f97e02007-10-14 22:21:35 +020047KBUILD_CFLAGS := $(subst -fomit-frame-pointer,,$(KBUILD_CFLAGS)) -g
48KBUILD_CFLAGS += -fno-omit-frame-pointer
Linus Torvalds1da177e2005-04-16 15:20:36 -070049endif
50
51head-y := arch/$(ARCH)/$(SARCH)/kernel/head.o
52
Sam Ravnborga0f97e02007-10-14 22:21:35 +020053LIBGCC = $(shell $(CC) $(KBUILD_CFLAGS) -print-file-name=libgcc.a)
Linus Torvalds1da177e2005-04-16 15:20:36 -070054
55core-y += arch/$(ARCH)/kernel/ arch/$(ARCH)/mm/
56core-y += arch/$(ARCH)/$(SARCH)/kernel/ arch/$(ARCH)/$(SARCH)/mm/
Jesper Nilsson2c2314b2007-11-30 16:07:06 +010057ifdef CONFIG_ETRAX_ARCH_V32
58core-y += arch/$(ARCH)/$(SARCH)/$(MACH)/
59endif
Linus Torvalds1da177e2005-04-16 15:20:36 -070060drivers-y += arch/$(ARCH)/$(SARCH)/drivers/
61libs-y += arch/$(ARCH)/$(SARCH)/lib/ $(LIBGCC)
62
Mikael Starvik3e41d652005-07-27 11:44:30 -070063# cris source path
64SRC_ARCH = $(srctree)/arch/$(ARCH)
65# cris object files path
66OBJ_ARCH = $(objtree)/arch/$(ARCH)
67
Jesper Nilsson2c2314b2007-11-30 16:07:06 +010068boot := arch/$(ARCH)/boot
69MACHINE := arch/$(ARCH)/$(SARCH)
Mikael Starvik3e41d652005-07-27 11:44:30 -070070
Jesper Nilsson2c2314b2007-11-30 16:07:06 +010071all: zImage
Mikael Starvik3e41d652005-07-27 11:44:30 -070072
Jesper Nilsson2c2314b2007-11-30 16:07:06 +010073zImage Image: vmlinux
74 $(Q)$(MAKE) $(build)=$(boot) MACHINE=$(MACHINE) $(boot)/$@
Linus Torvalds1da177e2005-04-16 15:20:36 -070075
Jesper Nilsson2c2314b2007-11-30 16:07:06 +010076archprepare: $(SRC_ARCH)/.links $(srctree)/include/asm-$(ARCH)/.arch FORCE
Linus Torvalds1da177e2005-04-16 15:20:36 -070077
78# Create some links to make all tools happy
Mikael Starvik3e41d652005-07-27 11:44:30 -070079$(SRC_ARCH)/.links:
80 @rm -rf $(SRC_ARCH)/drivers
Jesper Nilsson2c2314b2007-11-30 16:07:06 +010081 @ln -sfn $(SARCH)/drivers $(SRC_ARCH)/drivers
Mikael Starvik3e41d652005-07-27 11:44:30 -070082 @rm -rf $(SRC_ARCH)/boot
Jesper Nilsson2c2314b2007-11-30 16:07:06 +010083 @ln -sfn $(SARCH)/boot $(SRC_ARCH)/boot
Mikael Starvik3e41d652005-07-27 11:44:30 -070084 @rm -rf $(SRC_ARCH)/lib
Jesper Nilsson2c2314b2007-11-30 16:07:06 +010085 @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
89ifdef CONFIG_ETRAX_ARCH_V32
90 @ln -sfn ../$(SARCH)/$(MACH) $(SRC_ARCH)/arch/mach
91endif
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
Linus Torvalds1da177e2005-04-16 15:20:36 -070096 @touch $@
97
98# Create link to sub arch includes
Mikael Starvik3e41d652005-07-27 11:44:30 -070099$(srctree)/include/asm-$(ARCH)/.arch: $(wildcard include/config/arch/*.h)
Jesper Nilsson2c2314b2007-11-30 16:07:06 +0100100 @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
104ifdef CONFIG_ETRAX_ARCH_V32
105 @ln -sf $(MACH) $(srctree)/include/asm-$(ARCH)/arch/mach
106endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700107 @touch $@
Jesper Nilsson2c2314b2007-11-30 16:07:06 +0100108
109archclean:
110 $(Q)if [ -e arch/$(ARCH)/boot ]; then \
111 $(MAKE) $(clean)=arch/$(ARCH)/boot; \
112 fi
113
114CLEAN_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
122MRPROPER_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
130define archhelp
131 echo '* zImage - Compressed kernel image (arch/$(ARCH)/boot/zImage)'
132 echo '* Image - Uncompressed kernel image (arch/$(ARCH)/boot/Image)'
133endef