blob: c1573589b6b9b24a04a097d588721b5904eaf7db (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
|
##
# @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-
CC = gcc
AS = as
OBJCOPY = objcopy
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
OUT = main.elf
export
all:
@$(MAKE) -C src/kernel
@$(MAKE) -C src/fs
@$(MAKE) -C src/user
@$(MAKE) -C src/initrd
@echo " LINK " $(OUT)
@$(CROSS)$(CC) $(CFLAGS) $(LFLAGS) -o $(OUT) \
$$(find src/fs src/kernel src/user src/initrd -name "*.o")
crt:
@arm-stmos-$(CC) $(MCUFLAGS) -fsigned-char -Os -fPIE -c src/crt/crt0.c \
-o src/crt/crt0.o
initrd:
@$(MAKE) -C src/initrd
libgpio:
@$(MAKE) -C src/libgpio
clean:
@echo " CLEAN"
@$(MAKE) -C src/kernel clean
@$(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
|