<commit_before># Determine version number from README (will include "-UNRELEASED")
VERSION := $(shell sed --expression '/^Version /!d' --expression 's/^Version //' README)

# Main directories and files
PREFIX := .
SRC_DIR := ${PREFIX}/src
TESTS_DIR := ${PREFIX}/tests
EXAMPLES_DIR := ${PREFIX}/examples
FILES := ${PREFIX}/CHANGELOG ${PREFIX}/LICENSE ${PREFIX}/NOTICE ${PREFIX}/README

# Distribution locations
DIST_DIR := ${PREFIX}/sag-${VERSION}
DIST_FILE := ${DIST_DIR}.tar.gz
DIST_FILE_SIG := ${DIST_FILE}.sig

# PHPUnit related tools and files
TESTS_BOOTSTRAP := ${TESTS_DIR}/bootstrap.bsh
TESTS_CONFIG := ${TESTS_DIR}/phpunitConfig.xml
TESTS_PHP_INCLUDE_PATH := $(shell php -r 'echo ini_get("include_path");'):$(SRC_DIR)
TESTS_PHPUNIT_OPTS := -d "include_path=${TESTS_PHP_INCLUDE_PATH}" \
			--configuration=${TESTS_CONFIG}

dist: clean ${DIST_DIR} test
	@@echo "[ Copying... ]"
	@@cp -r ${SRC_DIR} ${TESTS_DIR} ${EXAMPLES_DIR} ${FILES} ${DIST_DIR}

	@@echo "[ Archiving and compressing... ]"
	@@tar -zcvvf ${DIST_FILE} ${DIST_DIR} > /dev/null
	@@rm -rf ${DIST_DIR}
test:
	@@echo "[ Bootstrapping tests... ]" ; \
		${TESTS_BOOTSTRAP} && \
		echo "[ Running tests... ]" ; \
		phpunit ${TESTS_PHPUNIT_OPTS} ${TESTS_DIR}

sign: dist
	@@gpg --output ${DIST_FILE_SIG} --detach-sig ${DIST_FILE}

clean:
	@@echo "[ Removing files... ]"
	@@rm -rf ${DIST_DIR} ${DIST_FILE} ${DIST_FILE_SIG}
  
${DIST_DIR}:
	@@mkdir -p ${DIST_DIR}<commit_msg>Adding tests with code coverage via recursive make.<commit_after># Determine version number from README (will include "-UNRELEASED")
VERSION := $(shell sed --expression '/^Version /!d' --expression 's/^Version //' README)

# Main directories and files
PREFIX := .
SRC_DIR := ${PREFIX}/src
TESTS_DIR := ${PREFIX}/tests
EXAMPLES_DIR := ${PREFIX}/examples
FILES := ${PREFIX}/CHANGELOG ${PREFIX}/LICENSE ${PREFIX}/NOTICE ${PREFIX}/README

# Distribution locations
DIST_DIR := ${PREFIX}/sag-${VERSION}
DIST_FILE := ${DIST_DIR}.tar.gz
DIST_FILE_SIG := ${DIST_FILE}.sig

# PHPUnit related tools and files
TESTS_BOOTSTRAP := ${TESTS_DIR}/bootstrap.bsh
TESTS_CONFIG := ${TESTS_DIR}/phpunitConfig.xml
TESTS_PHP_INCLUDE_PATH := $(shell php -r 'echo ini_get("include_path");'):$(SRC_DIR)
TESTS_PHPUNIT_OPTS := -d "include_path=${TESTS_PHP_INCLUDE_PATH}" \
			--configuration=${TESTS_CONFIG}
TESTS_COVERAGE_DIR := ${TESTS_DIR}/coverage

# Build the distribution
dist: clean ${DIST_DIR} check
	@@echo "[ Copying... ]"
	@@cp -r ${SRC_DIR} ${TESTS_DIR} ${EXAMPLES_DIR} ${FILES} ${DIST_DIR}

	@@echo "[ Archiving and compressing... ]"
	@@tar -zcvvf ${DIST_FILE} ${DIST_DIR} > /dev/null
	@@rm -rf ${DIST_DIR}

# Run the tests
check:
	@@echo "[ Bootstrapping tests... ]" ; \
		${TESTS_BOOTSTRAP} && \
		echo "[ Running tests... ]" ; \
		phpunit ${TESTS_PHPUNIT_OPTS} ${TESTS_DIR}

# Run the tests with code coverage
checkCoverage:
	@@$(MAKE) check TESTS_PHPUNIT_OPTS="${TESTS_PHPUNIT_OPTS} --coverage-html=${TESTS_COVERAGE_DIR}"

# Sign the distribution
sign: dist
	@@gpg --output ${DIST_FILE_SIG} --detach-sig ${DIST_FILE}

# Remove all distribution and other build files
clean:
	@@echo "[ Removing files... ]"
	@@rm -rf ${DIST_DIR} ${DIST_FILE} ${DIST_FILE_SIG} ${TESTS_COVERAGE_DIR}
  
# Create the distribution directory that will be archived
${DIST_DIR}:
	@@mkdir -p ${DIST_DIR}
{'fraction_non_alphanumeric': 0.17964253256588913, 'fraction_numerical': 0.0, 'mean_word_length': 5.036563071297989, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, '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': '1801964', 'n_tokens_mistral': 1238, 'n_tokens_neox': 1162, 'n_words': 278}