import of upstream 2.4.34.4 from kernel.org
[linux-2.4.git] / arch / x86_64 / Makefile
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
28 IA32_CC := $(CROSS_COMPILE)gcc -m32 -O2 -fomit-frame-pointer -nostdinc -I $(HPATH)
29 IA32_LD := $(CROSS_COMPILE)ld -m elf_i386
30 IA32_AS := $(CROSS_COMPILE)gcc -m32 -Wa,--32 -D__ASSEMBLY__ -traditional -c -nostdinc -I $(HPATH) 
31 IA32_OBJCOPY := $(CROSS_COMPILE)objcopy
32 IA32_CPP := $(CROSS_COMPILE)gcc -m32 -E
33 export IA32_CC IA32_LD IA32_AS IA32_OBJCOPY IA32_CPP
34
35
36 LD=$(CROSS_COMPILE)ld -m elf_x86_64
37 OBJCOPY=$(CROSS_COMPILE)objcopy -O binary -R .note -R .comment -S
38 LDFLAGS=-e stext
39 LINKFLAGS =-T $(TOPDIR)/arch/x86_64/vmlinux.lds $(LDFLAGS)
40
41 CFLAGS += -mno-red-zone
42 CFLAGS += -mcmodel=kernel
43 CFLAGS += -pipe
44 CFLAGS += -fno-reorder-blocks
45 # needed for later gcc 3.1
46 CFLAGS += -finline-limit=2000
47 # needed for earlier gcc 3.1
48 CFLAGS += -fno-strength-reduce
49 CFLAGS += -Wno-sign-compare
50 #CFLAGS += -g
51 ifneq ($(CONFIG_X86_REMOTE_DEBUG),y)
52 CFLAGS += -fno-asynchronous-unwind-tables
53 endif
54 # this is needed right now for the 32bit ioctl code
55 CFLAGS += $(call check_gcc,-fno-unit-at-a-time,)
56
57 ifdef CONFIG_MK8
58 CFLAGS += $(call check_gcc,-march=k8,)
59 endif
60 ifdef CONFIG_MPSC
61 CFLAGS += $(call check_gcc,-march=nocona,)
62 endif
63
64 HEAD := arch/x86_64/kernel/head.o arch/x86_64/kernel/head64.o arch/x86_64/kernel/init_task.o
65
66 SUBDIRS := arch/x86_64/tools $(SUBDIRS) arch/x86_64/kernel arch/x86_64/mm arch/x86_64/lib
67 CORE_FILES := arch/x86_64/kernel/kernel.o $(CORE_FILES)
68 CORE_FILES +=  arch/x86_64/mm/mm.o
69 LIBS := $(TOPDIR)/arch/x86_64/lib/lib.a $(LIBS)
70
71 ifdef CONFIG_IA32_EMULATION
72 SUBDIRS += arch/x86_64/ia32
73 CORE_FILES += arch/x86_64/ia32/ia32.o
74 endif
75
76 ifdef CONFIG_HOSTFS
77 SUBDIRS += arch/x86_64/hostfs
78 core-$(CONFIG_HOSTFS) += arch/x86_64/hostfs/hostfs.o
79 endif
80
81 CORE_FILES += $(core-y)
82
83 arch/x86_64/tools: dummy
84         $(MAKE) linuxsubdirs SUBDIRS=arch/x86_64/tools 
85
86 arch/x86_64/kernel: dummy 
87         $(MAKE) linuxsubdirs SUBDIRS=arch/x86_64/kernel
88
89 arch/x86_64/mm: dummy
90         $(MAKE) linuxsubdirs SUBDIRS=arch/x86_64/mm
91
92 MAKEBOOT = $(MAKE) -C arch/$(ARCH)/boot
93
94 vmlinux: arch/x86_64/vmlinux.lds
95
96 FORCE: ;
97
98 .PHONY: zImage bzImage compressed zlilo bzlilo zdisk bzdisk install \
99                 clean archclean archmrproper archdep checkoffset
100
101 checkoffset: FORCE
102         make -C arch/$(ARCH)/tools $(TOPDIR)/include/asm-x86_64/offset.h
103
104 bzImage: checkoffset vmlinux
105         @$(MAKEBOOT) bzImage
106
107 bzImage-padded: checkoffset vmlinux
108         @$(MAKEBOOT) bzImage-padded
109
110 tmp:
111         @$(MAKEBOOT) BOOTIMAGE=bzImage zlilo
112
113 bzlilo: checkoffset vmlinux
114         @$(MAKEBOOT) BOOTIMAGE=bzImage zlilo
115
116 bzdisk: checkoffset vmlinux
117         @$(MAKEBOOT) BOOTIMAGE=bzImage zdisk
118
119 install: checkoffset vmlinux
120         @$(MAKEBOOT) BOOTIMAGE=bzImage install
121
122 archclean:
123         @$(MAKEBOOT) clean
124         @$(MAKE) -C $(TOPDIR)/arch/x86_64/tools clean
125
126 archmrproper:
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
131 archdep:
132         @$(MAKE) -C $(TOPDIR)/arch/x86_64/tools all
133         @$(MAKEBOOT) dep