From 0646fe7c22a25ca68154e752f5265831c0829310 Mon Sep 17 00:00:00 2001 From: Adam Greenwood-Byrne Date: Sun, 17 Oct 2021 01:42:27 +0100 Subject: [PATCH] Adding Makefile.gcc for part14-ethernet WIP --- part14-ethernet/Makefile.gcc | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 part14-ethernet/Makefile.gcc diff --git a/part14-ethernet/Makefile.gcc b/part14-ethernet/Makefile.gcc new file mode 100644 index 0000000..3aa7670 --- /dev/null +++ b/part14-ethernet/Makefile.gcc @@ -0,0 +1,20 @@ +CFILES = $(wildcard *.c lib/*.c kernel/*.c net/*.c) +SFILES = $(wildcard boot/*.S lib/*.S kernel/*.S) +OFILES = $(CFILES:.c=.o) $(SFILES:.S=.o) +GCCFLAGS = -Wall -O2 -ffreestanding -nostdinc -nostdlib -nostartfiles +GCCPATH = ../../gcc-arm-10.3-2021.07-x86_64-aarch64-none-elf/bin + +all: clean kernel8.img + +%.o: %.c + $(GCCPATH)/aarch64-none-elf-gcc $(GCCFLAGS) -c $< -o $@ + +%.o: %.S + $(GCCPATH)/aarch64-none-elf-gcc $(GCCFLAGS) -c $< -o $@ + +kernel8.img: $(OFILES) + $(GCCPATH)/aarch64-none-elf-ld -nostdlib $(OFILES) -T boot/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