tests: acpi: add pvpanic-isa: testcase
[qemu.git] / pc-bios / optionrom / Makefile
blobf639915b4fe2aefd2c4b304f129eb8f7c3511955
1 include config.mak
2 SRC_DIR := $(TOPSRC_DIR)/pc-bios/optionrom
3 VPATH = $(SRC_DIR)
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
7 @true
9 CFLAGS = -O2 -g
11 quiet-command = $(if $(V),$1,$(if $(2),@printf " %-7s %s\n" $2 $3 && $1, @$1))
12 cc-option = $(if $(shell $(CC) $1 -c -o /dev/null -xc /dev/null >/dev/null 2>&1 && echo OK), $1, $2)
14 override CFLAGS += -march=i486 -Wall
16 # If -fcf-protection is enabled in flags or compiler defaults that will
17 # conflict with -march=i486
18 override CFLAGS += $(call cc-option, -fcf-protection=none)
20 # Flags for dependency generation
21 override CPPFLAGS += -MMD -MP -MT $@ -MF $(@D)/$(*F).d
23 override CFLAGS += $(filter -W%, $(QEMU_CFLAGS))
24 override CFLAGS += $(call cc-option, -fno-pie)
25 override CFLAGS += -ffreestanding -I$(TOPSRC_DIR)/include
26 override CFLAGS += $(call cc-option, -fno-stack-protector)
27 override CFLAGS += $(call cc-option, -m16)
28 override CFLAGS += $(call cc-option, -Wno-array-bounds)
30 ifeq ($(filter -m16, $(CFLAGS)),)
31 # Attempt to work around compilers that lack -m16 (GCC <= 4.8, clang <= ??)
32 # On GCC we add -fno-toplevel-reorder to keep the order of asm blocks with
33 # respect to the rest of the code. clang does not have -fno-toplevel-reorder,
34 # but it places all asm blocks at the beginning and we're relying on it for
35 # the option ROM header. So just force clang not to use the integrated
36 # assembler, which doesn't support .code16gcc.
37 override CFLAGS += $(call cc-option, -fno-toplevel-reorder)
38 override CFLAGS += $(call cc-option, -no-integrated-as)
39 override CFLAGS += -m32 -include $(SRC_DIR)/code16gcc.h
40 endif
42 Wa = -Wa,
43 override ASFLAGS += -32
44 override CFLAGS += $(call cc-option, $(Wa)-32)
46 override LDFLAGS = -m $(LD_I386_EMULATION) -T $(SRC_DIR)/flat.lds
48 pvh.img: pvh.o pvh_main.o
50 %.o: %.S
51 $(call quiet-command,$(CC) $(CPPFLAGS) -E -o - $< | $(AS) $(ASFLAGS) -o $@,"AS","$@")
53 %.o: %.c
54 $(call quiet-command,$(CC) $(CPPFLAGS) $(CFLAGS) -c $< -o $@,"CC","$@")
56 %.img: %.o
57 $(call quiet-command,$(LD) $(LDFLAGS) -s -o $@ $^,"BUILD","$@")
59 %.raw: %.img
60 $(call quiet-command,$(OBJCOPY) -O binary -j .text $< $@,"BUILD","$@")
62 %.bin: %.raw
63 $(call quiet-command,$(PYTHON) $(TOPSRC_DIR)/scripts/signrom.py $< $@,"SIGN","$@")
65 include $(wildcard *.d)
67 clean:
68 rm -f *.o *.d *.raw *.img *.bin *~
70 # suppress auto-removal of intermediate files
71 .SECONDARY:
73 .PHONY: all clean