blob: 838cd2ae03ae53ffdb130bedec3f90e225d676b8 [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
Linus Torvalds1da177e2005-04-16 15:20:36 -070013arch-y := v10
14arch-$(CONFIG_ETRAX_ARCH_V10) := v10
Mikael Starvik3e41d652005-07-27 11:44:30 -070015arch-$(CONFIG_ETRAX_ARCH_V32) := v32
Linus Torvalds1da177e2005-04-16 15:20:36 -070016
Jesper Nilsson2c2314b2007-11-30 16:07:06 +010017# No config available for make clean etc
18mach-y := fs
19mach-$(CONFIG_CRIS_MACH_ARTPEC3) := a3
20mach-$(CONFIG_ETRAXFS) := fs
21
Linus Torvalds1da177e2005-04-16 15:20:36 -070022ifneq ($(arch-y),)
23SARCH := arch-$(arch-y)
24else
25SARCH :=
26endif
27
Jesper Nilsson2c2314b2007-11-30 16:07:06 +010028ifneq ($(mach-y),)
29MACH := mach-$(mach-y)
30else
31MACH :=
32endif
33
Linus Torvalds1da177e2005-04-16 15:20:36 -070034LD = $(CROSS_COMPILE)ld -mcrislinux
35
36OBJCOPYFLAGS := -O binary -R .note -R .comment -S
37
38CPPFLAGS_vmlinux.lds = -DDRAM_VIRTUAL_BASE=0x$(CONFIG_ETRAX_DRAM_VIRTUAL_BASE)
Linus Torvalds1da177e2005-04-16 15:20:36 -070039
Jesper Nilsson2c2314b2007-11-30 16:07:06 +010040KBUILD_AFLAGS += -mlinux -march=$(arch-y) -Iinclude/asm/arch/mach -Iinclude/asm/arch
41
42KBUILD_CFLAGS += -mlinux -march=$(arch-y) -pipe -Iinclude/asm/arch/mach -Iinclude/asm/arch
Linus Torvalds1da177e2005-04-16 15:20:36 -070043
44ifdef CONFIG_FRAME_POINTER
Sam Ravnborga0f97e02007-10-14 22:21:35 +020045KBUILD_CFLAGS := $(subst -fomit-frame-pointer,,$(KBUILD_CFLAGS)) -g
46KBUILD_CFLAGS += -fno-omit-frame-pointer
Linus Torvalds1da177e2005-04-16 15:20:36 -070047endif
48
49head-y := arch/$(ARCH)/$(SARCH)/kernel/head.o
50
Sam Ravnborga0f97e02007-10-14 22:21:35 +020051LIBGCC = $(shell $(CC) $(KBUILD_CFLAGS) -print-file-name=libgcc.a)
Linus Torvalds1da177e2005-04-16 15:20:36 -070052
53core-y += arch/$(ARCH)/kernel/ arch/$(ARCH)/mm/
54core-y += arch/$(ARCH)/$(SARCH)/kernel/ arch/$(ARCH)/$(SARCH)/mm/
Jesper Nilsson2c2314b2007-11-30 16:07:06 +010055ifdef CONFIG_ETRAX_ARCH_V32
56core-y += arch/$(ARCH)/$(SARCH)/$(MACH)/
57endif
Linus Torvalds1da177e2005-04-16 15:20:36 -070058drivers-y += arch/$(ARCH)/$(SARCH)/drivers/
59libs-y += arch/$(ARCH)/$(SARCH)/lib/ $(LIBGCC)
60
Mikael Starvik3e41d652005-07-27 11:44:30 -070061# cris source path
62SRC_ARCH = $(srctree)/arch/$(ARCH)
63# cris object files path
64OBJ_ARCH = $(objtree)/arch/$(ARCH)
65
Jesper Nilsson2c2314b2007-11-30 16:07:06 +010066boot := arch/$(ARCH)/boot
67MACHINE := arch/$(ARCH)/$(SARCH)
Mikael Starvik3e41d652005-07-27 11:44:30 -070068
Jesper Nilsson2c2314b2007-11-30 16:07:06 +010069all: zImage
Mikael Starvik3e41d652005-07-27 11:44:30 -070070
Jesper Nilsson2c2314b2007-11-30 16:07:06 +010071zImage Image: vmlinux
72 $(Q)$(MAKE) $(build)=$(boot) MACHINE=$(MACHINE) $(boot)/$@
Linus Torvalds1da177e2005-04-16 15:20:36 -070073
Jesper Nilsson2c2314b2007-11-30 16:07:06 +010074archprepare: $(SRC_ARCH)/.links $(srctree)/include/asm-$(ARCH)/.arch FORCE
Linus Torvalds1da177e2005-04-16 15:20:36 -070075
76# Create some links to make all tools happy
Mikael Starvik3e41d652005-07-27 11:44:30 -070077$(SRC_ARCH)/.links:
78 @rm -rf $(SRC_ARCH)/drivers
Jesper Nilsson2c2314b2007-11-30 16:07:06 +010079 @ln -sfn $(SARCH)/drivers $(SRC_ARCH)/drivers
Mikael Starvik3e41d652005-07-27 11:44:30 -070080 @rm -rf $(SRC_ARCH)/boot
Jesper Nilsson2c2314b2007-11-30 16:07:06 +010081 @ln -sfn $(SARCH)/boot $(SRC_ARCH)/boot
Mikael Starvik3e41d652005-07-27 11:44:30 -070082 @rm -rf $(SRC_ARCH)/lib
Jesper Nilsson2c2314b2007-11-30 16:07:06 +010083 @ln -sfn $(SARCH)/lib $(SRC_ARCH)/lib
84 @rm -f $(SRC_ARCH)/arch/mach
85 @rm -rf $(SRC_ARCH)/arch
86 @ln -sfn $(SARCH) $(SRC_ARCH)/arch
87ifdef CONFIG_ETRAX_ARCH_V32
88 @ln -sfn ../$(SARCH)/$(MACH) $(SRC_ARCH)/arch/mach
89endif
90 @rm -rf $(SRC_ARCH)/kernel/vmlinux.lds.S
91 @ln -sfn ../$(SARCH)/vmlinux.lds.S $(SRC_ARCH)/kernel/vmlinux.lds.S
92 @rm -rf $(SRC_ARCH)/kernel/asm-offsets.c
93 @ln -sfn ../$(SARCH)/kernel/asm-offsets.c $(SRC_ARCH)/kernel/asm-offsets.c
Linus Torvalds1da177e2005-04-16 15:20:36 -070094 @touch $@
95
96# Create link to sub arch includes
Mikael Starvik3e41d652005-07-27 11:44:30 -070097$(srctree)/include/asm-$(ARCH)/.arch: $(wildcard include/config/arch/*.h)
Jesper Nilsson2c2314b2007-11-30 16:07:06 +010098 @echo ' SYMLINK include/asm-$(ARCH)/arch -> include/asm-$(ARCH)/$(SARCH)'
99 @rm -f $(srctree)/include/asm-$(ARCH)/arch/mach
100 @rm -f $(srctree)/include/asm-$(ARCH)/arch
101 @ln -sf $(SARCH) $(srctree)/include/asm-$(ARCH)/arch
102ifdef CONFIG_ETRAX_ARCH_V32
103 @ln -sf $(MACH) $(srctree)/include/asm-$(ARCH)/arch/mach
104endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700105 @touch $@
Jesper Nilsson2c2314b2007-11-30 16:07:06 +0100106
107archclean:
108 $(Q)if [ -e arch/$(ARCH)/boot ]; then \
109 $(MAKE) $(clean)=arch/$(ARCH)/boot; \
110 fi
111
112CLEAN_FILES += \
113 $(MACHINE)/boot/zImage \
114 $(MACHINE)/boot/compressed/decompress.bin \
115 $(MACHINE)/boot/compressed/piggy.gz \
116 $(MACHINE)/boot/rescue/rescue.bin \
117 $(SRC_ARCH)/.links \
118 $(srctree)/include/asm-$(ARCH)/.arch
119
120MRPROPER_FILES += \
121 $(SRC_ARCH)/drivers \
122 $(SRC_ARCH)/boot \
123 $(SRC_ARCH)/lib \
124 $(SRC_ARCH)/arch \
125 $(SRC_ARCH)/kernel/vmlinux.lds.S \
126 $(SRC_ARCH)/kernel/asm-offsets.c
127
128define archhelp
129 echo '* zImage - Compressed kernel image (arch/$(ARCH)/boot/zImage)'
130 echo '* Image - Uncompressed kernel image (arch/$(ARCH)/boot/Image)'
131endef