mirror of
https://github.com/vale981/apheleia
synced 2025-03-05 09:31:40 -05:00
54 lines
1.4 KiB
Makefile
54 lines
1.4 KiB
Makefile
VERSION ?=
|
|
CMD ?=
|
|
|
|
EMACS ?= emacs
|
|
|
|
# The order is important for compilation.
|
|
for_compile := *.el
|
|
for_checkdoc := *.el
|
|
|
|
.PHONY: help
|
|
help: ## Show this message
|
|
@echo "usage:" >&2
|
|
@grep -h "[#]# " $(MAKEFILE_LIST) | \
|
|
sed 's/^/ make /' | \
|
|
sed 's/:[^#]*[#]# /|/' | \
|
|
sed 's/%/LANG/' | \
|
|
column -t -s'|' >&2
|
|
|
|
.PHONY: lint
|
|
lint: compile checkdoc longlines ## Build project and run all linters
|
|
|
|
.PHONY: compile
|
|
compile: ## Check for byte-compiler errors
|
|
@for file in $(for_compile); do \
|
|
echo "[compile] $$file" ;\
|
|
rm -f "$${file}c" ;\
|
|
$(EMACS) -Q --batch -L . -f batch-byte-compile $$file 2>&1 \
|
|
| grep -v "^Wrote" \
|
|
| grep . && exit 1 || true ;\
|
|
done
|
|
|
|
.PHONY: checkdoc
|
|
checkdoc: ## Check for missing or poorly formatted docstrings
|
|
@for file in $(for_checkdoc); do \
|
|
echo "[checkdoc] $$file" ;\
|
|
$(EMACS) -Q --batch \
|
|
--eval "(or (fboundp 'checkdoc-file) (kill-emacs))" \
|
|
--eval "(setq sentence-end-double-space nil)" \
|
|
--eval "(checkdoc-file \"$$file\")" 2>&1 \
|
|
| grep . && exit 1 || true ;\
|
|
done
|
|
|
|
.PHONY: longlines
|
|
longlines: ## Check for long lines
|
|
@scripts/check-line-length.bash
|
|
|
|
.PHONY: clean
|
|
clean: ## Remove build artifacts
|
|
@echo "[clean]" *.elc
|
|
@rm -f *.elc
|
|
|
|
.PHONY: docker
|
|
docker: ## Start a Docker shell; e.g. make docker VERSION=25.3
|
|
@scripts/docker.bash "$(VERSION)" "$(CMD)"
|