1#
2# x86_64/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#
13# Copyright (C) 1994 by Linus Torvalds
14#
15# 19990713  Artur Skawina <skawina@geocities.com>
16#           Added '-march' and '-mpreferred-stack-boundary' support
17# 20000913  Pavel Machek <pavel@suse.cz>
18#	    Converted for x86_64 architecture
19# 20010105  Andi Kleen, add IA32 compiler.
20#           ....and later removed it again....
21#
22# $Id: Makefile,v 1.36 2004/02/27 18:30:19 ak Exp $
23
24#
25# early bootup linking needs 32bit. You can either use real 32bit tools
26# here or 64bit tools switch to 32bit mode.
27#
28IA32_CC := $(CROSS_COMPILE)gcc -m32 -O2 -fomit-frame-pointer -nostdinc -I $(HPATH)
29IA32_LD := $(CROSS_COMPILE)ld -m elf_i386
30IA32_AS := $(CROSS_COMPILE)gcc -m32 -Wa,--32 -D__ASSEMBLY__ -traditional -c -nostdinc -I $(HPATH)
31IA32_OBJCOPY := $(CROSS_COMPILE)objcopy
32IA32_CPP := $(CROSS_COMPILE)gcc -m32 -E
33export IA32_CC IA32_LD IA32_AS IA32_OBJCOPY IA32_CPP
34
35
36LD=$(CROSS_COMPILE)ld -m elf_x86_64
37OBJCOPY=$(CROSS_COMPILE)objcopy -O binary -R .note -R .comment -S
38LDFLAGS=-e stext
39LINKFLAGS =-T $(TOPDIR)/arch/x86_64/vmlinux.lds $(LDFLAGS)
40
41CFLAGS += -mno-red-zone
42CFLAGS += -mcmodel=kernel
43CFLAGS += -pipe
44CFLAGS += -fno-reorder-blocks
45# needed for later gcc 3.1
46CFLAGS += -finline-limit=2000
47# needed for earlier gcc 3.1
48CFLAGS += -fno-strength-reduce
49CFLAGS += -Wno-sign-compare
50#CFLAGS += -g
51ifneq ($(CONFIG_X86_REMOTE_DEBUG),y)
52CFLAGS += -fno-asynchronous-unwind-tables
53endif
54# this is needed right now for the 32bit ioctl code
55CFLAGS += $(call check_gcc,-fno-unit-at-a-time,)
56
57ifdef CONFIG_MK8
58CFLAGS += $(call check_gcc,-march=k8,)
59endif
60ifdef CONFIG_MPSC
61CFLAGS += $(call check_gcc,-march=nocona,)
62endif
63
64HEAD := arch/x86_64/kernel/head.o arch/x86_64/kernel/head64.o arch/x86_64/kernel/init_task.o
65
66SUBDIRS := arch/x86_64/tools $(SUBDIRS) arch/x86_64/kernel arch/x86_64/mm arch/x86_64/lib
67CORE_FILES := arch/x86_64/kernel/kernel.o $(CORE_FILES)
68CORE_FILES +=  arch/x86_64/mm/mm.o
69LIBS := $(TOPDIR)/arch/x86_64/lib/lib.a $(LIBS)
70
71ifdef CONFIG_IA32_EMULATION
72SUBDIRS += arch/x86_64/ia32
73CORE_FILES += arch/x86_64/ia32/ia32.o
74endif
75
76ifdef CONFIG_HOSTFS
77SUBDIRS += arch/x86_64/hostfs
78core-$(CONFIG_HOSTFS) += arch/x86_64/hostfs/hostfs.o
79endif
80
81CORE_FILES += $(core-y)
82
83arch/x86_64/tools: dummy
84	$(MAKE) linuxsubdirs SUBDIRS=arch/x86_64/tools
85
86arch/x86_64/kernel: dummy
87	$(MAKE) linuxsubdirs SUBDIRS=arch/x86_64/kernel
88
89arch/x86_64/mm: dummy
90	$(MAKE) linuxsubdirs SUBDIRS=arch/x86_64/mm
91
92MAKEBOOT = $(MAKE) -C arch/$(ARCH)/boot
93
94vmlinux: arch/x86_64/vmlinux.lds
95
96FORCE: ;
97
98.PHONY: zImage bzImage compressed zlilo bzlilo zdisk bzdisk install \
99		clean archclean archmrproper archdep checkoffset
100
101checkoffset: FORCE
102	make -C arch/$(ARCH)/tools $(TOPDIR)/include/asm-x86_64/offset.h
103
104bzImage: checkoffset vmlinux
105	@$(MAKEBOOT) bzImage
106
107bzImage-padded: checkoffset vmlinux
108	@$(MAKEBOOT) bzImage-padded
109
110tmp:
111	@$(MAKEBOOT) BOOTIMAGE=bzImage zlilo
112
113bzlilo: checkoffset vmlinux
114	@$(MAKEBOOT) BOOTIMAGE=bzImage zlilo
115
116bzdisk: checkoffset vmlinux
117	@$(MAKEBOOT) BOOTIMAGE=bzImage zdisk
118
119install: checkoffset vmlinux
120	@$(MAKEBOOT) BOOTIMAGE=bzImage install
121
122archclean:
123	@$(MAKEBOOT) clean
124	@$(MAKE) -C $(TOPDIR)/arch/x86_64/tools clean
125
126archmrproper:
127	rm -f $(TOPDIR)/arch/x86_64/tools/offset.h
128	rm -f $(TOPDIR)/arch/x86_64/tools/offset.tmp
129	rm -f $(TOPDIR)/include/asm-x86_64/offset.h
130
131archdep:
132	@$(MAKE) -C $(TOPDIR)/arch/x86_64/tools all
133	@$(MAKEBOOT) dep
134