forked from bonzini/qboot
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
80 lines (69 loc) · 1.15 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
CC ?= $(CROSS)gcc
AS ?= $(CROSS)gcc
OBJCOPY ?= $(CROSS)objcopy
O ?= build
all: $O/bios.bin
ROMSIZE = 65536
$O: ; mkdir -p $@
CFLAGS = \
-W \
-Wall \
-m32 \
-march=i386 \
-mregparm=3 \
-fno-stack-protector \
-fno-delete-null-pointer-checks \
-ffreestanding \
-mstringop-strategy=rep_byte \
-minline-all-stringops \
-fno-pic \
-Iinclude \
-MT $@ \
-MMD -MP \
-MF $O/$*.d \
ASFLAGS = $(CFLAGS)
LDFLAGS = \
-nostdlib \
-m32 \
-Wl,--build-id=none \
-Wl,-Tflat.lds \
OBJS = \
code16.o \
code32seg.o \
cstart.o \
entry.o \
fw_cfg.o \
hwsetup.o \
linuxboot.o \
main.o \
malloc.o \
mptable.o \
pci.o \
printf.o \
string.o \
smbios.o \
tables.o \
$O/bios.elf: $(addprefix $O/,$(OBJS))
$(CC) $(LDFLAGS) -o $@ $^
$O/%.bin: $O/%.elf
$(OBJCOPY) \
-O binary \
-j .text \
-j .rodata \
-j .data \
-j .bss \
-j .init \
$< \
@if [ `stat -c '%s' "[email protected]"` != $(ROMSIZE) ]; then \
echo >&2 '$@ != $(ROMSIZE) bytes!' ; \
exit 1 ; \
fi
mv "[email protected]" "$@"
$O/%.o: %.c | $O
$(CC) $(CFLAGS) -c -o $@ $<
$O/%.o: %.S | $O
$(CC) $(ASFLAGS) -c -o $@ $<
clean:
$(RM) $O/*.o $O/bios.bin $O/bios.bin.elf $O/*.d
-include $O/*.d