source: mainline/meson/part/tools/meson.build@ 807be7e

lfn serial ticket/834-toolchain-update topic/msim-upgrade topic/simplify-dev-export
Last change on this file since 807be7e 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: 3.6 KB
Line 
1#
2# Copyright (c) 2019 Jiří Zárevúcky
3# All rights reserved.
4#
5# Redistribution and use in source and binary forms, with or without
6# modification, are permitted provided that the following conditions
7# are met:
8#
9# - Redistributions of source code must retain the above copyright
10# notice, this list of conditions and the following disclaimer.
11# - Redistributions in binary form must reproduce the above copyright
12# notice, this list of conditions and the following disclaimer in the
13# documentation and/or other materials provided with the distribution.
14# - The name of the author may not be used to endorse or promote products
15# derived from this software without specific prior written permission.
16#
17# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27#
28
29# Find all the programs and tools used by meson.
30# Whenever you use an external command anywhere,
31# first find and assign it to a variable here. Don't use its name directly.
32# This way it's obvious what programs are used, and for some we can use
33# the same argument list everywhere.
34
35_tools_dir = meson.source_root() / 'tools'
36
37basename = find_program('basename')
38cc = meson.get_compiler('c')
39config_py = find_program(_tools_dir / 'config.py')
40cp = find_program('cp')
41dirname = find_program('dirname')
42doxygen = find_program('doxygen', required: false)
43find = find_program('find')
44grep = find_program('grep')
45mkarray = find_program(_tools_dir / 'mkarray_for_meson.sh')
46mkext4 = find_program(_tools_dir / 'mkext4.py')
47mkfat = find_program(_tools_dir / 'mkfat.py')
48mkuimage = find_program(_tools_dir / 'mkuimage.py')
49objcopy = find_program('objcopy')
50objdump = find_program('objdump')
51patch = find_program('patch')
52sed = find_program('sed')
53unzip = find_program('unzip')
54which = find_program('which')
55cpc = find_program(_tools_dir / 'cc.sh')
56cppcheck = find_program('cppcheck', required: false)
57
58sh = [ find_program('sh'), '-u', '-e' ]
59if debug_shell_scripts
60 sh += '-x'
61endif
62
63genisoimage = find_program('genisoimage', required: false)
64
65if not genisoimage.found()
66 genisoimage = find_program('mkisofs', required: false)
67endif
68
69if not genisoimage.found()
70 xorriso = find_program('xorriso', required: false)
71
72 if xorriso.found()
73 genisoimage = [ xorriso, '-as', 'genisoimage' ]
74 else
75 error('Need genisoimage, mkisofs or xorriso.')
76 endif
77endif
78
79
80autocheck = generator(find_program(_tools_dir / 'autocheck.awk'),
81 arguments: [ '@INPUT@' ],
82 output: '@PLAINNAME@.check.c',
83 capture: true,
84)
85
86# TODO: bug in Meson
87#gzip = generator(find_program('gzip'),
88# arguments: [ '--no-name', '-9', '--stdout', '@INPUT@' ],
89# output: '@PLAINNAME@.gz',
90# capture: true,
91#)
92
93gzip = [ find_program('gzip'), '--no-name', '-9', '--stdout', '@INPUT@' ]
94
95# Tar's arguments make sure that the archive is reproducible.
96tar = [
97 find_program('tar'),
98 '-c',
99 '-f', '@OUTPUT@',
100 '--mtime=1970-01-01 00:00:00Z',
101 '--group=0',
102 '--owner=0',
103 '--numeric-owner',
104 '--mode=go=rX,u+rw,a-s',
105 '--no-acls',
106 '--no-selinux',
107 '--no-xattrs',
108 '--format=ustar',
109 '--transform', 's:@OUTDIR@/::',
110 '@INPUT@',
111]
Note: See TracBrowser for help on using the repository browser.