4
4
# Usage: make -f Makefile.setup setup
5
5
#
6
6
# This Makefile defines targets for setting up a development environment.
7
- # If you just want the bare minimum, define WITHOUT_DEV_DEPS.
7
+ # It is separate from the project Makefile in order to minimize Docker
8
+ # cache invalidation and also to improve readability.
8
9
#
9
10
11
+ CLOE_ROOT := $(shell dirname $(realpath $(firstword $(MAKEFILE_LIST))))
12
+
10
13
APT := $(or \
11
14
$(shell command -v apt 2>/dev/null), \
12
15
$(shell command -v apt-get 2>/dev/null) \
@@ -39,17 +42,42 @@ endif
39
42
help::
40
43
echo "Available setup targets:"
41
44
echo " setup to perform Git repository setup"
45
+ echo " setup-conan to install Conan profile"
42
46
echo " install-system-deps to install build (and development) system requirements"
43
47
echo " install-python-deps to install Python runtime requirements with ${PIP}"
44
48
echo " install-sphinx-deps to install Sphinx runtime requirements with ${PIP}"
45
49
echo " install-python-tools to install Python development tools with ${PIPX}"
46
50
echo
47
51
48
- .PHONY: setup
52
+ .PHONY: setup setup-conan
49
53
setup:
50
54
git config --local core.hooksPath .git-hooks/
51
55
52
- .PHONY: install-system-deps install-ubuntu-deps install-archlinux-deps install-python-deps install-python-tools
56
+ CONAN_DIR=$(shell conan config home)
57
+ setup-conan:
58
+ # Install Conan if it is not available.
59
+ if ! command -v conan >/dev/null 2>&1; then ${PIP} install --user conan; fi
60
+ # Initialize Conan configuration if it doesn't already exist.
61
+ #
62
+ # Since running any conan command, even conan --help creates ${CONAN_DIR}
63
+ # and the default configuration, we rely on the existence of the default
64
+ # profile as an indication that we have a "fresh" setup where we can
65
+ # make our override.
66
+ if [ ! -f ${CONAN_DIR}/profiles/default ]; then \
67
+ conan config init; \
68
+ conan profile update settings.compiler.libcxx=libstdc++11 default; \
69
+ conan profile update settings.build_type=RelWithDebInfo default; \
70
+ fi
71
+ if ! conan config get general.revisions_enabled >/dev/null 2>&1; then \
72
+ conan config set general.revisions_enabled=True; \
73
+ fi
74
+ # Install cloe-debug and cloe-release profiles.
75
+ if [ -d "${CLOE_ROOT}/dist/conan" ]; then \
76
+ install "${CLOE_ROOT}/dist/conan/cloe-debug.profile" "${CONAN_DIR}/profiles/cloe-debug"; \
77
+ install "${CLOE_ROOT}/dist/conan/cloe-release.profile" "${CONAN_DIR}/profiles/cloe-release"; \
78
+ fi
79
+
80
+ .PHONY: install-system-deps install-ubuntu-deps install-archlinux-deps install-python-deps install-python-tools install-sphinx-deps
53
81
install-system-deps::
54
82
55
83
# Ubuntu ----------------------------------------------------------------------
@@ -62,6 +90,7 @@ install-ubuntu-deps::
62
90
${APT} install ${APT_ARGS} \
63
91
bats \
64
92
build-essential \
93
+ clang-format \
65
94
cmake \
66
95
doxygen \
67
96
curl \
@@ -73,19 +102,11 @@ install-ubuntu-deps::
73
102
psmisc \
74
103
python3-setuptools \
75
104
python3-pip \
105
+ python3-venv \
76
106
time \
77
107
tmux \
78
108
;
79
109
80
- ifndef WITHOUT_DEV_DEPS
81
- install-ubuntu-deps::
82
- command -v ${APT} >/dev/null 2>&1
83
- ${APT} install ${APT_ARGS} \
84
- clang-format \
85
- python3-venv \
86
- ;
87
- endif
88
-
89
110
# Archlinux -------------------------------------------------------------------
90
111
ifdef PACMAN
91
112
install-system-deps:: install-archlinux-deps
@@ -97,6 +118,7 @@ install-archlinux-deps::
97
118
base-devel \
98
119
bash \
99
120
bash-bats \
121
+ clang \
100
122
cmake \
101
123
curl \
102
124
doxygen \
@@ -106,19 +128,11 @@ install-archlinux-deps::
106
128
patchelf \
107
129
psmisc \
108
130
python-pip \
131
+ python-virtualenv \
109
132
time \
110
133
tmux \
111
134
;
112
135
113
- ifndef WITHOUT_DEV_DEPS
114
- install-archlinux-deps::
115
- command -v ${PACMAN} >/dev/null 2>&1
116
- ${PACMAN} -S ${PACMAN_ARGS} \
117
- clang \
118
- python-virtualenv \
119
- ;
120
- endif
121
-
122
136
# Python ----------------------------------------------------------------------
123
137
install-python-deps::
124
138
command -v ${PIP} >/dev/null 2>&1
0 commit comments