Option rom makefile fixes
[qemu-kvm/fedora.git] / pc-bios / optionrom / Makefile
blobe7ad4b198ae586d540eb19a9f48ee763c5df6916
1 all: build-all
2 # Dummy command so that make thinks it has done something
3 @true
5 include ../../config-host.mak
7 VPATH=$(SRC_PATH)/pc-bios/optionrom
9 # from kernel sources - scripts/Kbuild.include
10 # try-run
11 # Usage: option = $(call try-run, $(CC)...-o "$$TMP",option-ok,otherwise)
12 # Exit code chooses option. "$$TMP" is can be used as temporary file and
13 # is automatically cleaned up.
14 try-run = $(shell set -e; \
15 TMP="$(TMPOUT).$$$$.tmp"; \
16 if ($(1)) >/dev/null 2>&1; \
17 then echo "$(2)"; \
18 else echo "$(3)"; \
19 fi; \
20 rm -f "$$TMP")
22 # cc-option-yn
23 # Usage: flag := $(call cc-option-yn,-march=winchip-c6)
24 cc-option-yn = $(call try-run,\
25 $(CC) $(KBUILD_CFLAGS) $(1) -S -xc /dev/null -o "$$TMP",y,n)
27 CFLAGS = -Wall -Wstrict-prototypes -Werror -fomit-frame-pointer -fno-builtin
28 CFLAGS += -I$(SRC_PATH)
29 ifeq ($(call cc-option-yn,-fno-stack-protector),y)
30 CFLAGS += -fno-stack-protector
31 endif
33 build-all: multiboot.bin
35 %.o: %.S
36 $(CC) $(CFLAGS) -o $@ -c $<
38 %.img: %.o
39 $(LD) -Ttext 0 -e _start -s -o $@ $<
41 %.raw: %.img
42 $(OBJCOPY) -O binary -j .text $< $@
44 %.bin: %.raw
45 $(SRC_PATH)/pc-bios/optionrom/signrom.sh $< $@
47 clean:
48 $(RM) *.o *.img *.bin *~