1# $Id: Makefile,v 1.1.1.1 2008/10/15 03:26:16 james26_jang Exp $
2#
3# This file is subject to the terms and conditions of the GNU General Public
4# License.  See the file "COPYING" in the main directory of this archive
5# for more details.
6#
7# Copyright (C) 1999  Kaz Kojima
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
15ifdef CONFIG_CPU_LITTLE_ENDIAN
16CFLAGS		+= -ml
17AFLAGS		+= -ml
18# LINKFLAGS	+= -EL
19LDFLAGS		:= -EL
20else
21CFLAGS		+= -mb
22AFLAGS		+= -mb
23# LINKFLAGS	+= -EB
24LDFLAGS		:= -EB
25endif
26
27LD	=$(CROSS_COMPILE)ld $(LDFLAGS)
28OBJCOPY=$(CROSS_COMPILE)objcopy -O binary -R .note -R .comment -R .stab -R .stabstr -S
29
30MODFLAGS	+=
31
32#
33#
34
35ifdef CONFIG_CPU_SH3
36CFLAGS		+= -m3
37AFLAGS		+= -m3
38endif
39ifdef CONFIG_CPU_SH4
40CFLAGS		+= -m4 -mno-implicit-fp
41AFLAGS		+= -m4 -mno-implicit-fp
42endif
43
44#
45# Choosing incompatible machines durings configuration will result in
46# error messages during linking.  Select a default linkscript if
47# none has been choosen above.
48#
49LINKSCRIPT    = arch/sh/vmlinux.lds
50LINKFLAGS     += -T $(word 1,$(LINKSCRIPT)) -e _stext
51
52ifdef LOADADDR
53LINKFLAGS     += -Ttext $(word 1,$(LOADADDR))
54endif
55
56#
57CFLAGS		+= -pipe
58
59HEAD := arch/sh/kernel/head.o arch/sh/kernel/init_task.o
60
61SUBDIRS := $(SUBDIRS) $(addprefix arch/sh/, kernel mm lib)
62CORE_FILES := arch/sh/kernel/kernel.o arch/sh/mm/mm.o $(CORE_FILES)
63LIBGCC := $(shell $(CC) $(CFLAGS) -print-libgcc-file-name)
64LIBS := $(TOPDIR)/arch/sh/lib/lib.a $(LIBS) $(TOPDIR)/arch/sh/lib/lib.a \
65	$(LIBGCC)
66
67MAKEBOOT = $(MAKE) -C arch/$(ARCH)/boot
68
69ifneq ($(CONFIG_SH_GENERIC)$(CONFIG_SH_STB1_HARP)$(CONFIG_SH_STB1_OVERDRIVE),)
70SUBDIRS += arch/sh/stboards
71CORE_FILES += arch/sh/stboards/stboards.o
72endif
73
74vmlinux: arch/sh/vmlinux.lds
75
76arch/sh/vmlinux.lds: arch/sh/vmlinux.lds.S FORCE
77	$(CPP) -traditional -C -P -I$(HPATH) -Ush arch/sh/vmlinux.lds.S >arch/sh/vmlinux.lds
78
79FORCE: ;
80
81zImage: vmlinux
82	@$(MAKEBOOT) zImage
83
84compressed: zImage
85
86zdisk: vmlinux
87	@$(MAKEBOOT) zdisk
88
89archclean:
90	@$(MAKEBOOT) clean
91	$(MAKE) -C arch/$(ARCH)/kernel clean
92	$(MAKE) -C arch/$(ARCH)/stboards clean
93#	$(MAKE) -C arch/$(ARCH)/tools clean
94
95archmrproper:
96	rm -f arch/sh/vmlinux.lds
97
98archdep:
99	@$(MAKEBOOT) dep
100