<commit_before># Copyright (c) 2014-2016 Dr. <NAME> and <NAME>
# Please see LICENSE for license or visit https://github.com/ColinH/PEGTL

ifeq ($(OS),Windows_NT)
UNAME_S := $(OS)
ifeq ($(shell gcc -dumpmachine),mingw32)
MINGW_CXXFLAGS = -U__STRICT_ANSI__
endif
else
UNAME_S := $(shell uname -s)
endif

# For Darwin (Mac OS X) we assume that the default compiler
# clang++ is used; when $(CXX) is some version of g++, then
# $(PEGTL_CXXSTD) has to be set to -std=c++11 (or newer) so
# that -stdlib=libc++ is not automatically added.

ifeq ($(PEGTL_CXXSTD),)
PEGTL_CXXSTD := -std=c++11
ifeq ($(UNAME_S),Darwin)
PEGTL_CXXSTD += -stdlib=libc++
endif
endif

# Ensure strict standard compliance and no warnings, can be
# changed if desired.

PEGTL_CPPFLAGS ?= -pedantic
PEGTL_CXXFLAGS ?= -Wall -Wextra -Wshadow -Werror -O3 $(MINGW_CXXFLAGS)

PEGTL_CLANG_TIDY ?= clang-tidy

.PHONY: all compile check valgrind cppcheck clang-tidy clean

HEADERS := pegtl.hh $(shell find pegtl -name '*.hh')
SOURCES := $(wildcard */*.cc)
DEPENDS := $(SOURCES:%.cc=build/%.d)
BINARIES := $(SOURCES:%.cc=build/%)

UNIT_TESTS := $(filter build/unit_tests/%,$(BINARIES))

all: compile check

compile: $(BINARIES)

check: $(UNIT_TESTS)
	@echo "Built with '$(CXX) $(PEGTL_CXXSTD) -I. $(PEGTL_CPPFLAGS) $(PEGTL_CXXFLAGS)'."
	@set -e; for T in $(UNIT_TESTS); do echo $$T; $$T < unit_tests/file_data.txt > /dev/null; done
	@echo "All $(words $(UNIT_TESTS)) unit tests passed."

build/%.valgrind: build/%
	valgrind --error-exitcode=1 --leak-check=full $< <unit_tests/file_data.txt
	@touch $@

valgrind: $(UNIT_TESTS:%=%.valgrind)
	@echo "All $(words $(UNIT_TESTS)) valgrind tests passed."

build/%.cppcheck: %.hh
	cppcheck --error-exitcode=1 --inconclusive --force --std=c++11 $<
	@mkdir -p $(@D)
	@touch $@

cppcheck: $(HEADERS:%.hh=build/%.cppcheck)
	@echo "All $(words $(HEADERS)) cppcheck tests passed."

build/%.clang-tidy: %
	$(PEGTL_CLANG_TIDY) -extra-arg "-I." -extra-arg "-std=c++11" $<
	@mkdir -p $(@D)
	@touch $@

clang-tidy: $(HEADERS:%=build/%.clang-tidy) $(SOURCES:%=build/%.clang-tidy)
	@echo "All $(words $(HEADERS) $(SOURCES)) clang-tidy tests passed."

clean:
	rm -rf build/*

.SECONDARY:<commit_msg>Enable more checks from clang-tidy<commit_after># Copyright (c) 2014-2016 Dr. <NAME> and <NAME>
# Please see LICENSE for license or visit https://github.com/ColinH/PEGTL

ifeq ($(OS),Windows_NT)
UNAME_S := $(OS)
ifeq ($(shell gcc -dumpmachine),mingw32)
MINGW_CXXFLAGS = -U__STRICT_ANSI__
endif
else
UNAME_S := $(shell uname -s)
endif

# For Darwin (Mac OS X) we assume that the default compiler
# clang++ is used; when $(CXX) is some version of g++, then
# $(PEGTL_CXXSTD) has to be set to -std=c++11 (or newer) so
# that -stdlib=libc++ is not automatically added.

ifeq ($(PEGTL_CXXSTD),)
PEGTL_CXXSTD := -std=c++11
ifeq ($(UNAME_S),Darwin)
PEGTL_CXXSTD += -stdlib=libc++
endif
endif

# Ensure strict standard compliance and no warnings, can be
# changed if desired.

PEGTL_CPPFLAGS ?= -pedantic
PEGTL_CXXFLAGS ?= -Wall -Wextra -Wshadow -Werror -O3 $(MINGW_CXXFLAGS)

PEGTL_CLANG_TIDY ?= clang-tidy

.PHONY: all compile check valgrind cppcheck clang-tidy clean

HEADERS := pegtl.hh $(shell find pegtl -name '*.hh')
SOURCES := $(wildcard */*.cc)
DEPENDS := $(SOURCES:%.cc=build/%.d)
BINARIES := $(SOURCES:%.cc=build/%)

UNIT_TESTS := $(filter build/unit_tests/%,$(BINARIES))

all: compile check

compile: $(BINARIES)

check: $(UNIT_TESTS)
	@echo "Built with '$(CXX) $(PEGTL_CXXSTD) -I. $(PEGTL_CPPFLAGS) $(PEGTL_CXXFLAGS)'."
	@set -e; for T in $(UNIT_TESTS); do echo $$T; $$T < unit_tests/file_data.txt > /dev/null; done
	@echo "All $(words $(UNIT_TESTS)) unit tests passed."

build/%.valgrind: build/%
	valgrind --error-exitcode=1 --leak-check=full $< <unit_tests/file_data.txt
	@touch $@

valgrind: $(UNIT_TESTS:%=%.valgrind)
	@echo "All $(words $(UNIT_TESTS)) valgrind tests passed."

build/%.cppcheck: %.hh
	cppcheck --error-exitcode=1 --inconclusive --force --std=c++11 $<
	@mkdir -p $(@D)
	@touch $@

cppcheck: $(HEADERS:%.hh=build/%.cppcheck)
	@echo "All $(words $(HEADERS)) cppcheck tests passed."

build/%.clang-tidy: %
	$(PEGTL_CLANG_TIDY) -extra-arg "-I." -extra-arg "-std=c++11" -checks=*,-google-*,-llvm-include-order,-clang-analyzer-alpha*,-cppcoreguidelines*,-readability-named-parameter $< 2>/dev/null
	@mkdir -p $(@D)
	@touch $@

clang-tidy: $(HEADERS:%=build/%.clang-tidy) $(SOURCES:%=build/%.clang-tidy)
	@echo "All $(words $(HEADERS) $(SOURCES)) clang-tidy tests passed."

clean:
	rm -rf build/*

.SECONDARY:
{'fraction_non_alphanumeric': 0.1842163600088672, 'fraction_numerical': 0.009532254489026823, 'mean_word_length': 4.647058823529412, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 10, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5030522', 'n_tokens_mistral': 1872, 'n_tokens_neox': 1787, 'n_words': 457}