]>
Commit | Line | Data |
---|---|---|
253d0942 AG |
1 | all: build-all |
2 | ||
3 | include ../../config-host.mak | |
4 | ||
5 | VPATH=$(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. | |
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") | |
19 | ||
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) | |
24 | ||
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 | |
30 | ||
31 | build-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 | 45 | clean: |
89e671e3 | 46 | $(RM) *.o *.img *.bin *~ |