aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--build/Makefile19
1 files changed, 13 insertions, 6 deletions
diff --git a/build/Makefile b/build/Makefile
index 7c9432f..8487dff 100644
--- a/build/Makefile
+++ b/build/Makefile
@@ -1,4 +1,10 @@
-CFLAGS=-mcpu=cortex-a7 -ffreestanding -std=gnu11 -Wall -Wextra $(addprefix -I, $(dirs))
+HOST_CC=gcc
+
+HOST_CFLAGS=-Wall -std=gnu99 -I../src/lib/rs232 -O3
+
+ARM_CC=arm-none-eabi-gcc
+
+ARM_CFLAGS=-mcpu=cortex-a7 -ffreestanding -std=gnu11 -Wall -Wextra $(addprefix -I, $(dirs))
ELFFLAGS=-nostdlib -lgcc
ARM_OBJECTS=kernel.o paging.o demo_functionality.o PL0_test.o uart.o loader_stage1.o loader_stage2.o
@@ -27,7 +33,8 @@ echo :
echo $(CFLAGS)
%.o : %.c
- arm-none-eabi-gcc $(CFLAGS) -c $< -o $@
+ $(if $(findstring /arm/,$<),\
+ $(ARM_CC) $(ARM_CFLAGS),$(HOST_CC) $(HOST_CFLAGS)) -c $< -o $@
%.img : %.elf
arm-none-eabi-objcopy $^ -O binary $@
@@ -68,11 +75,11 @@ run-on-rpi : kernel.img pipe_image
./pipe_image --stdout | sudo socat FILE:/dev/ttyUSB0,b115200,raw -
screen /dev/ttyUSB0 115200,cs8,-parenb,-cstopb,-hupcl
-pipe_image : pipe_image.c rs232.c
- gcc -Wall -std=gnu99 -I../src/lib/rs232 -O3 $^ -o $@
+pipe_image : pipe_image.o rs232.o
+ $(HOST_CC) $^ -o $@
-makefs : makefs.c
- gcc -Wall -std=gnu99 -O3 $^ -o $@
+makefs : makefs.o
+ $(HOST_CC) $^ -o $@
ramfs.img : makefs $(RAMFS_FILES)
./makefs $(RAMFS_FILES) > $@