56ec64f94e690de2f21aa8a6132e6323aa4141d3
[cascardo/linux.git] / arch / x86 / realmode / rm / Makefile
1 #
2 # arch/x86/realmode/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 #
9
10 subdir- := wakeup
11
12 always := realmode.bin
13
14 realmode-y                      += header.o
15 realmode-$(CONFIG_X86_32)       += reboot_32.o
16 realmode-y                      += trampoline_$(BITS).o
17
18 targets += $(realmode-y)
19
20 REALMODE_OBJS = $(addprefix $(obj)/,$(realmode-y))
21
22 sed-pasyms := -n -r -e 's/^([0-9a-fA-F]+) [ABCDGRSTVW] (.+)$$/pa_\2 = \2;/p'
23
24 quiet_cmd_pasyms = PASYMS  $@
25       cmd_pasyms = $(NM) $(filter-out FORCE,$^) | \
26                    sed $(sed-pasyms) | sort | uniq > $@
27
28 $(obj)/pasyms.h: $(REALMODE_OBJS) FORCE
29         $(call if_changed,pasyms)
30
31 $(obj)/realmode.lds: $(obj)/pasyms.h
32
33 LDFLAGS_realmode.elf := --emit-relocs -T
34 CPPFLAGS_realmode.lds += -P -C -I$(obj)
35
36 $(obj)/realmode.elf: $(obj)/realmode.lds $(REALMODE_OBJS) FORCE
37         $(call if_changed,ld)
38
39 OBJCOPYFLAGS_realmode.bin := -O binary
40
41 $(obj)/realmode.bin: $(obj)/realmode.elf
42         $(call if_changed,objcopy)
43
44 quiet_cmd_relocs = RELOCS  $@
45       cmd_relocs = scripts/x86-relocs --realmode $< > $@
46 $(obj)/realmode.relocs: $(obj)/realmode.elf FORCE
47         $(call if_changed,relocs)
48
49 # ---------------------------------------------------------------------------
50
51 # How to compile the 16-bit code.  Note we always compile for -march=i386,
52 # that way we can complain to the user if the CPU is insufficient.
53 KBUILD_CFLAGS   := $(LINUXINCLUDE) -m32 -g -Os -D_SETUP -D__KERNEL__ \
54                    -DDISABLE_BRANCH_PROFILING \
55                    -Wall -Wstrict-prototypes \
56                    -march=i386 -mregparm=3 \
57                    -include $(srctree)/$(src)/../../boot/code16gcc.h \
58                    -fno-strict-aliasing -fomit-frame-pointer \
59                    $(call cc-option, -ffreestanding) \
60                    $(call cc-option, -fno-toplevel-reorder,\
61                         $(call cc-option, -fno-unit-at-a-time)) \
62                    $(call cc-option, -fno-stack-protector) \
63                    $(call cc-option, -mpreferred-stack-boundary=2)
64 KBUILD_AFLAGS   := $(KBUILD_CFLAGS) -D__ASSEMBLY__
65 GCOV_PROFILE := n