diff --git a/contrib/cppcheck.mak b/contrib/cppcheck.mak index b8187f4..649acba 100644 --- a/contrib/cppcheck.mak +++ b/contrib/cppcheck.mak @@ -1,8 +1,26 @@ +# Build and install Cppcheck inside w64devkit +# +# Invoke in a Cppcheck source tree: +# $ make -j$(nproc) -f path/to/cppcheck.mak install +# +# Alternatively, use the default target and run it in place in the +# source tree without installing. + ext := $(shell find externals -mindepth 1 -type d) src := $(shell find cli lib externals -name '*.cpp') obj := $(src:.cpp=.o) -CXXFLAGS := -w -Os -Ilib $(addprefix -I,$(ext)) +CXXFLAGS := -w -O2 -Ilib $(addprefix -I,$(ext)) + cppcheck.exe: $(obj) $(CXX) -s -o $@ $(obj) -lshlwapi -cppcheck: $(obj) - $(CXX) -pthread -s -o $@ $(obj) + +install: cppcheck.exe + mkdir -p "$$W64DEVKIT_HOME"/share/cppcheck + cp -r cppcheck.exe cfg/ "$$W64DEVKIT_HOME"/share/cppcheck/ + $(CC) -DEXE=../share/cppcheck/cppcheck.exe -DCMD=cppcheck \ + -Oz -s -nostartfiles -o "$$W64DEVKIT_HOME"/bin/cppcheck.exe \ + "$$W64DEVKIT_HOME"/src/alias.c + +uninstall: + rm -rf "$$W64DEVKIT_HOME"/share/cppcheck/ \ + "$$W64DEVKIT_HOME"/bin/cppcheck.exe