2009-06-29 17:37:40 +04:00
|
|
|
all: build-all
|
2009-07-31 16:18:32 +04:00
|
|
|
# Dummy command so that make thinks it has done something
|
|
|
|
@true
|
2009-06-29 17:37:40 +04:00
|
|
|
|
|
|
|
include ../../config-host.mak
|
2009-07-27 23:59:36 +04:00
|
|
|
include $(SRC_PATH)/rules.mak
|
2009-06-29 17:37:40 +04:00
|
|
|
|
2009-12-21 12:06:55 +03:00
|
|
|
$(call set-vpath, $(SRC_PATH)/pc-bios/optionrom)
|
|
|
|
|
2009-10-06 23:11:13 +04:00
|
|
|
.PHONY : all clean build-all
|
2009-06-29 17:37:40 +04:00
|
|
|
|
2016-05-23 21:11:33 +03:00
|
|
|
# Drop -fstack-protector and the like
|
|
|
|
QEMU_CFLAGS := $(filter -W%, $(QEMU_CFLAGS)) $(CFLAGS_NOPIE) -ffreestanding
|
2016-08-08 11:57:35 +03:00
|
|
|
QEMU_CFLAGS += $(call cc-option, $(QEMU_CFLAGS), -fno-stack-protector)
|
2016-05-23 21:11:33 +03:00
|
|
|
QEMU_CFLAGS += $(call cc-option, $(QEMU_CFLAGS), -m16)
|
|
|
|
ifeq ($(filter -m16, $(QEMU_CFLAGS)),)
|
|
|
|
# Attempt to work around compilers that lack -m16 (GCC <= 4.8, clang <= ??)
|
|
|
|
# On GCC we add -fno-toplevel-reorder to keep the order of asm blocks with
|
|
|
|
# respect to the rest of the code. clang does not have -fno-toplevel-reorder,
|
|
|
|
# but it places all asm blocks at the beginning and we're relying on it for
|
|
|
|
# the option ROM header. So just force clang not to use the integrated
|
|
|
|
# assembler, which doesn't support .code16gcc.
|
|
|
|
QEMU_CFLAGS += $(call cc-option, $(QEMU_CFLAGS), -fno-toplevel-reorder)
|
|
|
|
QEMU_CFLAGS += $(call cc-option, $(QEMU_CFLAGS), -no-integrated-as)
|
|
|
|
QEMU_CFLAGS += -m32 -include $(SRC_PATH)/pc-bios/optionrom/code16gcc.h
|
|
|
|
endif
|
|
|
|
|
|
|
|
QEMU_INCLUDES += -I$(SRC_PATH)
|
|
|
|
|
|
|
|
Wa = -Wa,
|
|
|
|
ASFLAGS += -32
|
2016-07-20 22:36:49 +03:00
|
|
|
QEMU_CFLAGS += $(call cc-c-option, $(QEMU_CFLAGS), $(Wa)-32)
|
2016-05-23 21:11:33 +03:00
|
|
|
|
|
|
|
build-all: multiboot.bin linuxboot.bin linuxboot_dma.bin kvmvapic.bin
|
2009-06-29 17:37:40 +04:00
|
|
|
|
2012-01-30 14:27:33 +04:00
|
|
|
# suppress auto-removal of intermediate files
|
|
|
|
.SECONDARY:
|
|
|
|
|
2016-05-23 21:11:33 +03:00
|
|
|
|
2016-07-08 07:49:36 +03:00
|
|
|
%.o: %.S
|
2016-05-23 21:11:33 +03:00
|
|
|
$(call quiet-command,$(CPP) $(QEMU_INCLUDES) $(QEMU_DGFLAGS) -c -o - $< | $(AS) $(ASFLAGS) -o $@," AS $(TARGET_DIR)$@")
|
|
|
|
|
|
|
|
ifdef CONFIG_WIN32
|
|
|
|
LD_EMULATION = i386pe
|
|
|
|
else
|
2016-07-27 00:05:33 +03:00
|
|
|
ifdef CONFIG_BSD
|
|
|
|
LD_EMULATION = elf_i386_fbsd
|
|
|
|
else
|
2016-05-23 21:11:33 +03:00
|
|
|
LD_EMULATION = elf_i386
|
|
|
|
endif
|
2016-07-27 00:05:33 +03:00
|
|
|
endif
|
2016-07-08 07:49:36 +03:00
|
|
|
|
2009-06-29 17:37:40 +04:00
|
|
|
%.img: %.o
|
2016-05-23 21:11:33 +03:00
|
|
|
$(call quiet-command,$(LD) $(LDFLAGS_NOPIE) -m $(LD_EMULATION) -Ttext 0 -e _start -s -o $@ $<," Building $(TARGET_DIR)$@")
|
2009-06-29 17:37:40 +04:00
|
|
|
|
2009-07-11 17:48:29 +04:00
|
|
|
%.raw: %.img
|
2009-07-21 16:11:19 +04:00
|
|
|
$(call quiet-command,$(OBJCOPY) -O binary -j .text $< $@," Building $(TARGET_DIR)$@")
|
2009-07-11 17:48:29 +04:00
|
|
|
|
|
|
|
%.bin: %.raw
|
2012-01-27 22:44:53 +04:00
|
|
|
$(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/signrom.py $< $@," Signing $(TARGET_DIR)$@")
|
2009-06-29 17:37:40 +04:00
|
|
|
|
|
|
|
clean:
|
2009-10-06 23:11:11 +04:00
|
|
|
rm -f *.o *.d *.raw *.img *.bin *~
|