Statistics
| Branch: | Revision:

root / pc-bios / optionrom / Makefile @ 7aa486fe

History | View | Annotate | Download (1.1 kB)

1
all: build-all
2

    
3
include ../../config-host.mak
4

    
5
VPATH=$(SRC_PATH)/pc-bios/optionrom
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
37
	$(LD) -Ttext 0 -e _start -s -o $@ $<
38

    
39
%.raw: %.img
40
	$(OBJCOPY) -O binary -j .text $< $@
41

    
42
%.bin: %.raw
43
	$(SRC_PATH)/pc-bios/optionrom/signrom.sh $< $@
44
	cp $@ $(SRC_PATH)/pc-bios/
45

    
46
clean:
47
	$(RM) *.o *.img *.bin *~