hw/misc/iotkit-secctl.c: Implement SSE-300 PID register values
[qemu/ar7.git] / pc-bios / optionrom / Makefile
blob30771f8d17cb2143eb7bbb004ceb07fbda89b3f9
1 CURRENT_MAKEFILE := $(realpath $(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST)))
2 SRC_DIR := $(dir $(CURRENT_MAKEFILE))
3 TOPSRC_DIR := $(SRC_DIR)/../..
4 VPATH = $(SRC_DIR)
6 all: multiboot.bin linuxboot.bin linuxboot_dma.bin kvmvapic.bin pvh.bin
7 # Dummy command so that make thinks it has done something
8 @true
10 include ../../config-host.mak
11 CFLAGS = -O2 -g
13 quiet-command = $(if $(V),$1,$(if $(2),@printf " %-7s %s\n" $2 $3 && $1, @$1))
14 cc-option = $(if $(shell $(CC) $1 -c -o /dev/null -xc /dev/null >/dev/null 2>&1 && echo OK), $1, $2)
16 override CFLAGS += -march=i486 -Wall
18 # Flags for dependency generation
19 override CPPFLAGS += -MMD -MP -MT $@ -MF $(@D)/$(*F).d
21 override CFLAGS += $(filter -W%, $(QEMU_CFLAGS))
22 override CFLAGS += $(CFLAGS_NOPIE) -ffreestanding -I$(TOPSRC_DIR)/include
23 override CFLAGS += $(call cc-option, -fno-stack-protector)
24 override CFLAGS += $(call cc-option, -m16)
26 ifeq ($(filter -m16, $(CFLAGS)),)
27 # Attempt to work around compilers that lack -m16 (GCC <= 4.8, clang <= ??)
28 # On GCC we add -fno-toplevel-reorder to keep the order of asm blocks with
29 # respect to the rest of the code. clang does not have -fno-toplevel-reorder,
30 # but it places all asm blocks at the beginning and we're relying on it for
31 # the option ROM header. So just force clang not to use the integrated
32 # assembler, which doesn't support .code16gcc.
33 override CFLAGS += $(call cc-option, -fno-toplevel-reorder)
34 override CFLAGS += $(call cc-option, -no-integrated-as)
35 override CFLAGS += -m32 -include $(SRC_DIR)/code16gcc.h
36 endif
38 Wa = -Wa,
39 override ASFLAGS += -32
40 override CFLAGS += $(call cc-option, $(Wa)-32)
42 LD_I386_EMULATION ?= elf_i386
43 override LDFLAGS = -m $(LD_I386_EMULATION) -T $(SRC_DIR)/flat.lds
45 all: multiboot.bin linuxboot.bin linuxboot_dma.bin kvmvapic.bin pvh.bin
47 pvh.img: pvh.o pvh_main.o
49 %.o: %.S
50 $(call quiet-command,$(CPP) $(CPPFLAGS) -c -o - $< | $(AS) $(ASFLAGS) -o $@,"AS","$@")
52 %.o: %.c
53 $(call quiet-command,$(CC) $(CPPFLAGS) $(CFLAGS) -c $< -o $@,"CC","$@")
55 %.img: %.o
56 $(call quiet-command,$(LD) $(LDFLAGS) -s -o $@ $^,"BUILD","$@")
58 %.raw: %.img
59 $(call quiet-command,$(OBJCOPY) -O binary -j .text $< $@,"BUILD","$@")
61 %.bin: %.raw
62 $(call quiet-command,$(PYTHON) $(TOPSRC_DIR)/scripts/signrom.py $< $@,"SIGN","$@")
64 include $(wildcard *.d)
66 clean:
67 rm -f *.o *.d *.raw *.img *.bin *~
69 # suppress auto-removal of intermediate files
70 .SECONDARY:
72 .PHONY: all clean