--- qemu/pc-bios/optionrom/Makefile 2018/04/24 17:26:48 1.1 +++ qemu/pc-bios/optionrom/Makefile 2018/04/24 18:41:43 1.1.1.4 @@ -3,46 +3,27 @@ all: build-all @true include ../../config-host.mak +include $(SRC_PATH)/rules.mak -VPATH=$(SRC_PATH)/pc-bios/optionrom +$(call set-vpath, $(SRC_PATH)/pc-bios/optionrom) -# from kernel sources - scripts/Kbuild.include -# try-run -# Usage: option = $(call try-run, $(CC)...-o "$$TMP",option-ok,otherwise) -# Exit code chooses option. "$$TMP" is can be used as temporary file and -# is automatically cleaned up. -try-run = $(shell set -e; \ - TMP="$(TMPOUT).$$$$.tmp"; \ - if ($(1)) >/dev/null 2>&1; \ - then echo "$(2)"; \ - else echo "$(3)"; \ - fi; \ - rm -f "$$TMP") - -# cc-option-yn -# Usage: flag := $(call cc-option-yn,-march=winchip-c6) -cc-option-yn = $(call try-run,\ - $(CC) $(KBUILD_CFLAGS) $(1) -S -xc /dev/null -o "$$TMP",y,n) +.PHONY : all clean build-all -CFLAGS = -Wall -Wstrict-prototypes -Werror -fomit-frame-pointer -fno-builtin +CFLAGS := -Wall -Wstrict-prototypes -Werror -fomit-frame-pointer -fno-builtin CFLAGS += -I$(SRC_PATH) -ifeq ($(call cc-option-yn,-fno-stack-protector),y) -CFLAGS += -fno-stack-protector -endif +CFLAGS += $(call cc-option, $(CFLAGS), -fno-stack-protector) +QEMU_CFLAGS = $(CFLAGS) -build-all: multiboot.bin - -%.o: %.S - $(CC) $(CFLAGS) -o $@ -c $< +build-all: multiboot.bin linuxboot.bin %.img: %.o - $(LD) -Ttext 0 -e _start -s -o $@ $< + $(call quiet-command,$(LD) -Ttext 0 -e _start -s -o $@ $<," Building $(TARGET_DIR)$@") %.raw: %.img - $(OBJCOPY) -O binary -j .text $< $@ + $(call quiet-command,$(OBJCOPY) -O binary -j .text $< $@," Building $(TARGET_DIR)$@") %.bin: %.raw - $(SRC_PATH)/pc-bios/optionrom/signrom.sh $< $@ + $(call quiet-command,$(SHELL) $(SRC_PATH)/scripts/signrom.sh $< $@," Signing $(TARGET_DIR)$@") clean: - $(RM) *.o *.img *.bin *~ + rm -f *.o *.d *.raw *.img *.bin *~