blob: 241e35bc3b59087e21cd07856364f03cd64a1de6 [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)
Jesper Nilsson556dcee2008-10-21 17:45:58 +020026inc := -Iarch/cris/include/arch-$(arch-y) -Iarch/cris/include/arch-$(arch-y)/arch
Linus Torvalds1da177e2005-04-16 15:20:36 -070027else
28SARCH :=
Jesper Nilsson556dcee2008-10-21 17:45:58 +020029inc :=
Linus Torvalds1da177e2005-04-16 15:20:36 -070030endif
31
Jesper Nilsson2c2314b2007-11-30 16:07:06 +010032ifneq ($(mach-y),)
33MACH := mach-$(mach-y)
Jesper Nilsson556dcee2008-10-21 17:45:58 +020034inc += -Iarch/cris/include/$(SARCH)/$(MACH)/
35inc += -Iarch/cris/include/$(SARCH)/$(MACH)/mach
Jesper Nilsson2c2314b2007-11-30 16:07:06 +010036else
37MACH :=
38endif
39
Linus Torvalds1da177e2005-04-16 15:20:36 -070040LD = $(CROSS_COMPILE)ld -mcrislinux
41
42OBJCOPYFLAGS := -O binary -R .note -R .comment -S
43
44CPPFLAGS_vmlinux.lds = -DDRAM_VIRTUAL_BASE=0x$(CONFIG_ETRAX_DRAM_VIRTUAL_BASE)
Linus Torvalds1da177e2005-04-16 15:20:36 -070045
Jesper Nilsson556dcee2008-10-21 17:45:58 +020046KBUILD_AFLAGS += -mlinux -march=$(arch-y) $(inc)
47KBUILD_CFLAGS += -mlinux -march=$(arch-y) -pipe $(inc)
48KBUILD_CPPFLAGS += $(inc)
Linus Torvalds1da177e2005-04-16 15:20:36 -070049
50ifdef CONFIG_FRAME_POINTER
Sam Ravnborga0f97e02007-10-14 22:21:35 +020051KBUILD_CFLAGS := $(subst -fomit-frame-pointer,,$(KBUILD_CFLAGS)) -g
52KBUILD_CFLAGS += -fno-omit-frame-pointer
Linus Torvalds1da177e2005-04-16 15:20:36 -070053endif
54
55head-y := arch/$(ARCH)/$(SARCH)/kernel/head.o
56
Sam Ravnborga0f97e02007-10-14 22:21:35 +020057LIBGCC = $(shell $(CC) $(KBUILD_CFLAGS) -print-file-name=libgcc.a)
Linus Torvalds1da177e2005-04-16 15:20:36 -070058
59core-y += arch/$(ARCH)/kernel/ arch/$(ARCH)/mm/
60core-y += arch/$(ARCH)/$(SARCH)/kernel/ arch/$(ARCH)/$(SARCH)/mm/
Jesper Nilsson2c2314b2007-11-30 16:07:06 +010061ifdef CONFIG_ETRAX_ARCH_V32
62core-y += arch/$(ARCH)/$(SARCH)/$(MACH)/
63endif
Linus Torvalds1da177e2005-04-16 15:20:36 -070064drivers-y += arch/$(ARCH)/$(SARCH)/drivers/
65libs-y += arch/$(ARCH)/$(SARCH)/lib/ $(LIBGCC)
66
Mikael Starvik3e41d652005-07-27 11:44:30 -070067# cris source path
68SRC_ARCH = $(srctree)/arch/$(ARCH)
69# cris object files path
70OBJ_ARCH = $(objtree)/arch/$(ARCH)
71
Jesper Nilsson2c2314b2007-11-30 16:07:06 +010072boot := arch/$(ARCH)/boot
73MACHINE := arch/$(ARCH)/$(SARCH)
Mikael Starvik3e41d652005-07-27 11:44:30 -070074
Jesper Nilsson2c2314b2007-11-30 16:07:06 +010075all: zImage
Mikael Starvik3e41d652005-07-27 11:44:30 -070076
Jesper Nilsson2c2314b2007-11-30 16:07:06 +010077zImage Image: vmlinux
78 $(Q)$(MAKE) $(build)=$(boot) MACHINE=$(MACHINE) $(boot)/$@
Linus Torvalds1da177e2005-04-16 15:20:36 -070079
Jesper Nilsson556dcee2008-10-21 17:45:58 +020080archprepare: $(SRC_ARCH)/.links FORCE
Linus Torvalds1da177e2005-04-16 15:20:36 -070081
82# Create some links to make all tools happy
Mikael Starvik3e41d652005-07-27 11:44:30 -070083$(SRC_ARCH)/.links:
84 @rm -rf $(SRC_ARCH)/drivers
Jesper Nilsson2c2314b2007-11-30 16:07:06 +010085 @ln -sfn $(SARCH)/drivers $(SRC_ARCH)/drivers
Mikael Starvik3e41d652005-07-27 11:44:30 -070086 @rm -rf $(SRC_ARCH)/boot
Jesper Nilsson2c2314b2007-11-30 16:07:06 +010087 @ln -sfn $(SARCH)/boot $(SRC_ARCH)/boot
Mikael Starvik3e41d652005-07-27 11:44:30 -070088 @rm -rf $(SRC_ARCH)/lib
Jesper Nilsson2c2314b2007-11-30 16:07:06 +010089 @ln -sfn $(SARCH)/lib $(SRC_ARCH)/lib
90 @rm -f $(SRC_ARCH)/arch/mach
91 @rm -rf $(SRC_ARCH)/arch
92 @ln -sfn $(SARCH) $(SRC_ARCH)/arch
93ifdef CONFIG_ETRAX_ARCH_V32
94 @ln -sfn ../$(SARCH)/$(MACH) $(SRC_ARCH)/arch/mach
95endif
96 @rm -rf $(SRC_ARCH)/kernel/vmlinux.lds.S
97 @ln -sfn ../$(SARCH)/vmlinux.lds.S $(SRC_ARCH)/kernel/vmlinux.lds.S
Linus Torvalds1da177e2005-04-16 15:20:36 -070098 @touch $@
99
Jesper Nilsson2c2314b2007-11-30 16:07:06 +0100100archclean:
101 $(Q)if [ -e arch/$(ARCH)/boot ]; then \
102 $(MAKE) $(clean)=arch/$(ARCH)/boot; \
103 fi
104
105CLEAN_FILES += \
106 $(MACHINE)/boot/zImage \
107 $(MACHINE)/boot/compressed/decompress.bin \
108 $(MACHINE)/boot/compressed/piggy.gz \
109 $(MACHINE)/boot/rescue/rescue.bin \
Jesper Nilsson556dcee2008-10-21 17:45:58 +0200110 $(SRC_ARCH)/.links
Jesper Nilsson2c2314b2007-11-30 16:07:06 +0100111
112MRPROPER_FILES += \
113 $(SRC_ARCH)/drivers \
114 $(SRC_ARCH)/boot \
115 $(SRC_ARCH)/lib \
116 $(SRC_ARCH)/arch \
Jesper Nilsson0365f702008-10-21 22:10:27 +0200117 $(SRC_ARCH)/kernel/vmlinux.lds.S
118
Jesper Nilsson2c2314b2007-11-30 16:07:06 +0100119
120define archhelp
121 echo '* zImage - Compressed kernel image (arch/$(ARCH)/boot/zImage)'
122 echo '* Image - Uncompressed kernel image (arch/$(ARCH)/boot/Image)'
123endef