# SPDX-License-Identifier: Multics or MIT-0
# Copyright (c) 2025 Jeffrey H. Johnson
# Copyright (c) 2025 The DPS8M Development Team
# scspell-id: 9f257480-9924-11f0-84b8-80ee73e9b8e7

.PHONY: all
all:
	@printf '%s\n' "FATAL: You must specify a target." >&2 || :
	@exit 1

.PHONY: stage1
stage1: run

.PHONY: run
run:
	@./run.sh

.PHONY: ttf
ttf:
	@./run.sh "ttf"

.PHONY: errnum
errnum: errnum.c
	@./run.sh "errnum"

.PHONY: clean
clean:
	@./clean.sh

.PHONY: lint
lint:
	@"$${RM:-rm}" -f errnum
	scan-build --status-bugs make errnum
	@"$${RM:-rm}" -f errnum
	cppcheck --quiet --force --check-level=exhaustive ./*.c
	$$(command -v /opt/developerstudio12.6/bin/lint 2> /dev/null || \
	   command -v /opt/oracle/developerstudio12.6/bin/lint 2> /dev/null || \
	   command -v true) *.c -std=c99 -err=warn -errtags=yes -errfmt=src \
		-erroff=E_NAME_USED_NOT_DEF2,E_NAME_DECL_NOT_USED_DEF2,E_INCONS_ARG_DECL2 \
		-errchk=structarg,longptr64,sizematch,parentheses,locfmtchk \
		-errsecurity=extended -errshort=full -fd
	shellcheck -o any,all ./*.sh
	black --check ./*.py
	$$(command -v flake8 2> /dev/null || command -v true) \
		./*.py --max-line-length=999 --ignore=E203,W503
	codespell -L Groupe,PASE,cursos .
	reuse lint -q || reuse lint
	$$(command -v groff 2> /dev/null || command -v true) -man errnum.1 1> /dev/null

.PHONY: .NOT_PARALLEL test
.NOT_PARALLEL:
