1all: build-all 2# Dummy command so that make thinks it has done something 3 @true 4 5include ../../config-host.mak 6include $(SRC_PATH)/rules.mak 7 8$(call set-vpath, $(SRC_PATH)/pc-bios/optionrom) 9 10.PHONY : all clean build-all 11 12# Drop -fstack-protector and the like 13QEMU_CFLAGS := $(filter -W%, $(QEMU_CFLAGS)) $(CFLAGS_NOPIE) -ffreestanding 14QEMU_CFLAGS += $(call cc-option, $(QEMU_CFLAGS), -m16) 15ifeq ($(filter -m16, $(QEMU_CFLAGS)),) 16# Attempt to work around compilers that lack -m16 (GCC <= 4.8, clang <= ??) 17# On GCC we add -fno-toplevel-reorder to keep the order of asm blocks with 18# respect to the rest of the code. clang does not have -fno-toplevel-reorder, 19# but it places all asm blocks at the beginning and we're relying on it for 20# the option ROM header. So just force clang not to use the integrated 21# assembler, which doesn't support .code16gcc. 22QEMU_CFLAGS += $(call cc-option, $(QEMU_CFLAGS), -fno-toplevel-reorder) 23QEMU_CFLAGS += $(call cc-option, $(QEMU_CFLAGS), -no-integrated-as) 24QEMU_CFLAGS += -m32 -include $(SRC_PATH)/pc-bios/optionrom/code16gcc.h 25endif 26 27# Drop gcov and glib flags 28CFLAGS := $(filter -O% -g%, $(CFLAGS)) 29QEMU_INCLUDES += -I$(SRC_PATH) 30 31Wa = -Wa, 32ASFLAGS += -32 33QEMU_CFLAGS += $(call cc-c-option, $(QEMU_CFLAGS), $(Wa)-32) 34 35build-all: multiboot.bin linuxboot.bin linuxboot_dma.bin kvmvapic.bin 36 37# suppress auto-removal of intermediate files 38.SECONDARY: 39 40 41%.o: %.S 42 $(call quiet-command,$(CPP) $(QEMU_INCLUDES) $(QEMU_DGFLAGS) -c -o - $< | $(AS) $(ASFLAGS) -o $@," AS $(TARGET_DIR)$@") 43 44ifdef CONFIG_WIN32 45LD_EMULATION = i386pe 46else 47ifdef CONFIG_BSD 48LD_EMULATION = elf_i386_fbsd 49else 50LD_EMULATION = elf_i386 51endif 52endif 53 54%.img: %.o 55 $(call quiet-command,$(LD) $(LDFLAGS_NOPIE) -m $(LD_EMULATION) -Ttext 0 -e _start -s -o $@ $<," Building $(TARGET_DIR)$@") 56 57%.raw: %.img 58 $(call quiet-command,$(OBJCOPY) -O binary -j .text $< $@," Building $(TARGET_DIR)$@") 59 60%.bin: %.raw 61 $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/signrom.py $< $@," Signing $(TARGET_DIR)$@") 62 63clean: 64 rm -f *.o *.d *.raw *.img *.bin *~ 65