Skip to content

Commit f0314ce

Browse files
committed
cppcheck.mak: Add install and uninstall targets
If someone has their heart set on Cppcheck, this makes it even easier to install just as it used to be distributed.
1 parent 6a54545 commit f0314ce

File tree

1 file changed

+21
-3
lines changed

1 file changed

+21
-3
lines changed

contrib/cppcheck.mak

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,26 @@
1+
# Build and install Cppcheck inside w64devkit
2+
#
3+
# Invoke in a Cppcheck source tree:
4+
# $ make -j$(nproc) -f path/to/cppcheck.mak install
5+
#
6+
# Alternatively, use the default target and run it in place in the
7+
# source tree without installing.
8+
19
ext := $(shell find externals -mindepth 1 -type d)
210
src := $(shell find cli lib externals -name '*.cpp')
311
obj := $(src:.cpp=.o)
4-
CXXFLAGS := -w -Os -Ilib $(addprefix -I,$(ext))
12+
CXXFLAGS := -w -O2 -Ilib $(addprefix -I,$(ext))
13+
514
cppcheck.exe: $(obj)
615
$(CXX) -s -o $@ $(obj) -lshlwapi
7-
cppcheck: $(obj)
8-
$(CXX) -pthread -s -o $@ $(obj)
16+
17+
install: cppcheck.exe
18+
mkdir -p "$$W64DEVKIT_HOME"/share/cppcheck
19+
cp -r cppcheck.exe cfg/ "$$W64DEVKIT_HOME"/share/cppcheck/
20+
$(CC) -DEXE=../share/cppcheck/cppcheck.exe -DCMD=cppcheck \
21+
-Oz -s -nostartfiles -o "$$W64DEVKIT_HOME"/bin/cppcheck.exe \
22+
"$$W64DEVKIT_HOME"/src/alias.c
23+
24+
uninstall:
25+
rm -rf "$$W64DEVKIT_HOME"/share/cppcheck/ \
26+
"$$W64DEVKIT_HOME"/bin/cppcheck.exe

0 commit comments

Comments
 (0)