2012-09-03 23:44:36 -04:00
|
|
|
# Aedrix root Makefile
|
|
|
|
# Copyright (C) 2012 Aaron Lindsay <aaron@aclindsay.com>
|
|
|
|
|
|
|
|
# Config options for the code itself (should be separated from the Makefile sometime)
|
|
|
|
ARCH = arm
|
|
|
|
|
|
|
|
# Config options concerning the build process itself
|
|
|
|
VERBOSE = 0 # 1 shows all compiler flags, 0 shows cleaner output
|
|
|
|
|
|
|
|
# Define the tools to be used
|
|
|
|
TOOL_PREFIX = arm-elf-
|
|
|
|
AS = $(TOOL_PREFIX)as
|
|
|
|
CC = $(TOOL_PREFIX)gcc
|
|
|
|
LD = $(TOOL_PREFIX)ld
|
|
|
|
|
|
|
|
# Define the flags we'll need for our tools
|
2012-09-07 23:58:19 -04:00
|
|
|
INCLUDES = -I include
|
|
|
|
KCFLAGS = -Wall -Wextra -Werror -nostdlib -nostartfiles -ffreestanding -std=gnu99 $(INCLUDES)
|
2012-09-03 23:44:36 -04:00
|
|
|
KLDFLAGS = -T link.ld
|
|
|
|
|
|
|
|
KOBJS =
|
|
|
|
|
|
|
|
include boot/Makefile.inc
|
|
|
|
include kernel/Makefile.inc
|
2012-09-07 23:51:04 -04:00
|
|
|
include devices/Makefile.inc
|
2012-09-03 23:44:36 -04:00
|
|
|
|
|
|
|
all: aedrix-kernel
|
|
|
|
#all:
|
|
|
|
# @echo $(KOBJS)
|
|
|
|
|
|
|
|
aedrix-kernel: $(KOBJS)
|
|
|
|
$(if $(VERBOSE:1=),@echo ' LD $@')
|
|
|
|
$(if $(VERBOSE:1=),@)$(LD) $(KLDFLAGS) -o $@ $(KOBJS)
|
|
|
|
|
|
|
|
%.o: %.c
|
|
|
|
$(if $(VERBOSE:1=),@echo ' CC $@')
|
|
|
|
$(if $(VERBOSE:1=),@)$(CC) $(KCFLAGS) -c -o $@ $<
|
|
|
|
|
|
|
|
# Assembly files without preprocessor directives
|
|
|
|
%.o: %.s
|
|
|
|
$(if $(VERBOSE:1=),@echo ' AS $@')
|
|
|
|
$(if $(VERBOSE:1=),@)$(AS) -o $@ $<
|
|
|
|
|
|
|
|
# Assembly files with preprocessor directives
|
|
|
|
%.o: %.S
|
|
|
|
$(if $(VERBOSE:1=),@echo ' AS $@')
|
|
|
|
$(if $(VERBOSE:1=),@)$(AS) -o $@ $<
|
|
|
|
|
|
|
|
.PHONY : clean
|
|
|
|
clean:
|
|
|
|
@echo ' CLEAN *.o'
|
|
|
|
@rm -f $(KOBJS)
|
|
|
|
@echo ' CLEAN aedrix-kernel'
|
|
|
|
@rm -f aedrix-kernel
|
2012-09-07 23:58:19 -04:00
|
|
|
|
|
|
|
.PHONY: boot
|
|
|
|
boot: aedrix-kernel
|
|
|
|
@qemu-system-arm -m 128 -kernel aedrix-kernel -serial stdio
|