# SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright 2026 The appinfra Authors

local := $(dir $(realpath $(lastword $(MAKEFILE_LIST))))

# ============================================================================
# Project Configuration
# ============================================================================
# These settings can also be overridden in Makefile.local (gitignored)

# Enable strict code quality checks (30-line function limit)
APPINFRA_DEV_CQ_STRICT ?= true

# Enforce SPDX license headers on tracked .py files (Apache-2.0 attribution)
APPINFRA_DEV_CQ_SPDX ?= true

# No ruff rules reported as warnings only: appinfra enforces them in pyproject's select
APPINFRA_DEV_CQ_LINT_SELECT ?= false

# Duplicated code and dead private code checks: false, warn or strict
APPINFRA_DEV_CQ_DUP ?= strict
APPINFRA_DEV_CQ_DEAD ?= strict

# Run every example script as a test subcheck of `make check`
APPINFRA_DEV_CHECK_EXAMPLES ?= true

# Coverage counts unit and integration tests: code that touches the filesystem, processes or
# sockets is covered by integration tests
APPINFRA_PYTEST_COVERAGE_MARKERS ?= unit or integration

# Performance tests all live here; collecting only this directory skips importing the rest
APPINFRA_PYTEST_PERF_DIR ?= tests/performance

# Coverage threshold (framework default is 80%)
APPINFRA_PYTEST_COVERAGE_THRESHOLD ?= 95

# Docstring coverage threshold (framework default is 80%)
APPINFRA_DEV_DOCSTRING_THRESHOLD ?= 95

# Test structure health line in make check (framework default is off)
APPINFRA_DEV_TEST_HEALTH ?= strict

# Install with all optional extras
APPINFRA_DEV_INSTALL_EXTRAS ?= all

# PostgreSQL configuration (filename only - resolved from APPINFRA_ETC_DIR)
APPINFRA_PG_CONFIG_FILE ?= pg.yaml
#APPINFRA_PG_CONFIG_KEY ?= pgserver

# Documentation configuration (filename only - resolved from APPINFRA_ETC_DIR)
APPINFRA_DOCS_CONFIG_FILE ?= mkdocs.yaml

# ============================================================================
# Load Infra Framework
# ============================================================================

# Load configuration first (sets defaults, handles deprecation)
include $(local)/scripts/make/Makefile.config

# Python environment detection (supports env var, Makefile.local, ~/.venv)
include $(local)/scripts/make/Makefile.env

include $(local)/scripts/make/Makefile.help
include $(local)/scripts/make/Makefile.utils
include $(local)/scripts/make/Makefile.dev
include $(local)/scripts/make/Makefile.install
include $(local)/scripts/make/Makefile.pytest
include $(local)/scripts/make/Makefile.docs
include $(local)/scripts/make/Makefile.pg
include $(local)/scripts/make/Makefile.clean
