]> git.proxmox.com Git - mirror_qemu.git/blame - pc-bios/optionrom/Makefile
move cc-option definition to rules.mak
[mirror_qemu.git] / pc-bios / optionrom / Makefile
CommitLineData
253d0942
AG
1all: build-all
2
3include ../../config-host.mak
4
5VPATH=$(SRC_PATH)/pc-bios/optionrom
253d0942
AG
6
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.
12try-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")
19
20# cc-option-yn
21# Usage: flag := $(call cc-option-yn,-march=winchip-c6)
22cc-option-yn = $(call try-run,\
23 $(CC) $(KBUILD_CFLAGS) $(1) -S -xc /dev/null -o "$$TMP",y,n)
24
25CFLAGS = -Wall -Wstrict-prototypes -Werror -fomit-frame-pointer -fno-builtin
26CFLAGS += -I$(SRC_PATH)
27ifeq ($(call cc-option-yn,-fno-stack-protector),y)
28CFLAGS += -fno-stack-protector
29endif
30
31build-all: multiboot.bin
32
33%.o: %.S
34 $(CC) $(CFLAGS) -o $@ -c $<
35
36%.img: %.o
7aa486fe 37 $(LD) -Ttext 0 -e _start -s -o $@ $<
253d0942 38
7aa486fe
AL
39%.raw: %.img
40 $(OBJCOPY) -O binary -j .text $< $@
41
42%.bin: %.raw
89e671e3 43 $(SRC_PATH)/pc-bios/optionrom/signrom.sh $< $@
253d0942 44
253d0942 45clean:
89e671e3 46 $(RM) *.o *.img *.bin *~