]> git.proxmox.com Git - mirror_qemu.git/blame - pc-bios/optionrom/Makefile
Merge remote-tracking branch 'remotes/stefanha/tags/block-pull-request' into staging
[mirror_qemu.git] / pc-bios / optionrom / Makefile
CommitLineData
253d0942 1all: build-all
c05ac895
PB
2# Dummy command so that make thinks it has done something
3 @true
253d0942
AG
4
5include ../../config-host.mak
925ce05f 6include $(SRC_PATH)/rules.mak
253d0942 7
076d2471
PB
8$(call set-vpath, $(SRC_PATH)/pc-bios/optionrom)
9
4888ec26 10.PHONY : all clean build-all
253d0942 11
9d4cd7b4 12# Compiling with no optimization creates ROMs that are too large
336d5881 13ifeq ($(lastword $(filter -O%, -O0 $(CFLAGS))),-O0)
9d4cd7b4
PB
14override CFLAGS += -O2
15endif
7e018385 16override CFLAGS += -march=i486
9d4cd7b4 17
b2a575a1
MM
18# Drop -fstack-protector and the like
19QEMU_CFLAGS := $(filter -W%, $(QEMU_CFLAGS)) $(CFLAGS_NOPIE) -ffreestanding
b0e8f5ca 20QEMU_CFLAGS += $(call cc-option, $(QEMU_CFLAGS), -fno-stack-protector)
b2a575a1
MM
21QEMU_CFLAGS += $(call cc-option, $(QEMU_CFLAGS), -m16)
22ifeq ($(filter -m16, $(QEMU_CFLAGS)),)
23# Attempt to work around compilers that lack -m16 (GCC <= 4.8, clang <= ??)
24# On GCC we add -fno-toplevel-reorder to keep the order of asm blocks with
25# respect to the rest of the code. clang does not have -fno-toplevel-reorder,
26# but it places all asm blocks at the beginning and we're relying on it for
27# the option ROM header. So just force clang not to use the integrated
28# assembler, which doesn't support .code16gcc.
29QEMU_CFLAGS += $(call cc-option, $(QEMU_CFLAGS), -fno-toplevel-reorder)
30QEMU_CFLAGS += $(call cc-option, $(QEMU_CFLAGS), -no-integrated-as)
31QEMU_CFLAGS += -m32 -include $(SRC_PATH)/pc-bios/optionrom/code16gcc.h
32endif
33
b2a575a1
MM
34QEMU_INCLUDES += -I$(SRC_PATH)
35
36Wa = -Wa,
37ASFLAGS += -32
036999e9 38QEMU_CFLAGS += $(call cc-c-option, $(QEMU_CFLAGS), $(Wa)-32)
b2a575a1
MM
39
40build-all: multiboot.bin linuxboot.bin linuxboot_dma.bin kvmvapic.bin
253d0942 41
6fbcef29
JK
42# suppress auto-removal of intermediate files
43.SECONDARY:
44
b2a575a1 45
cdbd727c 46%.o: %.S
0bdb12c7 47 $(call quiet-command,$(CPP) $(QEMU_INCLUDES) $(QEMU_DGFLAGS) -c -o - $< | $(AS) $(ASFLAGS) -o $@,"AS","$(TARGET_DIR)$@")
b2a575a1 48
253d0942 49%.img: %.o
0bdb12c7 50 $(call quiet-command,$(LD) $(LDFLAGS_NOPIE) -m $(LD_I386_EMULATION) -T $(SRC_PATH)/pc-bios/optionrom/flat.lds -s -o $@ $<,"BUILD","$(TARGET_DIR)$@")
253d0942 51
7aa486fe 52%.raw: %.img
0bdb12c7 53 $(call quiet-command,$(OBJCOPY) -O binary -j .text $< $@,"BUILD","$(TARGET_DIR)$@")
7aa486fe
AL
54
55%.bin: %.raw
0bdb12c7 56 $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/signrom.py $< $@,"SIGN","$(TARGET_DIR)$@")
253d0942 57
253d0942 58clean:
3e4e4646 59 rm -f *.o *.d *.raw *.img *.bin *~