2 SRC_DIR
:= $(TOPSRC_DIR
)/pc-bios
/optionrom
5 all: multiboot.bin multiboot_dma.bin linuxboot.bin linuxboot_dma.bin kvmvapic.bin pvh.bin
6 # Dummy command so that make thinks it has done something
9 include ..
/..
/config-host.mak
12 quiet-command
= $(if
$(V
),$1,$(if
$(2),@printf
" %-7s %s\n" $2 $3 && $1, @
$1))
13 cc-option
= $(if
$(shell $(CC
) $1 -c
-o
/dev
/null
-xc
/dev
/null
>/dev
/null
2>&1 && echo OK
), $1, $2)
15 override CFLAGS
+= -march
=i486
-Wall
17 # Flags for dependency generation
18 override CPPFLAGS
+= -MMD
-MP
-MT
$@
-MF
$(@D
)/$(*F
).d
20 override CFLAGS
+= $(filter -W
%, $(QEMU_CFLAGS
))
21 override CFLAGS
+= $(CFLAGS_NOPIE
) -ffreestanding
-I
$(TOPSRC_DIR
)/include
22 override CFLAGS
+= $(call cc-option
, -fno-stack-protector
)
23 override CFLAGS
+= $(call cc-option
, -m16
)
25 ifeq ($(filter -m16
, $(CFLAGS
)),)
26 # Attempt to work around compilers that lack -m16 (GCC <= 4.8, clang <= ??)
27 # On GCC we add -fno-toplevel-reorder to keep the order of asm blocks with
28 # respect to the rest of the code. clang does not have -fno-toplevel-reorder,
29 # but it places all asm blocks at the beginning and we're relying on it for
30 # the option ROM header. So just force clang not to use the integrated
31 # assembler, which doesn't support .code16gcc.
32 override CFLAGS
+= $(call cc-option
, -fno-toplevel-reorder
)
33 override CFLAGS
+= $(call cc-option
, -no-integrated-as
)
34 override CFLAGS
+= -m32
-include $(SRC_DIR
)/code16gcc.h
38 override ASFLAGS
+= -32
39 override CFLAGS
+= $(call cc-option
, $(Wa
)-32)
41 LD_I386_EMULATION ?
= elf_i386
42 override LDFLAGS
= -m
$(LD_I386_EMULATION
) -T
$(SRC_DIR
)/flat.lds
44 pvh.img
: pvh.o pvh_main.o
47 $(call quiet-command
,$(CPP
) $(CPPFLAGS
) -c
-o
- $< |
$(AS
) $(ASFLAGS
) -o
$@
,"AS","$@")
50 $(call quiet-command
,$(CC
) $(CPPFLAGS
) $(CFLAGS
) -c
$< -o
$@
,"CC","$@")
53 $(call quiet-command
,$(LD
) $(LDFLAGS
) -s
-o
$@
$^
,"BUILD","$@")
56 $(call quiet-command
,$(OBJCOPY
) -O binary
-j .text
$< $@
,"BUILD","$@")
59 $(call quiet-command
,$(PYTHON
) $(TOPSRC_DIR
)/scripts
/signrom.py
$< $@
,"SIGN","$@")
61 include $(wildcard *.d
)
64 rm -f
*.o
*.d
*.raw
*.img
*.bin
*~
66 # suppress auto-removal of intermediate files