Add targets check1 (cppcheck) and check2 (clang-tidy)
This commit is contained in:
parent
1f4311529e
commit
7532011245
1 changed files with 27 additions and 18 deletions
39
Makefile
39
Makefile
|
|
@ -56,20 +56,29 @@ endif
|
|||
# OS dependent flags
|
||||
#
|
||||
OS := $(shell uname -s)
|
||||
ifeq ($(OS),Linux)
|
||||
|
||||
ifeq ($(MAKECMDGOALS),check1)
|
||||
ifeq ($(OS),Linux)
|
||||
# installed by system and in PATH
|
||||
CPPCHECK := cppcheck
|
||||
CHECKFLAGS := --platform=unix64
|
||||
DBG_REL +=
|
||||
endif
|
||||
# OpenIndiana and flavours
|
||||
ifeq ($(OS),SunOS)
|
||||
CHECKFLAGS :=
|
||||
endif
|
||||
ifeq ($(OS),SunOS)
|
||||
# local installation
|
||||
CPPCHECK := $(HOME)/devl/cppcheck/bin/cppcheck
|
||||
CHECKFLAGS := --platform=unix64
|
||||
DBG_REL +=
|
||||
endif
|
||||
# Uncomment one of the following to select an output format
|
||||
#CHECKFLAGS = --template="{file},{line},{severity},{id},{message}"
|
||||
#CHECKFLAGS = --platform=unix64 --quiet --enable=all --error-exitcode=1 --check-level=exhaustive -I./include
|
||||
CHECKFLAGS = --enable=all --error-exitcode=1 --suppress=missingIncludeSystem
|
||||
endif
|
||||
|
||||
ifeq ($(MAKECMDGOALS),check2)
|
||||
CPPCHECK := clang-tidy
|
||||
CHECKFLAGS := --checks=*
|
||||
endif
|
||||
|
||||
|
||||
|
||||
SRC_DIR := src
|
||||
OBJ_DIR := obj
|
||||
|
|
@ -134,13 +143,11 @@ APP_LIBS=
|
|||
LIBS = $(NETBEANSBUILD) $(APP_LIBS)
|
||||
|
||||
|
||||
# Uncomment one of the following to select an output format
|
||||
#CHECKFLAGS = --template="{file},{line},{severity},{id},{message}"
|
||||
CHECKFLAGS += --quiet --enable=all --error-exitcode=1 --check-level=exhaustive -I./include
|
||||
#CHECKFLAGS = --enable=all --error-exitcode=1
|
||||
|
||||
debug release: DIRS $(APP)
|
||||
check: cppcheck.out
|
||||
.PHONY: check1 check2
|
||||
check1 check2: check
|
||||
|
||||
|
||||
|
||||
$(APP): $(OBJS)
|
||||
|
|
@ -152,10 +159,11 @@ $(OBJ_DIR)/%.o: $(SRC_DIR)/%.cpp
|
|||
DIRS:
|
||||
mkdir -p obj bin
|
||||
|
||||
cppcheck.out: $(SRC)
|
||||
check: $(SRC)
|
||||
$(info output to cppcheck.out)
|
||||
$(info Check using: : $(CPPCHECK))
|
||||
$(CPPCHECK) $(CHECKFLAGS) $^ > $@ 2>&1
|
||||
$(CPPCHECK) $(CHECKFLAGS) $^
|
||||
|
||||
|
||||
.PHONY: clean
|
||||
clean:
|
||||
|
|
@ -163,3 +171,4 @@ clean:
|
|||
@rm -f $(APP) $(OBJ_DIR)/* ./bin/$(APP) cppcheck.out
|
||||
@if [ -d "./bin" ]; then rmdir ./bin ; fi
|
||||
@if [ -d "./obj" ]; then rmdir ./obj ; fi
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue