Skip to content

Commit

Permalink
Add a Cppcheck makefile for parallel building
Browse files Browse the repository at this point in the history
The one-shot command works, but only use a single core. This build
benefits significantly from parallelization, and make is the easiest way
to do it. Since the original Cppcheck makefile doesn't do the right
thing, supply a custom build.
  • Loading branch information
skeeto committed Sep 11, 2022
1 parent 5a16f37 commit 644e2cd
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
7 changes: 2 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -421,11 +421,8 @@ RUN sed -i /RT_MANIFEST/d win32/ctags.rc \
&& cp ctags.exe $PREFIX/bin/

WORKDIR /cppcheck-$CPPCHECK_VERSION
RUN $ARCH-g++ -Os -s -o cppcheck.exe \
-Ilib -Iexternals/simplecpp -Iexternals/tinyxml2 -Iexternals/picojson \
cli/*.cpp lib/*.cpp \
externals/tinyxml2/tinyxml2.cpp externals/simplecpp/simplecpp.cpp \
-lshlwapi \
COPY src/cppcheck.mak $PREFIX/src/
RUN make -f $PREFIX/src/cppcheck.mak -j$(nproc) CXX=$ARCH-g++ \
&& mkdir $PREFIX/share/cppcheck/ \
&& cp -r cppcheck.exe cfg/ $PREFIX/share/cppcheck \
&& $ARCH-gcc -DEXE=../share/cppcheck/cppcheck.exe -DCMD=cppcheck \
Expand Down
8 changes: 8 additions & 0 deletions src/cppcheck.mak
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
ext := $(shell find externals -mindepth 1 -type d)
src := $(shell find cli lib externals -name '*.cpp')
obj := $(src:.cpp=.o)
CXXFLAGS := -Os -Ilib $(addprefix -I,$(ext))
LDFLAGS := -s
LDLIBS := -lshlwapi
cppcheck$(EXE): $(obj)
$(CXX) $(LDFLAGS) -o $@ $(obj) $(LDLIBS)

1 comment on commit 644e2cd

@ahmed775216
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

<3

Please sign in to comment.