This repository has been archived by the owner on Apr 27, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Makefile
87 lines (64 loc) · 2.9 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
# Copyright (C) 2018 SCARV project <info@scarv.org>
#
# Use of this source code is restricted per the MIT license, a copy of which
# can be found at https://opensource.org/licenses/MIT (or should be included
# as LICENSE.txt within the associated archive or repository).
ifndef REPO_HOME
$(error "execute 'source ./bin/conf.sh' to configure environment")
endif
ifndef REPO_VERSION
$(error "execute 'source ./bin/conf.sh' to configure environment")
endif
# =============================================================================
export CONTEXT ?= native
export BOARD ?= giles
export KERNEL ?= block
export CONF ?=
export DEPS ?= ${REPO_HOME}/build/${BOARD}/deps
# -----------------------------------------------------------------------------
export TRACE_COUNT_MAJOR ?= 1
export TRACE_COUNT_MINOR ?= 1
# -----------------------------------------------------------------------------
export DOCKER_REPO ?= scarv/sca3s-harness.$(subst /,-,${BOARD})
export DOCKER_TAG ?= ${REPO_VERSION}
export DOCKER_FLAGS ?=
export DOCKER_FLAGS += --env DOCKER_GID="$(shell id --group)"
export DOCKER_FLAGS += --env DOCKER_UID="$(shell id --user)"
export DOCKER_FLAGS += --env CONTEXT="native"
export DOCKER_FLAGS += --env BOARD="${BOARD}"
export DOCKER_FLAGS += --env KERNEL="${KERNEL}"
export DOCKER_FLAGS += --env CONF="${CONF}"
export DOCKER_FLAGS += --env TRACE_COUNT_MAJOR="${TRACE_COUNT_MAJOR}"
export DOCKER_FLAGS += --env TRACE_COUNT_MINOR="${TRACE_COUNT_MINOR}"
# =============================================================================
# Define targets to drive build process, depending on CONTEXT (i.e., on the
# selected build context):
#
# 1. For the Docker build context, defer everything to the Docker container
# (i.e., execute make on the same target *within* the container).
#
# 2. For the native build context,
#
# - deal with various specific, global targets (e.g., documentation), or
# - defer to the appropriate sub-Makefile for everything else.
# -----------------------------------------------------------------------------
ifeq "${CONTEXT}" "docker"
% :
@docker run --rm --volume "${REPO_HOME}:/mnt/scarv/sca3s/harness" ${DOCKER_FLAGS} ${DOCKER_REPO}:${DOCKER_TAG} ${*}
endif
# -----------------------------------------------------------------------------
ifeq "${CONTEXT}" "native"
%-docker :
@make --directory="${REPO_HOME}/src/docker" ${*}
%-harness :
@make --directory="${REPO_HOME}/src/sca3s/harness" ${*}
update :
@${REPO_HOME}/bin/update.sh --current
update-all :
@${REPO_HOME}/bin/update.sh --all
doxygen : ${REPO_HOME}/Doxyfile
@doxygen ${<}
spotless :
@rm --force --recursive ${REPO_HOME}/build/*
endif
# =============================================================================