This repository has been archived by the owner on Sep 2, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
89 lines (71 loc) · 2.89 KB
/
Makefile
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
# -*- mode: Makefile; tab-width: 8; indent-tabs-mode: t; -*-
#--------------------------------------------------------------------------------------------------
# Copyright (c) 2022 Marcus Geelnard
#
# This software is provided 'as-is', without any express or implied warranty. In no event will the
# authors be held liable for any damages arising from the use of this software.
#
# Permission is granted to anyone to use this software for any purpose, including commercial
# applications, and to alter it and redistribute it freely, subject to the following restrictions:
#
# 1. The origin of this software must not be misrepresented; you must not claim that you wrote
# the original software. If you use this software in a product, an acknowledgment in the
# product documentation would be appreciated but is not required.
#
# 2. Altered source versions must be plainly marked as such, and must not be misrepresented as
# being the original software.
#
# 3. This notice may not be removed or altered from any source distribution.
#--------------------------------------------------------------------------------------------------
# Default installation folder. Override with "make DESTDIR=/foo/bar"
DESTDIR = /tmp/mc1-sdk
# Host command configuration.
CP = cp -a
RM = rm -f
MKDIR = mkdir -p
RMDIR = rm -rf
CMAKE = cmake
CMAKE_GENERATOR =
MRISC32_GCC = mrisc32-elf-gcc
MRISC32_AR = mrisc32-elf-ar rcs
# Paths.
SDK_ROOT = .
LIBMC1_DIR = $(SDK_ROOT)/libmc1
LIBMC1 = $(LIBMC1_DIR)/out/libmc1.a
CRT0_DIR = $(SDK_ROOT)/crt0
TOOLS_DIR = $(SDK_ROOT)/tools
PNG2MCI = $(TOOLS_DIR)/png2mci
LINKERSCRIPT_DIR = $(SDK_ROOT)/linker-scripts
SUPPORT_DIR = $(SDK_ROOT)/support
.PHONY: all install clean libmc1 crt0 FORCE
all: libmc1 crt0 $(PNG2MCI)
FORCE:
install: all
@echo Installing to $(DESTDIR)...
$(MKDIR) $(DESTDIR)/bin
$(CP) $(PNG2MCI) $(DESTDIR)/bin/
$(CP) $(TOOLS_DIR)/*.py $(DESTDIR)/bin/
$(MKDIR) $(DESTDIR)/lib
$(CP) $(LIBMC1) $(DESTDIR)/lib/
$(CP) $(CRT0_DIR)/out/*.a $(DESTDIR)/lib/
$(CP) $(LINKERSCRIPT_DIR)/*.ld $(DESTDIR)/lib/
$(MKDIR) $(DESTDIR)/include/mc1
$(CP) $(LIBMC1_DIR)/include/mc1/* $(DESTDIR)/include/mc1/
$(MKDIR) $(DESTDIR)/share/cmake
$(CP) $(SUPPORT_DIR)/cmake/* $(DESTDIR)/share/cmake/
$(MKDIR) $(DESTDIR)/share/gtksourceview-4/language-specs
$(CP) $(SUPPORT_DIR)/gtksourceview/* $(DESTDIR)/share/gtksourceview-4/language-specs/
clean:
$(MAKE) -C $(LIBMC1_DIR) clean
$(MAKE) -C $(CRT0_DIR) clean
$(RMDIR) $(TOOLS_DIR)/out
$(RM) $(PNG2MCI)
crt0:
$(MAKE) -C $(CRT0_DIR)
libmc1:
$(MAKE) -C $(LIBMC1_DIR)
$(PNG2MCI): FORCE
$(MKDIR) $(TOOLS_DIR)/out
$(CMAKE) $(CMAKE_GENERATOR) -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=$(TOOLS_DIR) -S $(TOOLS_DIR)/src -B $(TOOLS_DIR)/out
$(CMAKE) --build $(TOOLS_DIR)/out
DESTDIR= $(CMAKE) --install $(TOOLS_DIR)/out