Revert "Don't copy multiboot.bin into pc-bios after built"
[qemu-kvm/fedora.git] / pc-bios / optionrom / Makefile
blobe06ca729cbe93ae81590f98e9179378f19da5c07
1 all: build-all
3 include ../../config-host.mak
5 VPATH=$(SRC_PATH)/pc-bios/optionrom
7 # from kernel sources - scripts/Kbuild.include
8 # try-run
9 # Usage: option = $(call try-run, $(CC)...-o "$$TMP",option-ok,otherwise)
10 # Exit code chooses option. "$$TMP" is can be used as temporary file and
11 # is automatically cleaned up.
12 try-run = $(shell set -e; \
13 TMP="$(TMPOUT).$$$$.tmp"; \
14 if ($(1)) >/dev/null 2>&1; \
15 then echo "$(2)"; \
16 else echo "$(3)"; \
17 fi; \
18 rm -f "$$TMP")
20 # cc-option-yn
21 # Usage: flag := $(call cc-option-yn,-march=winchip-c6)
22 cc-option-yn = $(call try-run,\
23 $(CC) $(KBUILD_CFLAGS) $(1) -S -xc /dev/null -o "$$TMP",y,n)
25 CFLAGS = -Wall -Wstrict-prototypes -Werror -fomit-frame-pointer -fno-builtin
26 CFLAGS += -I$(SRC_PATH)
27 ifeq ($(call cc-option-yn,-fno-stack-protector),y)
28 CFLAGS += -fno-stack-protector
29 endif
31 build-all: multiboot.bin extboot.bin
33 %.o: %.S
34 $(CC) $(CFLAGS) -o $@ -c $<
36 %.img: %.o
37 $(LD) -Ttext 0 -e _start -s -o $@ $<
39 %.raw: %.img
40 $(OBJCOPY) -O binary -j .text $< $@
42 %.bin: %.raw
43 $(SRC_PATH)/pc-bios/optionrom/signrom.sh $< $@
44 cp $@ $(SRC_PATH)/pc-bios/
46 clean:
47 $(RM) *.o *.img *.bin *~