]>
Commit | Line | Data |
---|---|---|
253d0942 | 1 | all: build-all |
c05ac895 PB |
2 | # Dummy command so that make thinks it has done something |
3 | @true | |
253d0942 AG |
4 | |
5 | include ../../config-host.mak | |
925ce05f | 6 | include $(SRC_PATH)/rules.mak |
253d0942 | 7 | |
076d2471 PB |
8 | $(call set-vpath, $(SRC_PATH)/pc-bios/optionrom) |
9 | ||
4888ec26 | 10 | .PHONY : all clean build-all |
253d0942 | 11 | |
9d4cd7b4 | 12 | # Compiling with no optimization creates ROMs that are too large |
336d5881 | 13 | ifeq ($(lastword $(filter -O%, -O0 $(CFLAGS))),-O0) |
9d4cd7b4 PB |
14 | override CFLAGS += -O2 |
15 | endif | |
16 | ||
b2a575a1 MM |
17 | # Drop -fstack-protector and the like |
18 | QEMU_CFLAGS := $(filter -W%, $(QEMU_CFLAGS)) $(CFLAGS_NOPIE) -ffreestanding | |
b0e8f5ca | 19 | QEMU_CFLAGS += $(call cc-option, $(QEMU_CFLAGS), -fno-stack-protector) |
b2a575a1 MM |
20 | QEMU_CFLAGS += $(call cc-option, $(QEMU_CFLAGS), -m16) |
21 | ifeq ($(filter -m16, $(QEMU_CFLAGS)),) | |
22 | # Attempt to work around compilers that lack -m16 (GCC <= 4.8, clang <= ??) | |
23 | # On GCC we add -fno-toplevel-reorder to keep the order of asm blocks with | |
24 | # respect to the rest of the code. clang does not have -fno-toplevel-reorder, | |
25 | # but it places all asm blocks at the beginning and we're relying on it for | |
26 | # the option ROM header. So just force clang not to use the integrated | |
27 | # assembler, which doesn't support .code16gcc. | |
28 | QEMU_CFLAGS += $(call cc-option, $(QEMU_CFLAGS), -fno-toplevel-reorder) | |
29 | QEMU_CFLAGS += $(call cc-option, $(QEMU_CFLAGS), -no-integrated-as) | |
30 | QEMU_CFLAGS += -m32 -include $(SRC_PATH)/pc-bios/optionrom/code16gcc.h | |
31 | endif | |
32 | ||
b2a575a1 MM |
33 | QEMU_INCLUDES += -I$(SRC_PATH) |
34 | ||
35 | Wa = -Wa, | |
36 | ASFLAGS += -32 | |
036999e9 | 37 | QEMU_CFLAGS += $(call cc-c-option, $(QEMU_CFLAGS), $(Wa)-32) |
b2a575a1 MM |
38 | |
39 | build-all: multiboot.bin linuxboot.bin linuxboot_dma.bin kvmvapic.bin | |
253d0942 | 40 | |
6fbcef29 JK |
41 | # suppress auto-removal of intermediate files |
42 | .SECONDARY: | |
43 | ||
b2a575a1 | 44 | |
cdbd727c | 45 | %.o: %.S |
b2a575a1 MM |
46 | $(call quiet-command,$(CPP) $(QEMU_INCLUDES) $(QEMU_DGFLAGS) -c -o - $< | $(AS) $(ASFLAGS) -o $@," AS $(TARGET_DIR)$@") |
47 | ||
253d0942 | 48 | %.img: %.o |
e57218b6 | 49 | $(call quiet-command,$(LD) $(LDFLAGS_NOPIE) -m $(LD_I386_EMULATION) -T $(SRC_PATH)/pc-bios/optionrom/flat.lds -s -o $@ $<," Building $(TARGET_DIR)$@") |
253d0942 | 50 | |
7aa486fe | 51 | %.raw: %.img |
791e08c7 | 52 | $(call quiet-command,$(OBJCOPY) -O binary -j .text $< $@," Building $(TARGET_DIR)$@") |
7aa486fe AL |
53 | |
54 | %.bin: %.raw | |
0d6b9cc7 | 55 | $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/signrom.py $< $@," Signing $(TARGET_DIR)$@") |
253d0942 | 56 | |
253d0942 | 57 | clean: |
3e4e4646 | 58 | rm -f *.o *.d *.raw *.img *.bin *~ |