stmos/Makefile

64 lines
1.6 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/>.
#
2018-11-29 20:43:06 -05:00
CROSS = arm-stmos-
2018-09-25 16:22:47 -04:00
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
2018-11-29 20:43:06 -05:00
AFLAGS = $(MCUFLAGS) -meabi=5
CFLAGS = $(MCUFLAGS) -ggdb -fsigned-char -I.. \
2018-11-20 10:43:33 -05:00
-Wall -Werror -Wextra -pedantic
2018-11-29 20:43:06 -05:00
LFLAGS = -T link.ld
2018-09-25 16:22:47 -04:00
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-30 10:51:10 -05:00
@$(MAKE) -C src/initrd
2018-09-25 16:22:47 -04:00
@echo " LINK " $(OUT)
@$(CROSS)$(CC) $(CFLAGS) $(LFLAGS) -o $(OUT) \
2018-11-30 10:51:10 -05:00
$$(find src/fs src/kernel src/user src/initrd -name "*.o")
2018-09-25 16:22:47 -04:00
2018-11-29 20:43:06 -05:00
crt:
@arm-stmos-$(CC) $(MCUFLAGS) -fsigned-char -Os -fPIE -c src/crt/crt0.c \
-o src/crt/crt0.o
2018-09-25 16:22:47 -04:00
2018-11-30 10:51:10 -05:00
initrd:
@$(MAKE) -C src/initrd
libgpio:
@$(MAKE) -C src/libgpio
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
2018-11-30 10:51:10 -05:00
@$(MAKE) -C src/initrd clean
2018-10-02 21:26:48 -04:00
@rm -f $(OUT)
2018-11-29 20:43:06 -05:00
@rm -f initrd.img initrd.img.o
2018-09-25 16:22:47 -04:00