1# $Id: Makefile,v 1.1.1.1.2.5 2003/10/23 22:08:56 yoshii 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
27ifdef CONFIG_SH_DSP
28AFLAGS += -Wa,-dsp
29endif
30
31ifdef CONFIG_SH_KGDB
32CFLAGS :=$(CFLAGS:-fomit-frame-pointer=) -g
33AFLAGS += -g
34ifdef CONFIG_KGDB_MORE
35CFLAGS += $(shell echo $(CONFIG_KGDB_OPTIONS) | sed -e 's/"//g')
36endif
37endif
38
39LD	=$(CROSS_COMPILE)ld $(LDFLAGS)
40OBJCOPY=$(CROSS_COMPILE)objcopy -O binary -R .note -R .comment -R .stab -R .stabstr -S
41
42MODFLAGS	+=
43
44#
45#
46
47ifdef CONFIG_CPU_SH3
48CFLAGS		+= -m3
49AFLAGS		+= -m3
50endif
51ifdef CONFIG_CPU_SH4
52CFLAGS		+= -m4 -mno-implicit-fp
53AFLAGS		+= -m4 -mno-implicit-fp
54endif
55
56#
57# Choosing incompatible machines durings configuration will result in
58# error messages during linking.  Select a default linkscript if
59# none has been choosen above.
60#
61LINKSCRIPT    = arch/sh/vmlinux.lds
62LINKFLAGS     += -T $(word 1,$(LINKSCRIPT)) -e _stext
63
64ifdef LOADADDR
65LINKFLAGS     += -Ttext $(word 1,$(LOADADDR))
66endif
67
68#
69CFLAGS		+= -pipe
70
71HEAD := arch/sh/kernel/head.o arch/sh/kernel/init_task.o
72
73SUBDIRS := $(SUBDIRS) $(addprefix arch/sh/, kernel mm lib)
74CORE_FILES := arch/sh/kernel/kernel.o arch/sh/mm/mm.o $(CORE_FILES)
75LIBGCC := $(shell $(CC) $(CFLAGS) -print-libgcc-file-name)
76LIBS := $(TOPDIR)/arch/sh/lib/lib.a $(LIBS) $(TOPDIR)/arch/sh/lib/lib.a \
77	$(LIBGCC)
78
79MAKEBOOT = $(MAKE) -C arch/$(ARCH)/boot
80
81ifneq ($(CONFIG_SH_GENERIC)$(CONFIG_SH_STB1_HARP)$(CONFIG_SH_STB1_OVERDRIVE),)
82SUBDIRS += arch/sh/stboards
83CORE_FILES += arch/sh/stboards/stboards.o
84endif
85
86vmlinux: arch/sh/vmlinux.lds
87
88arch/sh/vmlinux.lds: arch/sh/vmlinux.lds.S FORCE
89	$(CPP) -traditional -C -P -I$(HPATH) -Ush arch/sh/vmlinux.lds.S >arch/sh/vmlinux.lds
90
91FORCE: ;
92
93zImage: vmlinux
94	@$(MAKEBOOT) $@
95
96compressed: zImage
97
98zdisk: vmlinux
99	@$(MAKEBOOT) zdisk
100
101archclean:
102	@$(MAKEBOOT) clean
103	$(MAKE) -C arch/$(ARCH)/kernel clean
104	$(MAKE) -C arch/$(ARCH)/stboards clean
105#	$(MAKE) -C arch/$(ARCH)/tools clean
106
107archmrproper:
108	rm -f arch/sh/vmlinux.lds
109
110archdep:
111	@$(MAKEBOOT) dep
112