Merge branch 'upstream-merge' into next
[qemu/qemu-dev-zwu.git] / kvm / extboot / Makefile
blobab2dae70df3bd7a11080f51e1bade0e39ca02600
1 OBJCOPY=objcopy
3 # from kernel sources - scripts/Kbuild.include
4 # try-run
5 # Usage: option = $(call try-run, $(CC)...-o "$$TMP",option-ok,otherwise)
6 # Exit code chooses option. "$$TMP" is can be used as temporary file and
7 # is automatically cleaned up.
8 try-run = $(shell set -e; \
9 TMP="$(TMPOUT).$$$$.tmp"; \
10 if ($(1)) >/dev/null 2>&1; \
11 then echo "$(2)"; \
12 else echo "$(3)"; \
13 fi; \
14 rm -f "$$TMP")
16 # cc-option-yn
17 # Usage: flag := $(call cc-option-yn,-march=winchip-c6)
18 cc-option-yn = $(call try-run,\
19 $(CC) $(KBUILD_CFLAGS) $(1) -S -xc /dev/null -o "$$TMP",y,n)
21 CFLAGS = -Wall -Wstrict-prototypes -Werror -fomit-frame-pointer -fno-builtin
22 ifeq ($(call cc-option-yn,-fno-stack-protector),y)
23 CFLAGS += -fno-stack-protector
24 endif
26 all: extboot.bin
28 %.o: %.S
29 $(CC) $(CFLAGS) -o $@ -c $<
31 extboot.img: extboot.o
32 $(LD) --oformat binary -Ttext 0 -o $@ $<
34 extboot.bin: extboot.img signrom
35 ./signrom extboot.img extboot.bin
37 signrom: signrom.c
38 $(CC) -o $@ -g -Wall $^
40 clean:
41 $(RM) *.o *.img *.bin signrom *~