File indexing completed on 2024-05-12 04:44:28

0001 #!/bin/bash
0002 
0003 # SPDX-FileCopyrightText: Lukas Sommer <sommerluk@gmail.com>
0004 # SPDX-License-Identifier: BSD-2-Clause OR MIT
0005 
0006 
0007 
0008 
0009 
0010 ################# Configure #################
0011 
0012 # The “.” command will execute the given script within the context of
0013 # the current script, which is necessary in order to preserve the
0014 # environment variables that are set by the given script.
0015 . scripts/export-environment.sh
0016 
0017 
0018 
0019 
0020 
0021 ################# Run static code analysis #################
0022 # NOTE LWYU uses only 1 process to make sure that error messages
0023 # are printed at the correct position below the linker command
0024 # that indicates the affected file.
0025 
0026 mkdir --parents build \
0027     && rm --recursive --force build/* \
0028     && cd build \
0029     \
0030     && echo "LWYU (link what you use) started." \
0031     && cmake -DCMAKE_LINK_WHAT_YOU_USE=TRUE .. > /dev/null \
0032     && nice --adjustment 19 \
0033         make --jobs 1 all 2>&1 \
0034         | grep --invert-match --perl-regexp "^\[ *[0-9]*\%\] [^L]" \
0035         | grep --invert-match --perl-regexp "^Scanning" \
0036     && echo "LWYU (link what you use) finished." \
0037     && cd .. \
0038     && rm --recursive --force build/* \
0039     \
0040 
0041 # Clean the directory even if one of the commands below has failed:
0042 mkdir --parents build \
0043     && rm --recursive --force build/* \