2009-06-29 15:37:40 +02:00
|
|
|
all: build-all
|
|
|
|
|
|
|
|
include ../../config-host.mak
|
2009-07-21 14:11:19 +02:00
|
|
|
include ../../rules.mak
|
2009-06-29 15:37:40 +02:00
|
|
|
|
|
|
|
VPATH=$(SRC_PATH)/pc-bios/optionrom
|
|
|
|
|
|
|
|
# from kernel sources - scripts/Kbuild.include
|
|
|
|
# try-run
|
|
|
|
# Usage: option = $(call try-run, $(CC)...-o "$$TMP",option-ok,otherwise)
|
|
|
|
# Exit code chooses option. "$$TMP" is can be used as temporary file and
|
|
|
|
# is automatically cleaned up.
|
|
|
|
try-run = $(shell set -e; \
|
|
|
|
TMP="$(TMPOUT).$$$$.tmp"; \
|
|
|
|
if ($(1)) >/dev/null 2>&1; \
|
|
|
|
then echo "$(2)"; \
|
|
|
|
else echo "$(3)"; \
|
|
|
|
fi; \
|
|
|
|
rm -f "$$TMP")
|
|
|
|
|
|
|
|
# cc-option-yn
|
|
|
|
# Usage: flag := $(call cc-option-yn,-march=winchip-c6)
|
|
|
|
cc-option-yn = $(call try-run,\
|
|
|
|
$(CC) $(KBUILD_CFLAGS) $(1) -S -xc /dev/null -o "$$TMP",y,n)
|
|
|
|
|
2009-07-21 14:11:19 +02:00
|
|
|
CPPFLAGS = -Wall -Wstrict-prototypes -Werror -fomit-frame-pointer -fno-builtin
|
|
|
|
CPPFLAGS += -I$(SRC_PATH)
|
2009-06-29 15:37:40 +02:00
|
|
|
ifeq ($(call cc-option-yn,-fno-stack-protector),y)
|
2009-07-21 14:11:19 +02:00
|
|
|
CPPFLAGS += -fno-stack-protector
|
2009-06-29 15:37:40 +02:00
|
|
|
endif
|
|
|
|
|
|
|
|
build-all: multiboot.bin
|
|
|
|
|
|
|
|
%.img: %.o
|
2009-07-21 14:11:19 +02:00
|
|
|
$(call quiet-command,$(LD) -Ttext 0 -e _start -s -o $@ $<," Building $(TARGET_DIR)$@")
|
2009-06-29 15:37:40 +02:00
|
|
|
|
2009-07-11 15:48:29 +02:00
|
|
|
%.raw: %.img
|
2009-07-21 14:11:19 +02:00
|
|
|
$(call quiet-command,$(OBJCOPY) -O binary -j .text $< $@," Building $(TARGET_DIR)$@")
|
2009-07-11 15:48:29 +02:00
|
|
|
|
|
|
|
%.bin: %.raw
|
2009-07-21 14:11:19 +02:00
|
|
|
$(call quiet-command,$(SRC_PATH)/pc-bios/optionrom/signrom.sh $< $@," Signing $(TARGET_DIR)$@")
|
2009-06-29 15:37:40 +02:00
|
|
|
|
|
|
|
clean:
|
2009-07-01 22:08:21 +02:00
|
|
|
$(RM) *.o *.img *.bin *~
|