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
|
|
|
|
2020-08-31 14:36:27 +02:00
|
|
|
CFLAGS = -O2 -g
|
2009-12-21 10:06:55 +01:00
|
|
|
|
2022-09-29 13:41:53 +02:00
|
|
|
NULL :=
|
|
|
|
SPACE := $(NULL) #
|
|
|
|
TARGET_PREFIX := $(patsubst %/,%:$(SPACE),$(TARGET_DIR))
|
2016-08-09 22:50:40 +02:00
|
|
|
|
2022-09-29 13:42:09 +02:00
|
|
|
quiet-@ = $(if $(V),,@$(if $1,printf "%s\n" "$(TARGET_PREFIX)$1" && ))
|
|
|
|
quiet-command = $(call quiet-@,$2 $@)$1
|
2022-03-23 10:07:13 +01:00
|
|
|
|
2019-10-08 17:27:24 +02:00
|
|
|
# Flags for dependency generation
|
|
|
|
override CPPFLAGS += -MMD -MP -MT $@ -MF $(@D)/$(*F).d
|
|
|
|
|
2022-09-29 13:41:53 +02:00
|
|
|
override CFLAGS += -march=i486 -Wall $(EXTRA_CFLAGS) -m16
|
2022-03-29 13:01:58 +02:00
|
|
|
override CFLAGS += -ffreestanding -I$(TOPSRC_DIR)/include
|
2022-09-29 13:41:53 +02:00
|
|
|
|
|
|
|
cc-test = $(CC) -Werror $1 -c -o /dev/null -xc /dev/null >/dev/null 2>/dev/null
|
|
|
|
cc-option = if $(call cc-test, $1); then \
|
|
|
|
echo "$(TARGET_PREFIX)$1 detected" && echo "override CFLAGS += $1" >&3; else \
|
|
|
|
echo "$(TARGET_PREFIX)$1 not detected" $(if $2,&& echo "override CFLAGS += $2" >&3); fi
|
|
|
|
|
|
|
|
# If -fcf-protection is enabled in flags or compiler defaults that will
|
|
|
|
# conflict with -march=i486
|
|
|
|
config-cc.mak: Makefile
|
|
|
|
$(quiet-@)($(call cc-option,-fcf-protection=none); \
|
|
|
|
$(call cc-option,-fno-pie); \
|
|
|
|
$(call cc-option,-no-pie); \
|
|
|
|
$(call cc-option,-fno-stack-protector); \
|
|
|
|
$(call cc-option,-Wno-array-bounds)) 3> config-cc.mak
|
|
|
|
-include config-cc.mak
|
2019-10-08 17:27:24 +02:00
|
|
|
|
2023-09-26 21:25:02 +02:00
|
|
|
override LDFLAGS = -nostdlib -Wl,--build-id=none,-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
|
2022-09-29 13:42:09 +02:00
|
|
|
$(call quiet-command,$(CC) $(CPPFLAGS) $(CFLAGS) -c -o $@ $<,Assembling)
|
2016-05-23 20:11:33 +02:00
|
|
|
|
2019-10-08 17:27:24 +02:00
|
|
|
%.o: %.c
|
2022-09-29 13:42:09 +02:00
|
|
|
$(call quiet-command,$(CC) $(CPPFLAGS) $(CFLAGS) -c $< -o $@,Compiling)
|
2019-01-18 13:01:41 +01:00
|
|
|
|
2009-06-29 15:37:40 +02:00
|
|
|
%.img: %.o
|
2022-09-29 13:42:09 +02:00
|
|
|
$(call quiet-command,$(CC) $(CFLAGS) $(LDFLAGS) -s -o $@ $^,Linking)
|
2009-06-29 15:37:40 +02:00
|
|
|
|
2009-07-11 15:48:29 +02:00
|
|
|
%.raw: %.img
|
2022-09-29 13:42:09 +02:00
|
|
|
$(call quiet-command,$(OBJCOPY) -O binary -j .text $< $@,Extracting raw object)
|
2009-07-11 15:48:29 +02:00
|
|
|
|
|
|
|
%.bin: %.raw
|
2022-09-29 13:42:09 +02:00
|
|
|
$(call quiet-command,$(PYTHON) $(TOPSRC_DIR)/scripts/signrom.py $< $@,Computing checksum into)
|
2019-10-08 17:27:24 +02:00
|
|
|
|
|
|
|
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
|
|
|
|
2022-09-29 13:41:53 +02:00
|
|
|
distclean:
|
|
|
|
rm -f config-cc.mak
|
|
|
|
|
2019-10-08 17:27:24 +02:00
|
|
|
# suppress auto-removal of intermediate files
|
|
|
|
.SECONDARY:
|
|
|
|
|
2022-09-29 13:41:53 +02:00
|
|
|
.PHONY: all clean distclean
|