You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

64 lines
1.6 KiB
Makefile

6 years ago
##
# @file Makefile
# Script to build source files
#
# Copyright (C) 2018 Clyne Sullivan
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
#
CROSS = arm-stmos-
6 years ago
CC = gcc
AS = as
6 years ago
OBJCOPY = objcopy
6 years ago
MCUFLAGS = -mthumb -mcpu=cortex-m4 #-mfloat-abi=hard -mfpu=fpv4-sp-d16
AFLAGS = $(MCUFLAGS) -meabi=5
CFLAGS = $(MCUFLAGS) -ggdb -fsigned-char -I.. \
-Wall -Werror -Wextra -pedantic
LFLAGS = -T link.ld
6 years ago
OUT = main.elf
6 years ago
export
6 years ago
all:
@$(MAKE) -C src/kernel
6 years ago
@$(MAKE) -C src/fs
@$(MAKE) -C src/user
@$(MAKE) -C src/initrd
6 years ago
@echo " LINK " $(OUT)
@$(CROSS)$(CC) $(CFLAGS) $(LFLAGS) -o $(OUT) \
$$(find src/fs src/kernel src/user src/initrd -name "*.o")
6 years ago
crt:
@arm-stmos-$(CC) $(MCUFLAGS) -fsigned-char -Os -fPIE -c src/crt/crt0.c \
-o src/crt/crt0.o
6 years ago
initrd:
@$(MAKE) -C src/initrd
libgpio:
@$(MAKE) -C src/libgpio
6 years ago
clean:
@echo " CLEAN"
@$(MAKE) -C src/kernel clean
6 years ago
@$(MAKE) -C src/fs clean
@$(MAKE) -C src/user clean
@$(MAKE) -C src/initrd clean
@rm -f $(OUT)
@rm -f initrd.img initrd.img.o
6 years ago