stmos/Makefile

57 lines
1.5 KiB
Makefile
Raw Normal View History

2018-09-25 16:22:47 -04:00
##
# @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-none-eabi-
CC = gcc
AS = as
2018-11-04 23:46:12 -05:00
OBJCOPY = objcopy
2018-09-25 16:22:47 -04:00
MCUFLAGS = -mthumb -mcpu=cortex-m4 #-mfloat-abi=hard -mfpu=fpv4-sp-d16
AFLAGS = $(MCUFLAGS)
2018-10-29 18:11:53 -04:00
CFLAGS = $(MCUFLAGS) -ggdb --specs=nosys.specs \
2018-10-02 21:26:48 -04:00
-I.. \
2018-09-25 16:22:47 -04:00
-fno-builtin -fsigned-char -ffreestanding \
-Wall -Werror -Wextra -pedantic \
-Wno-overlength-strings -Wno-discarded-qualifiers
LFLAGS = -T link.ld
2018-10-02 21:26:48 -04:00
OUT = main.elf
2018-09-25 16:22:47 -04:00
2018-10-02 21:26:48 -04:00
export
2018-09-25 16:22:47 -04:00
2018-10-02 21:26:48 -04:00
all:
@$(MAKE) -C src/kernel
2018-11-04 23:46:12 -05:00
@$(MAKE) -C src/fs
2018-10-02 21:26:48 -04:00
@$(MAKE) -C src/user
2018-11-04 23:46:12 -05:00
@echo " INITRD"
@tools/rba initrd.img $$(find initrd/*)
@$(CROSS)$(OBJCOPY) -B arm -I binary -O elf32-littlearm initrd.img initrd.img.o
2018-09-25 16:22:47 -04:00
@echo " LINK " $(OUT)
2018-11-04 23:46:12 -05:00
@$(CROSS)$(CC) $(CFLAGS) $(LFLAGS) -o $(OUT) $$(find src/ -name "*.o") initrd.img.o
2018-09-25 16:22:47 -04:00
clean:
@echo " CLEAN"
2018-10-02 21:26:48 -04:00
@$(MAKE) -C src/kernel clean
2018-11-04 23:46:12 -05:00
@$(MAKE) -C src/fs clean
2018-10-02 21:26:48 -04:00
@$(MAKE) -C src/user clean
@rm -f $(OUT)
2018-09-25 16:22:47 -04:00