2 # Dummy command so that make thinks it has done something
5 include ..
/..
/config-host.mak
6 include $(SRC_PATH
)/rules.mak
8 $(call set-vpath
, $(SRC_PATH
)/pc-bios
/optionrom
)
10 .PHONY
: all clean build-all
12 # Compiling with no optimization creates ROMs that are too large
13 ifeq ($(filter -O
%, $(CFLAGS
)),)
14 override CFLAGS
+= -O2
16 ifeq ($(filter -O
%, $(CFLAGS
)),-O0
)
17 override CFLAGS
+= -O2
20 # Drop -fstack-protector and the like
21 QEMU_CFLAGS
:= $(filter -W
%, $(QEMU_CFLAGS
)) $(CFLAGS_NOPIE
) -ffreestanding
22 QEMU_CFLAGS
+= $(call cc-option
, $(QEMU_CFLAGS
), -fno-stack-protector
)
23 QEMU_CFLAGS
+= $(call cc-option
, $(QEMU_CFLAGS
), -m16
)
24 ifeq ($(filter -m16
, $(QEMU_CFLAGS
)),)
25 # Attempt to work around compilers that lack -m16 (GCC <= 4.8, clang <= ??)
26 # On GCC we add -fno-toplevel-reorder to keep the order of asm blocks with
27 # respect to the rest of the code. clang does not have -fno-toplevel-reorder,
28 # but it places all asm blocks at the beginning and we're relying on it for
29 # the option ROM header. So just force clang not to use the integrated
30 # assembler, which doesn't support .code16gcc.
31 QEMU_CFLAGS
+= $(call cc-option
, $(QEMU_CFLAGS
), -fno-toplevel-reorder
)
32 QEMU_CFLAGS
+= $(call cc-option
, $(QEMU_CFLAGS
), -no-integrated-as
)
33 QEMU_CFLAGS
+= -m32
-include $(SRC_PATH
)/pc-bios
/optionrom
/code16gcc.h
36 QEMU_INCLUDES
+= -I
$(SRC_PATH
)
40 QEMU_CFLAGS
+= $(call cc-c-option
, $(QEMU_CFLAGS
), $(Wa
)-32)
42 build-all
: multiboot.bin linuxboot.bin linuxboot_dma.bin kvmvapic.bin
44 # suppress auto-removal of intermediate files
49 $(call quiet-command
,$(CPP
) $(QEMU_INCLUDES
) $(QEMU_DGFLAGS
) -c
-o
- $< |
$(AS
) $(ASFLAGS
) -o
$@
," AS $(TARGET_DIR)$@")
55 LD_EMULATION
= elf_i386_fbsd
57 LD_EMULATION
= elf_i386
62 $(call quiet-command
,$(LD
) $(LDFLAGS_NOPIE
) -m
$(LD_EMULATION
) -T
$(SRC_PATH
)/pc-bios
/optionrom
/flat.lds
-s
-o
$@
$<," Building $(TARGET_DIR)$@")
65 $(call quiet-command
,$(OBJCOPY
) -O binary
-j .text
$< $@
," Building $(TARGET_DIR)$@")
68 $(call quiet-command
,$(PYTHON
) $(SRC_PATH
)/scripts
/signrom.py
$< $@
," Signing $(TARGET_DIR)$@")
71 rm -f
*.o
*.d
*.raw
*.img
*.bin
*~