Skip to content

Commit c655359

Browse files
committed
Move recipes
1 parent 67785dc commit c655359

File tree

3 files changed

+189
-2
lines changed

3 files changed

+189
-2
lines changed

tools/make/lib/install/Makefile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ DEPS_CHECKSUM_BIN ?= $(TOOLS_DIR)/scripts/checksum
3636
# Note: keep in alphabetical order...
3737
include $(TOOLS_MAKE_LIB_DIR)/install/boost.mk
3838
include $(TOOLS_MAKE_LIB_DIR)/install/cephes.mk
39+
include $(TOOLS_MAKE_LIB_DIR)/install/cppcheck.mk
3940
include $(TOOLS_MAKE_LIB_DIR)/install/electron.mk
4041
include $(TOOLS_MAKE_LIB_DIR)/install/node.mk
4142

@@ -148,7 +149,7 @@ clean-deps-tests: clean-deps-openblas-tests
148149
# @example
149150
# make install-deps-dev
150151
#/
151-
install-deps-dev: install-deps-boost install-deps-cephes install-deps-shellcheck
152+
install-deps-dev: install-deps-boost install-deps-cephes install-deps-cppcheck install-deps-shellcheck
152153

153154
.PHONY: install-deps-dev
154155

@@ -158,7 +159,7 @@ install-deps-dev: install-deps-boost install-deps-cephes install-deps-shellcheck
158159
# @example
159160
# make clean-deps-dev
160161
#/
161-
clean-deps-dev: clean-deps-boost clean-deps-cephes clean-deps-shellcheck
162+
clean-deps-dev: clean-deps-boost clean-deps-cephes clean-deps-cppcheck clean-deps-shellcheck
162163

163164
.PHONY: clean-deps-dev
164165

tools/make/lib/install/README.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,26 @@ $ make clean-deps-cephes-tests
313313

314314
* * *
315315

316+
#### Cppcheck
317+
318+
##### install-deps-cppcheck
319+
320+
Installs [Cppcheck][cppcheck].
321+
322+
```bash
323+
$ make install-deps-cppcheck
324+
```
325+
326+
##### clean-deps-cppcheck
327+
328+
Removes an installed [Cppcheck][cppcheck] distribution.
329+
330+
```bash
331+
$ make clean-deps-cppcheck
332+
```
333+
334+
* * *
335+
316336
### Electron
317337

318338
#### install-deps-electron
@@ -361,6 +381,8 @@ $ make clean-deps-electron-tests
361381

362382
[cephes]: http://www.moshier.net/#Cephes
363383

384+
[cppcheck]: http://cppcheck.sourceforge.net/
385+
364386
[electron]: https://www.electronjs.org/
365387

366388
[node-js]: https://nodejs.org/en/

tools/make/lib/install/cppcheck.mk

Lines changed: 164 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,164 @@
1+
#/
2+
# @license Apache-2.0
3+
#
4+
# Copyright (c) 2021 The Stdlib Authors.
5+
#
6+
# Licensed under the Apache License, Version 2.0 (the "License");
7+
# you may not use this file except in compliance with the License.
8+
# You may obtain a copy of the License at
9+
#
10+
# http://www.apache.org/licenses/LICENSE-2.0
11+
#
12+
# Unless required by applicable law or agreed to in writing, software
13+
# distributed under the License is distributed on an "AS IS" BASIS,
14+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
# See the License for the specific language governing permissions and
16+
# limitations under the License.
17+
#/
18+
19+
# VARIABLES #
20+
21+
# Define the download URL...
22+
ifeq ($(OS), WINNT)
23+
DEPS_CPPCHECK_URL ?= https://github.com/danmar/cppcheck/archive/$(DEPS_CPPCHECK_VERSION).zip
24+
else
25+
DEPS_CPPCHECK_URL ?= https://github.com/danmar/cppcheck/archive/$(DEPS_CPPCHECK_VERSION).tar.gz
26+
endif
27+
28+
# Determine the basename for the download:
29+
deps_cppcheck_basename := $(notdir $(DEPS_CPPCHECK_URL))
30+
31+
# Define the path to the file containing a checksum to verify a download:
32+
DEPS_CPPCHECK_CHECKSUM ?= $(shell $(CAT) $(DEPS_CHECKSUMS_DIR)/cppcheck_v$(subst .,_,$(subst -,_,$(deps_cppcheck_basename)))/sha256)
33+
34+
# Define the output path when downloading:
35+
DEPS_CPPCHECK_DOWNLOAD_OUT ?= $(DEPS_TMP_DIR)/cppcheck-v$(deps_cppcheck_basename)
36+
37+
# Define the output path after extracting:
38+
deps_cppcheck_extract_out := $(DEPS_BUILD_DIR)/cppcheck-$(DEPS_CPPCHECK_VERSION)
39+
40+
# Define the path to the `cppcheck` executable...
41+
ifeq ($(DEPS_CPPCHECK_PLATFORM), win32)
42+
CPPCHECK ?= $(DEPS_CPPCHECK_BUILD_OUT)/cppcheck.exe
43+
else
44+
CPPCHECK ?= $(DEPS_CPPCHECK_BUILD_OUT)/cppcheck
45+
endif
46+
47+
# Define rule prerequisites...
48+
deps_cppcheck_test_prereqs := $(DEPS_CPPCHECK_BUILD_OUT)
49+
deps_cppcheck_install_prereqs := deps-download-cppcheck deps-verify-cppcheck deps-extract-cppcheck deps-install-cppcheck deps-test-cppcheck
50+
51+
52+
# RULES #
53+
54+
#/
55+
# Downloads a `cppcheck` distribution.
56+
#
57+
# @private
58+
#/
59+
$(DEPS_CPPCHECK_DOWNLOAD_OUT): | $(DEPS_TMP_DIR)
60+
$(QUIET) echo 'Downloading cppcheck...' >&2
61+
$(QUIET) $(DEPS_DOWNLOAD_BIN) $(DEPS_CPPCHECK_URL) $(DEPS_CPPCHECK_DOWNLOAD_OUT)
62+
63+
#/
64+
# Extracts a `cppcheck` archive.
65+
#
66+
# @private
67+
#/
68+
$(DEPS_CPPCHECK_BUILD_OUT): $(DEPS_CPPCHECK_DOWNLOAD_OUT) | $(DEPS_BUILD_DIR)
69+
ifeq ($(OS), WINNT)
70+
$(QUIET) echo 'Extracting cppcheck...' >&2
71+
$(QUIET) $(UNZIP) -q $(DEPS_CPPCHECK_DOWNLOAD_OUT) -d $@
72+
else
73+
$(QUIET) echo 'Extracting cppcheck...' >&2
74+
$(QUIET) $(TAR) --xz -xvf $(DEPS_CPPCHECK_DOWNLOAD_OUT) -C $(DEPS_BUILD_DIR)
75+
$(QUIET) mv $(deps_cppcheck_extract_out) $(DEPS_CPPCHECK_BUILD_OUT)
76+
endif
77+
78+
#/
79+
# Downloads cppcheck.
80+
#
81+
# @private
82+
#
83+
# @example
84+
# make deps-download-cppcheck
85+
#/
86+
deps-download-cppcheck: $(DEPS_CPPCHECK_DOWNLOAD_OUT)
87+
88+
.PHONY: deps-download-cppcheck
89+
90+
#/
91+
# Verifies a `cppcheck` download.
92+
#
93+
# @private
94+
#
95+
# @example
96+
# make deps-verify-cppcheck
97+
#/
98+
deps-verify-cppcheck: deps-download-cppcheck
99+
$(QUIET) echo 'Verifying download...' >&2
100+
$(QUIET) $(DEPS_CHECKSUM_BIN) $(DEPS_CPPCHECK_DOWNLOAD_OUT) $(DEPS_CPPCHECK_CHECKSUM) >&2
101+
102+
.PHONY: deps-verify-cppcheck
103+
104+
#/
105+
# Extracts a `cppcheck` download.
106+
#
107+
# @private
108+
#
109+
# @example
110+
# make deps-extract-cppcheck
111+
#/
112+
deps-extract-cppcheck: $(DEPS_CPPCHECK_BUILD_OUT)
113+
114+
.PHONY: deps-extract-cppcheck
115+
116+
#/
117+
# Installs `cppcheck`.
118+
#
119+
# @private
120+
#
121+
# @example
122+
# make deps-install-cppcheck
123+
#/
124+
deps-install-cppcheck: $(DEPS_CPPCHECK_BUILD_OUT)
125+
$(QUIET) $(MAKE) --directory="$(DEPS_CPPCHECK_BUILD_OUT)"
126+
127+
.PHONY: deps-install-cppcheck
128+
129+
#/
130+
# Tests a `cppcheck` installation.
131+
#
132+
# @private
133+
#
134+
# @example
135+
# make deps-test-cppcheck
136+
#/
137+
deps-test-cppcheck: $(deps_cppcheck_test_prereqs)
138+
$(QUIET) echo 'Running tests...' >&2
139+
$(QUIET) $(CPPCHECK) --version >&2
140+
$(QUIET) echo '' >&2
141+
$(QUIET) echo 'Success.' >&2
142+
143+
.PHONY: deps-test-cppcheck
144+
145+
#/
146+
# Installs `cppcheck`.
147+
#
148+
# @example
149+
# make install-deps-cppcheck
150+
#/
151+
install-deps-cppcheck: $(deps_cppcheck_install_prereqs)
152+
153+
.PHONY: install-deps-cppcheck
154+
155+
#/
156+
# Removes a `cppcheck` distribution (but does not remove a `cppcheck` download if one exists).
157+
#
158+
# @example
159+
# make clean-deps-cppcheck
160+
#/
161+
clean-deps-cppcheck:
162+
$(QUIET) $(DELETE) $(DELETE_FLAGS) $(DEPS_CPPCHECK_BUILD_OUT)
163+
164+
.PHONY: clean-deps-cppcheck

0 commit comments

Comments
 (0)