-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
42 lines (28 loc) · 797 Bytes
/
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
.PHONY: clean distclean
ASM=led.s mailbox.s screen.s font.s term.s debug.s logo.s vectors.s
C=init.c exception.c main.c sd.c dma.c atags.c mem.c term_printf.c mbr.c fat32.c
LD=arm-none-eabi-ld
OBJCOPY=arm-none-eabi-objcopy
AS=arm-none-eabi-as
CC=arm-none-eabi-gcc
ASFLAGS=-mfloat-abi=hard -mcpu=arm1176jz-s
CFLAGS=-O2 -std=c99 -nostdlib $(ASFLAGS)
all: kernel.img
sd.o: sd.c
$(CC) $(CFLAGS) -O0 -c -o $@ $<
%.o: %.s
$(AS) $(ASFLAGS) $< -o $@
kernel.elf: $(C:.c=.o) $(ASM:.s=.o)
$(LD) -T lscript1 $^ -o tmp.elf
$(LD) -T lscript2 tmp.elf -o $@
kernel.img: kernel.elf
$(OBJCOPY) $< --change-section-lma '.main.*-0xbfff7000' -O binary $@
clean:
rm -f *.o *.elf
distclean: clean
rm -f kernel.img
.mkdepends: $(C)
gcc -MM $^ > $@
# Dependencies
font.s: font.bin
include .mkdepends