mirror of
https://github.com/isometimes/rpi4-osdev
synced 2024-11-24 11:10:40 +00:00
20 lines
629 B
Makefile
20 lines
629 B
Makefile
|
CFILES = $(wildcard *.c)
|
||
|
OFILES = $(CFILES:.c=.o)
|
||
|
GCCFLAGS = -Wall -O2 -ffreestanding -nostdinc -nostdlib -nostartfiles
|
||
|
GCCPATH = ../../gcc-arm-9.2-2019.12-x86_64-aarch64-none-elf/bin
|
||
|
|
||
|
all: clean kernel8.img
|
||
|
|
||
|
boot.o: boot.S
|
||
|
$(GCCPATH)/aarch64-none-elf-gcc $(GCCFLAGS) -c boot.S -o boot.o
|
||
|
|
||
|
%.o: %.c
|
||
|
$(GCCPATH)/aarch64-none-elf-gcc $(GCCFLAGS) -c $< -o $@
|
||
|
|
||
|
kernel8.img: boot.o $(OFILES)
|
||
|
$(GCCPATH)/aarch64-none-elf-ld -nostdlib -nostartfiles boot.o $(OFILES) -T link.ld -o kernel8.elf
|
||
|
$(GCCPATH)/aarch64-none-elf-objcopy -O binary kernel8.elf kernel8.img
|
||
|
|
||
|
clean:
|
||
|
/bin/rm kernel8.elf *.o *.img > /dev/null 2> /dev/null || true
|