Tue, 19 Sep 2017 14:13:40 +0200
adds cppcheck make target
Makefile | file | annotate | diff | comparison | revisions | |
cppcheck.mk | file | annotate | diff | comparison | revisions | |
ucx/Makefile | file | annotate | diff | comparison | revisions |
1.1 --- a/Makefile Sat Jul 15 22:36:29 2017 +0200 1.2 +++ b/Makefile Tue Sep 19 14:13:40 2017 +0200 1.3 @@ -40,6 +40,7 @@ 1.4 PREFIX=/usr/local 1.5 1.6 include $(CONF).mk 1.7 +include cppcheck.mk 1.8 1.9 all: ucx test 1.10 1.11 @@ -81,6 +82,14 @@ 1.12 1.13 clean: FORCE 1.14 $(RM) $(RMFLAGS) build 1.15 + 1.16 +build: 1.17 + mkdir -p build 1.18 + 1.19 +cppcheck: FORCE build 1.20 + truncate -s0 $(CPPCHECK_LOG) 1.21 + cd ucx; $(MAKE) CONF=$(CONF) cppcheck 1.22 + @echo "Static code analysis complete. See $(CPPCHECK_LOG) for the results." 1.23 1.24 FORCE: 1.25
2.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 2.2 +++ b/cppcheck.mk Tue Sep 19 14:13:40 2017 +0200 2.3 @@ -0,0 +1,33 @@ 2.4 +# 2.5 +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. 2.6 +# 2.7 +# Copyright 2016 Olaf Wintermann. All rights reserved. 2.8 +# 2.9 +# Redistribution and use in source and binary forms, with or without 2.10 +# modification, are permitted provided that the following conditions are met: 2.11 +# 2.12 +# 1. Redistributions of source code must retain the above copyright 2.13 +# notice, this list of conditions and the following disclaimer. 2.14 +# 2.15 +# 2. Redistributions in binary form must reproduce the above copyright 2.16 +# notice, this list of conditions and the following disclaimer in the 2.17 +# documentation and/or other materials provided with the distribution. 2.18 +# 2.19 +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 2.20 +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 2.21 +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 2.22 +# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 2.23 +# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 2.24 +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 2.25 +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 2.26 +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 2.27 +# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 2.28 +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 2.29 +# POSSIBILITY OF SUCH DAMAGE. 2.30 +# 2.31 + 2.32 +CPPCHECK=cppcheck 2.33 +CPPCHECK_CONFIG=--max-configs=32 -j 4 2.34 +CPPCHECK_FLAGS=--enable=warning,performance,portability,unusedFunction 2.35 +CPPCHECK_LOG=build/cppcheck.log 2.36 +
3.1 --- a/ucx/Makefile Sat Jul 15 22:36:29 2017 +0200 3.2 +++ b/ucx/Makefile Tue Sep 19 14:13:40 2017 +0200 3.3 @@ -27,6 +27,7 @@ 3.4 # 3.5 3.6 include ../$(CONF).mk 3.7 +include ../cppcheck.mk 3.8 3.9 # list of source files 3.10 SRC = utils.c 3.11 @@ -73,3 +74,6 @@ 3.12 3.13 ../build/debug/ucx: 3.14 $(MKDIR) $(MKDIRFLAGS) ../build/debug/ucx 3.15 + 3.16 +cppcheck: $(SRC) 3.17 + $(CPPCHECK) $(CPPCHECK_CONFIG) $(CPPCHECK_FLAGS) $+ 2>> ../$(CPPCHECK_LOG)