2009-06-29 15:37:40 +02:00
|
|
|
all: build-all
|
2009-07-31 14:18:32 +02:00
|
|
|
# Dummy command so that make thinks it has done something
|
|
|
|
@true
|
2009-06-29 15:37:40 +02:00
|
|
|
|
|
|
|
include ../../config-host.mak
|
2009-07-27 21:59:36 +02:00
|
|
|
include $(SRC_PATH)/rules.mak
|
2009-06-29 15:37:40 +02:00
|
|
|
|
2009-12-21 10:06:55 +01:00
|
|
|
$(call set-vpath, $(SRC_PATH)/pc-bios/optionrom)
|
|
|
|
|
2009-10-06 21:11:13 +02:00
|
|
|
.PHONY : all clean build-all
|
2009-06-29 15:37:40 +02:00
|
|
|
|
2016-05-23 20:11:33 +02:00
|
|
|
# Drop -fstack-protector and the like
|
|
|
|
QEMU_CFLAGS := $(filter -W%, $(QEMU_CFLAGS)) $(CFLAGS_NOPIE) -ffreestanding
|
|
|
|
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 21:36:49 +02:00
|
|
|
QEMU_CFLAGS += $(call cc-c-option, $(QEMU_CFLAGS), $(Wa)-32)
|
2016-05-23 20:11:33 +02:00
|
|
|
|
|
|
|
build-all: multiboot.bin linuxboot.bin linuxboot_dma.bin kvmvapic.bin
|
2009-06-29 15:37:40 +02:00
|
|
|
|
2012-01-30 11:27:33 +01:00
|
|
|
# suppress auto-removal of intermediate files
|
|
|
|
.SECONDARY:
|
|
|
|
|
2016-05-23 20:11:33 +02:00
|
|
|
|
2016-07-08 06:49:36 +02:00
|
|
|
%.o: %.S
|
2016-05-23 20:11:33 +02: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-26 23:05:33 +02:00
|
|
|
ifdef CONFIG_BSD
|
|
|
|
LD_EMULATION = elf_i386_fbsd
|
|
|
|
else
|
2016-05-23 20:11:33 +02:00
|
|
|
LD_EMULATION = elf_i386
|
|
|
|
endif
|
2016-07-26 23:05:33 +02:00
|
|
|
endif
|
2016-07-08 06:49:36 +02:00
|
|
|
|
2009-06-29 15:37:40 +02:00
|
|
|
%.img: %.o
|
2016-05-23 20:11:33 +02:00
|
|
|
$(call quiet-command,$(LD) $(LDFLAGS_NOPIE) -m $(LD_EMULATION) -Ttext 0 -e _start -s -o $@ $<," Building $(TARGET_DIR)$@")
|
2009-06-29 15:37:40 +02:00
|
|
|
|
2009-07-11 15:48:29 +02:00
|
|
|
%.raw: %.img
|
2009-07-21 14:11:19 +02:00
|
|
|
$(call quiet-command,$(OBJCOPY) -O binary -j .text $< $@," Building $(TARGET_DIR)$@")
|
2009-07-11 15:48:29 +02:00
|
|
|
|
|
|
|
%.bin: %.raw
|
2012-01-27 19:44:53 +01:00
|
|
|
$(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/signrom.py $< $@," Signing $(TARGET_DIR)$@")
|
2009-06-29 15:37:40 +02:00
|
|
|
|
|
|
|
clean:
|
2009-10-06 21:11:11 +02:00
|
|
|
rm -f *.o *.d *.raw *.img *.bin *~
|