1#
2# This file is subject to the terms and conditions of the GNU General Public
3# License.  See the file "COPYING" in the main directory of this archive
4# for more details.
5#
6# Copyright (C) 2000, 2001  Paolo Alberelli
7# Copyright (C) 2003, 2004  Paul Mundt
8#
9# This file is included by the global makefile so that you can add your own
10# architecture-specific flags and dependencies. Remember to do have actions
11# for "archclean" and "archdep" for cleaning up and making dependencies for
12# this architecture
13#
14
15cpu-y				:= -mb
16cpu-$(CONFIG_LITTLE_ENDIAN)	:= -ml
17
18cpu-$(CONFIG_CPU_SH5)		+= -m5-32media-nofpu
19
20ifdef CONFIG_LITTLE_ENDIAN
21LDFLAGS_vmlinux		+= --defsym 'jiffies=jiffies_64'
22LDFLAGS			+= -EL  -mshlelf32_linux
23else
24LDFLAGS_vmlinux		+= --defsym 'jiffies=jiffies_64+4'
25LDFLAGS			+= -EB  -mshelf32_linux
26endif
27
28# No requirements for endianess support from AFLAGS, 'as' always run through gcc
29CFLAGS		+= $(cpu-y)
30
31LDFLAGS_vmlinux	+= --defsym phys_stext=_stext-$(CONFIG_CACHED_MEMORY_OFFSET) \
32		  --defsym phys_stext_shmedia=phys_stext+1 \
33		  -e phys_stext_shmedia
34
35OBJCOPYFLAGS	:= -O binary -R .note -R .comment -R .stab -R .stabstr -S
36
37#
38# arch/sh64/defconfig never had any hope of being
39# frequently updated, so use one that does
40#
41KBUILD_DEFCONFIG	:= cayman_defconfig
42
43ifdef LOADADDR
44LINKFLAGS     += -Ttext $(word 1,$(LOADADDR))
45endif
46
47machine-$(CONFIG_SH_CAYMAN)	:= cayman
48machine-$(CONFIG_SH_SIMULATOR)	:= sim
49machine-$(CONFIG_SH_HARP)	:= harp
50machine-$(CONFIG_SH_ROMRAM)	:= romram
51
52head-y := arch/$(ARCH)/kernel/head.o arch/$(ARCH)/kernel/init_task.o
53
54core-y	+= arch/sh64/kernel/ arch/sh64/mm/
55
56ifneq ($(machine-y),)
57core-y	+= arch/sh64/mach-$(machine-y)/
58endif
59
60LIBGCC := $(shell $(CC) $(CFLAGS) -print-libgcc-file-name)
61libs-y	+= arch/$(ARCH)/lib/ $(LIBGCC)
62
63drivers-$(CONFIG_OPROFILE)	+= arch/sh64/oprofile/
64
65boot := arch/$(ARCH)/boot
66
67zImage: vmlinux
68	$(Q)$(MAKE) $(build)=$(boot) $(boot)/$@
69
70compressed: zImage
71
72archclean:
73	$(Q)$(MAKE) $(clean)=$(boot)
74
75archprepare: arch/$(ARCH)/lib/syscalltab.h
76
77define filechk_gen-syscalltab
78       (set -e; \
79	echo "/*"; \
80	echo " * DO NOT MODIFY."; \
81	echo " *"; \
82	echo " * This file was generated by arch/$(ARCH)/Makefile"; \
83	echo " * Any changes will be reverted at build time."; \
84	echo " */"; \
85	echo ""; \
86	echo "#ifndef __SYSCALLTAB_H"; \
87	echo "#define __SYSCALLTAB_H"; \
88	echo ""; \
89	echo "#include <linux/kernel.h>"; \
90	echo ""; \
91	echo "struct syscall_info {"; \
92	echo "	const char *name;"; \
93	echo "} syscall_info_table[] = {"; \
94	sed -e '/^.*\.long /!d;s//    { "/;s/\(\([^/]*\)\/\)\{1\}.*/\2/; \
95		s/[ \t]*$$//g;s/$$/" },/;s/\("\)sys_/\1/g'; \
96	echo "};"; \
97	echo ""; \
98	echo "#define NUM_SYSCALL_INFO_ENTRIES	ARRAY_SIZE(syscall_info_table)"; \
99	echo ""; \
100	echo "#endif /* __SYSCALLTAB_H */" )
101endef
102
103arch/$(ARCH)/lib/syscalltab.h: arch/sh64/kernel/syscalls.S
104	$(call filechk,gen-syscalltab)
105
106CLEAN_FILES += arch/$(ARCH)/lib/syscalltab.h
107
108define archhelp
109	@echo '  zImage 	           - Compressed kernel image (arch/sh64/boot/zImage)'
110endef
111