1#
2# ia64/Makefile
3#
4# This file is subject to the terms and conditions of the GNU General Public
5# License.  See the file "COPYING" in the main directory of this archive
6# for more details.
7#
8# Copyright (C) 1998-2001 by David Mosberger-Tang <davidm@hpl.hp.com>
9#
10
11NM := $(CROSS_COMPILE)nm -B
12AWK := awk
13
14export AWK
15
16LINKFLAGS = -static -T arch/$(ARCH)/vmlinux.lds
17AFLAGS_KERNEL := -mconstant-gp
18EXTRA	=
19
20CFLAGS := $(CFLAGS) -pipe $(EXTRA) -ffixed-r13 -mfixed-range=f12-f15,f32-f127 \
21	  -falign-functions=32
22# -ffunction-sections
23CFLAGS_KERNEL := -mconstant-gp
24
25GCC_VERSION=$(shell $(CC) -v 2>&1 | fgrep 'gcc version' | cut -f3 -d' ' | cut -f1 -d'.')
26
27CHECK_GAS_FOR_HINT=arch/ia64/scripts/check_gas_for_hint.o
28MAKE_GAS_HINT_TEST=arch/ia64/scripts/make_gas_hint_test
29
30ifneq (, $(shell ls $(CHECK_GAS_FOR_HINT)))
31$(shell rm $(CHECK_GAS_FOR_HINT))
32endif
33
34CHECK_GAS_CMD:=($(CC) $(MAKE_GAS_HINT_TEST).c -o $(MAKE_GAS_HINT_TEST) && $(MAKE_GAS_HINT_TEST) | $(CC) -c -o $(CHECK_GAS_FOR_HINT) -x assembler -; rm -f $(MAKE_GAS_HINT_TEST))>&/dev/null
35$(shell $(CHECK_GAS_CMD))
36ifneq (, $(shell ls $(CHECK_GAS_FOR_HINT)))
37#Newer version of binutil is detected and "hint" instruction is in the kernel
38$(warning Warning: Found binutils that supports hint instruction)
39FLAGS := $(AFLAGS) -DGAS_HAS_HINT_INSN
40CFLAGS := $(CFLAGS) -DGAS_HAS_HINT_INSN
41else
42$(warning Warning: Please use binutil version 2.14.90.0.4.1 or higher to get the support of hint instruction in kernel.)
43endif
44
45ifneq ($(GCC_VERSION),2)
46	CFLAGS += -frename-registers --param max-inline-insns=5000
47endif
48
49ifeq ($(CONFIG_ITANIUM_BSTEP_SPECIFIC),y)
50	CFLAGS += -mb-step
51endif
52
53ifdef CONFIG_IA64_GENERIC
54	CORE_FILES      :=      arch/$(ARCH)/hp/hp.o			\
55				arch/$(ARCH)/dig/dig.a			\
56				$(CORE_FILES)
57	SUBDIRS		:=	arch/$(ARCH)/hp		\
58				arch/$(ARCH)/dig	\
59				$(SUBDIRS)
60
61else # !GENERIC
62
63ifdef CONFIG_IA64_HP_SIM
64        SUBDIRS         :=      arch/$(ARCH)/hp		\
65                                arch/$(ARCH)/drivers	\
66                                $(SUBDIRS)
67        CORE_FILES      :=      arch/$(ARCH)/hp/hp.o	\
68                                $(CORE_FILES)
69        DRIVERS         +=      arch/$(ARCH)/drivers/drivers.o
70endif
71
72ifdef CONFIG_IA64_HP_ZX1
73        SUBDIRS         :=      arch/$(ARCH)/hp				\
74				arch/$(ARCH)/dig			\
75                                $(SUBDIRS)
76        CORE_FILES      :=      arch/$(ARCH)/hp/hp.o			\
77				arch/$(ARCH)/dig/dig.a			\
78                                $(CORE_FILES)
79endif
80
81ifdef CONFIG_IA64_SGI_SN
82	CFLAGS		+= -DBRINGUP
83        SUBDIRS         :=      arch/$(ARCH)/sn/kernel	\
84				arch/$(ARCH)/sn/io	\
85				arch/$(ARCH)/sn/fakeprom	\
86				$(SUBDIRS)
87        CORE_FILES      :=      arch/$(ARCH)/sn/kernel/sn.o	\
88				arch/$(ARCH)/sn/io/sgiio.o	\
89				$(CORE_FILES)
90endif
91
92ifdef CONFIG_IA64_SOFTSDV
93        SUBDIRS         :=      arch/$(ARCH)/dig	\
94				$(SUBDIRS)
95        CORE_FILES      :=      arch/$(ARCH)/dig/dig.a	\
96				$(CORE_FILES)
97endif
98
99ifdef CONFIG_IA64_DIG
100        SUBDIRS         :=      arch/$(ARCH)/dig	\
101				$(SUBDIRS)
102        CORE_FILES      :=      arch/$(ARCH)/dig/dig.a	\
103				$(CORE_FILES)
104endif
105
106endif # !GENERIC
107
108ifdef CONFIG_IA32_SUPPORT
109	SUBDIRS		:=	arch/$(ARCH)/ia32 $(SUBDIRS)
110	CORE_FILES	:=	arch/$(ARCH)/ia32/ia32.o $(CORE_FILES)
111endif
112
113HEAD := arch/$(ARCH)/kernel/head.o arch/ia64/kernel/init_task.o
114
115SUBDIRS := arch/$(ARCH)/tools arch/$(ARCH)/kernel arch/$(ARCH)/mm arch/$(ARCH)/lib $(SUBDIRS)
116CORE_FILES := arch/$(ARCH)/kernel/kernel.o arch/$(ARCH)/mm/mm.o $(CORE_FILES)
117
118LIBS := $(TOPDIR)/arch/$(ARCH)/lib/lib.a $(LIBS) \
119	$(TOPDIR)/arch/$(ARCH)/lib/lib.a
120
121MAKEBOOT = $(MAKE) -C arch/$(ARCH)/boot
122
123vmlinux: arch/$(ARCH)/vmlinux.lds
124
125arch/$(ARCH)/vmlinux.lds: arch/$(ARCH)/vmlinux.lds.S FORCE
126	$(CPP) -D__ASSEMBLY__ -C -P -I$(HPATH) -I$(HPATH)/asm-$(ARCH) \
127		-traditional arch/$(ARCH)/vmlinux.lds.S > $@
128
129FORCE: ;
130
131compressed: vmlinux
132	$(OBJCOPY) --strip-all vmlinux vmlinux-tmp
133	gzip vmlinux-tmp
134	mv vmlinux-tmp.gz vmlinux.gz
135
136rawboot:
137	@$(MAKEBOOT) rawboot
138
139#
140# My boot writes directly to a specific disk partition, I doubt most
141# people will want to do that without changes..
142#
143msb my-special-boot:
144	@$(MAKEBOOT) msb
145
146bootimage:
147	@$(MAKEBOOT) bootimage
148
149srmboot:
150	@$(MAKEBOOT) srmboot
151
152archclean:
153	@$(MAKEBOOT) clean
154
155check: vmlinux
156	arch/ia64/scripts/unwcheck.sh vmlinux
157
158archmrproper:
159	rm -f arch/$(ARCH)/vmlinux.lds vmlinux-tmp vmlinux.gz
160	@$(MAKE) -C arch/$(ARCH)/tools mrproper
161
162archdep:
163	@$(MAKEBOOT) dep
164
165bootpfile:
166	@$(MAKEBOOT) bootpfile
167