From 41ad4c6268b0292464802d88ac6835d21e69cabb Mon Sep 17 00:00:00 2001 From: vetch Date: Thu, 3 Oct 2019 17:57:43 +0200 Subject: changes in Makefile, modularize kernel --- Makefile | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 8ad7c03..b1b15c4 100644 --- a/Makefile +++ b/Makefile @@ -1,13 +1,18 @@ +CFLAGS=-mcpu=cortex-a7 -ffreestanding -std=gnu99 -Wall -Wextra -I. + all : kernel7.img kernel.o : kernel.c - arm-none-eabi-gcc -mcpu=cortex-a7 -ffreestanding -std=gnu99 -c -Wall -Wextra $^ -o $@ + arm-none-eabi-gcc $(CFLAGS) -c $^ -o $@ + +uart.o : uart.c + arm-none-eabi-gcc $(CFLAGS) -c $^ -o $@ boot.o : boot.S - arm-none-eabi-as -mcpu=cortex-a7 boot.S -o boot.o + arm-none-eabi-as -mcpu=cortex-a7 $^ -o $@ -kernel.elf : boot.o kernel.o - arm-none-eabi-gcc -T linker.ld -o $@ -ffreestanding -O2 -nostdlib boot.o kernel.o -lgcc +kernel.elf : boot.o kernel.o uart.o + arm-none-eabi-gcc -T linker.ld -o $@ -ffreestanding -O2 -nostdlib boot.o kernel.o uart.o -lgcc -I. kernel7.img : kernel.elf arm-none-eabi-objcopy $^ -O binary $@ @@ -19,6 +24,6 @@ qemu-bin : kernel7.img qemu-system-arm -m 256 -M raspi2 -serial stdio -kernel $^ clean : - -rm kernel7.img kernel.elf boot.o kernel.o + -rm kernel7.img kernel.elf boot.o kernel.o uart.o .PHONY: all qemu-elf qemu-bin clean -- cgit v1.2.3