2021-09-15 12:56:34 +02:00
|
|
|
include config.mak
|
|
|
|
SRC_DIR := $(TOPSRC_DIR)/pc-bios/optionrom
|
2019-10-08 17:27:24 +02:00
|
|
|
VPATH = $(SRC_DIR)
|
|
|
|
|
2021-10-20 14:55:04 +02:00
|
|
|
all: multiboot.bin multiboot_dma.bin linuxboot.bin linuxboot_dma.bin kvmvapic.bin pvh.bin
|
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
|
2020-08-31 14:36:27 +02:00
|
|
|
CFLAGS = -O2 -g
|
2009-12-21 10:06:55 +01:00
|
|
|
|
2019-10-08 17:27:24 +02:00
|
|
|
quiet-command = $(if $(V),$1,$(if $(2),@printf " %-7s %s\n" $2 $3 && $1, @$1))
|
2020-08-31 14:36:27 +02:00
|
|
|
cc-option = $(if $(shell $(CC) $1 -c -o /dev/null -xc /dev/null >/dev/null 2>&1 && echo OK), $1, $2)
|
2009-06-29 15:37:40 +02:00
|
|
|
|
2020-08-31 14:36:27 +02:00
|
|
|
override CFLAGS += -march=i486 -Wall
|
2016-08-09 22:50:40 +02:00
|
|
|
|
2019-10-08 17:27:24 +02:00
|
|
|
# Flags for dependency generation
|
|
|
|
override CPPFLAGS += -MMD -MP -MT $@ -MF $(@D)/$(*F).d
|
|
|
|
|
|
|
|
override CFLAGS += $(filter -W%, $(QEMU_CFLAGS))
|
|
|
|
override CFLAGS += $(CFLAGS_NOPIE) -ffreestanding -I$(TOPSRC_DIR)/include
|
|
|
|
override CFLAGS += $(call cc-option, -fno-stack-protector)
|
|
|
|
override CFLAGS += $(call cc-option, -m16)
|
|
|
|
|
|
|
|
ifeq ($(filter -m16, $(CFLAGS)),)
|
2016-05-23 20:11:33 +02:00
|
|
|
# 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.
|
2019-10-08 17:27:24 +02:00
|
|
|
override CFLAGS += $(call cc-option, -fno-toplevel-reorder)
|
|
|
|
override CFLAGS += $(call cc-option, -no-integrated-as)
|
|
|
|
override CFLAGS += -m32 -include $(SRC_DIR)/code16gcc.h
|
2016-05-23 20:11:33 +02:00
|
|
|
endif
|
|
|
|
|
|
|
|
Wa = -Wa,
|
2019-10-08 17:27:24 +02:00
|
|
|
override ASFLAGS += -32
|
|
|
|
override CFLAGS += $(call cc-option, $(Wa)-32)
|
2016-05-23 20:11:33 +02:00
|
|
|
|
2019-10-08 17:27:24 +02:00
|
|
|
LD_I386_EMULATION ?= elf_i386
|
|
|
|
override LDFLAGS = -m $(LD_I386_EMULATION) -T $(SRC_DIR)/flat.lds
|
2012-01-30 11:27:33 +01:00
|
|
|
|
2019-10-08 17:27:24 +02:00
|
|
|
pvh.img: pvh.o pvh_main.o
|
2016-05-23 20:11:33 +02:00
|
|
|
|
2016-07-08 06:49:36 +02:00
|
|
|
%.o: %.S
|
2019-10-08 17:27:24 +02:00
|
|
|
$(call quiet-command,$(CPP) $(CPPFLAGS) -c -o - $< | $(AS) $(ASFLAGS) -o $@,"AS","$@")
|
2016-05-23 20:11:33 +02:00
|
|
|
|
2019-10-08 17:27:24 +02:00
|
|
|
%.o: %.c
|
|
|
|
$(call quiet-command,$(CC) $(CPPFLAGS) $(CFLAGS) -c $< -o $@,"CC","$@")
|
2019-01-18 13:01:41 +01:00
|
|
|
|
2009-06-29 15:37:40 +02:00
|
|
|
%.img: %.o
|
2019-10-08 17:27:24 +02:00
|
|
|
$(call quiet-command,$(LD) $(LDFLAGS) -s -o $@ $^,"BUILD","$@")
|
2009-06-29 15:37:40 +02:00
|
|
|
|
2009-07-11 15:48:29 +02:00
|
|
|
%.raw: %.img
|
2019-10-08 17:27:24 +02:00
|
|
|
$(call quiet-command,$(OBJCOPY) -O binary -j .text $< $@,"BUILD","$@")
|
2009-07-11 15:48:29 +02:00
|
|
|
|
|
|
|
%.bin: %.raw
|
2019-10-08 17:27:24 +02:00
|
|
|
$(call quiet-command,$(PYTHON) $(TOPSRC_DIR)/scripts/signrom.py $< $@,"SIGN","$@")
|
|
|
|
|
|
|
|
include $(wildcard *.d)
|
2009-06-29 15:37:40 +02:00
|
|
|
|
|
|
|
clean:
|
2009-10-06 21:11:11 +02:00
|
|
|
rm -f *.o *.d *.raw *.img *.bin *~
|
2019-10-08 17:27:24 +02:00
|
|
|
|
|
|
|
# suppress auto-removal of intermediate files
|
|
|
|
.SECONDARY:
|
|
|
|
|
|
|
|
.PHONY: all clean
|