1#
2# i386/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#
18
19LD=$(CROSS_COMPILE)ld -m elf_i386
20OBJCOPY=$(CROSS_COMPILE)objcopy -O binary -R .note -R .comment -S
21LDFLAGS=-e stext
22LINKFLAGS =-T $(TOPDIR)/arch/i386/vmlinux.lds $(LDFLAGS)
23
24CFLAGS += -pipe
25
26# prevent gcc from keeping the stack 16 byte aligned
27CFLAGS += $(call check_gcc,-mpreferred-stack-boundary=2,)
28
29ifdef CONFIG_M386
30CFLAGS += -march=i386
31endif
32
33ifdef CONFIG_M486
34CFLAGS += -march=i486
35endif
36
37ifdef CONFIG_M586
38CFLAGS += -march=i586
39endif
40
41ifdef CONFIG_M586TSC
42CFLAGS += -march=i586
43endif
44
45ifdef CONFIG_M586MMX
46CFLAGS += -march=i586
47endif
48
49ifdef CONFIG_M686
50CFLAGS += -march=i686
51endif
52
53ifdef CONFIG_MPENTIUMIII
54CFLAGS += -march=i686
55endif
56
57ifdef CONFIG_MPENTIUM4
58CFLAGS += -march=i686
59endif
60
61ifdef CONFIG_MK6
62CFLAGS += $(call check_gcc,-march=k6,-march=i586)
63endif
64
65ifdef CONFIG_MK7
66CFLAGS += $(call check_gcc,-march=athlon,-march=i686 -malign-functions=4)
67endif
68
69ifdef CONFIG_MCRUSOE
70CFLAGS += -march=i686
71CFLAGS += $(call check_gcc,-falign-functions=0 -falign-jumps=0 -falign-loops=0,-malign-functions=0 -malign-jumps=0 -malign-loops=0)
72endif
73
74ifdef CONFIG_MGEODE_LX
75CFLAGS += -march=i686
76endif
77
78ifdef CONFIG_MWINCHIPC6
79CFLAGS += -march=i586
80endif
81
82ifdef CONFIG_MWINCHIP2
83CFLAGS += -march=i586
84endif
85
86ifdef CONFIG_MWINCHIP3D
87CFLAGS += -march=i586
88endif
89
90ifdef CONFIG_MCYRIXIII
91CFLAGS += $(call check_gcc,-march=c3,-march=i486)
92CFLAGS += $(call check_gcc,-falign-functions=0 -falign-jumps=0 -falign-loops=0,-malign-functions=0 -malign-jumps=0 -malign-loops=0)
93endif
94
95ifdef CONFIG_MVIAC3_2
96CFLAGS += $(call check_gcc,-march=c3-2,-march=i686)
97endif
98
99# Disable unit-at-a-time mode on pre-gcc-4.0 compilers, it makes gcc use
100# a lot more stack due to the lack of sharing of stacklots.
101# CFLAGS += $(call if_gcc4,,$(call check_gcc,-fno-unit-at-a-time,))
102# Disable unit-at-a-time on gcc >= 4 too, because it removes seemingly unused
103# variables which are indeed module params.
104CFLAGS += $(call check_gcc,-fno-unit-at-a-time,)
105
106HEAD := arch/i386/kernel/head.o arch/i386/kernel/init_task.o
107
108SUBDIRS += arch/i386/kernel arch/i386/mm arch/i386/lib
109
110CORE_FILES := arch/i386/kernel/kernel.o arch/i386/mm/mm.o $(CORE_FILES)
111LIBS := $(TOPDIR)/arch/i386/lib/lib.a $(LIBS) $(TOPDIR)/arch/i386/lib/lib.a
112
113ifdef CONFIG_MATH_EMULATION
114SUBDIRS += arch/i386/math-emu
115DRIVERS += arch/i386/math-emu/math.o
116endif
117
118arch/i386/kernel: dummy
119	$(MAKE) linuxsubdirs SUBDIRS=arch/i386/kernel
120
121arch/i386/mm: dummy
122	$(MAKE) linuxsubdirs SUBDIRS=arch/i386/mm
123
124MAKEBOOT = $(MAKE) -C arch/$(ARCH)/boot
125
126vmlinux: arch/i386/vmlinux.lds
127
128FORCE: ;
129
130.PHONY: zImage bzImage compressed zlilo bzlilo zdisk bzdisk install \
131		clean archclean archmrproper archdep
132
133zImage: vmlinux
134	@$(MAKEBOOT) zImage
135
136bzImage: vmlinux
137	@$(MAKEBOOT) bzImage
138
139compressed: zImage
140
141zlilo: vmlinux
142	@$(MAKEBOOT) BOOTIMAGE=zImage zlilo
143
144tmp:
145	@$(MAKEBOOT) BOOTIMAGE=bzImage zlilo
146bzlilo: vmlinux
147	@$(MAKEBOOT) BOOTIMAGE=bzImage zlilo
148
149zdisk: vmlinux
150	@$(MAKEBOOT) BOOTIMAGE=zImage zdisk
151
152bzdisk: vmlinux
153	@$(MAKEBOOT) BOOTIMAGE=bzImage zdisk
154
155install: vmlinux
156	@$(MAKEBOOT) BOOTIMAGE=bzImage install
157
158archclean:
159	@$(MAKEBOOT) clean
160
161archmrproper:
162
163archdep:
164	@$(MAKEBOOT) dep
165