source: mainline/meson/part/extra_targets/meson.build@ ee2f0beb

lfn serial ticket/834-toolchain-update topic/msim-upgrade topic/simplify-dev-export
Last change on this file since ee2f0beb was 6d974a4, checked in by Jiří Zárevúcky <zarevucky.jiri@…>, 5 years ago

Add cppcheck extra target to allow static analysis.
Cppcheck is a static analysis tool for C/C++ code. It provides unique code analysis to detect bugs and focuses on detecting undefined behaviour and dangerous coding constructs. The goal is to detect only real errors in the code (i.e. have very few false positives).
The original name of this program was "C++check", but it was later changed to "Cppcheck".
Despite the name, Cppcheck is designed for both C and C++.

To run target just type:
ninja cppcheck > /dev/null

Note: There is a problem with memory.cpp so cppcheck analysis ends about 30% completed.

  • Property mode set to 100644
File size: 2.9 KB
Line 
1#
2# Copyright (c) 2017 Jiri Svoboda
3# Copyright (c) 2019 Jiří Zárevúcky
4# All rights reserved.
5#
6# Redistribution and use in source and binary forms, with or without
7# modification, are permitted provided that the following conditions
8# are met:
9#
10# - Redistributions of source code must retain the above copyright
11# notice, this list of conditions and the following disclaimer.
12# - Redistributions in binary form must reproduce the above copyright
13# notice, this list of conditions and the following disclaimer in the
14# documentation and/or other materials provided with the distribution.
15# - The name of the author may not be used to endorse or promote products
16# derived from this software without specific prior written permission.
17#
18# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
19# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
20# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
21# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
22# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
23# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
27# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28#
29
30run_target('config',
31 command: [
32 sh,
33 '-c', 'cd $1 && $2 $3 $4 $5',
34 '--',
35 meson.build_root(),
36 config_py.path(),
37 meson.source_root() / 'HelenOS.config',
38 meson.source_root() / 'defaults',
39 '--mask-platform',
40 ]
41)
42
43# TODO: Check when cross target has changed, since it won't work.
44
45if false
46 # TODO: doesn't work because it changes cross target
47 run_target('random-config',
48 command: [
49 sh,
50 '-c', 'cd $1 && $2 $3 $4 random',
51 '--',
52 meson.build_root(),
53 config_py.path(),
54 meson.source_root() / 'HelenOS.config',
55 meson.source_root() / 'defaults',
56 ]
57 )
58endif
59
60if doxygen.found()
61 _patch_file = files('doxygen.cfg.diff')
62
63 _gen_cfg = custom_target('doxygen.cfg.gen',
64 output: 'doxygen.cfg.gen',
65 command: [ doxygen, '-g', '@OUTPUT@' ],
66 )
67
68 _dox_cfg = custom_target('doxygen.cfg',
69 output: 'doxygen.cfg',
70 input: [ _gen_cfg, _patch_file ],
71 command: [ patch, '-o', '@OUTPUT@', '@INPUT@' ],
72 )
73
74 run_target('doxygen', command: [
75 sh,
76 '-c', 'cd $1 && $2 $3',
77 '--',
78 meson.source_root() / 'doxygen',
79 doxygen.path(),
80 _dox_cfg,
81 ])
82endif
83
84if cppcheck.found()
85 run_target('cppcheck', command: ['cppcheck', '--project=' +
86 join_paths(meson.build_root(), 'compile_commands.json'),
87 ' -q --force --file-list=*.c* --platform=unix32 --enable=all' ])
88endif
89
90# TODO text-xcw
91#ifeq ($(CONFIG_DEVEL_FILES),y)
92# export PATH=$$PATH:$(abspath tools/xcw/bin) && $(MAKE) -r -C tools/xcw/demo
93#endif
94
95# TODO special target for posix and xcw exports, update coastline for it
Note: See TracBrowser for help on using the repository browser.