2020-07-31 03:09:39 +08:00
|
|
|
#/bin/make
|
|
|
|
|
|
|
|
|
|
ANKI_SERVER_NAME ?= "Anki Sync Server"
|
|
|
|
|
ANKI_SERVER_VERSION ?= "v0.1.0"
|
|
|
|
|
ANKI_SERVER_DESCRIPTION ?= "Self-hosted Anki Sync Server."
|
|
|
|
|
|
2020-12-24 07:27:21 +08:00
|
|
|
ENV ?= local
|
2020-07-31 03:09:39 +08:00
|
|
|
-include config/.env.${ENV}
|
|
|
|
|
export
|
|
|
|
|
|
|
|
|
|
.DEFAULT_GOAL := help
|
|
|
|
|
.PHONY: help #: Display list of command and exit.
|
|
|
|
|
help:
|
|
|
|
|
@awk 'BEGIN {FS = " ?#?: "; print ""${ANKI_SERVER_NAME}" "${ANKI_SERVER_VERSION}"\n"${ANKI_SERVER_DESCRIPTION}"\n\nUsage: make \033[36m<command>\033[0m\n\nCommands:"} /^.PHONY: ?[a-zA-Z_-]/ { printf " \033[36m%-10s\033[0m %s\n", $$2, $$3 }' $(MAKEFILE_LIST)
|
|
|
|
|
|
2020-07-31 03:21:33 +08:00
|
|
|
.PHONY: docs #: Build and serve documentation.
|
|
|
|
|
docs: print-env
|
2021-02-08 00:19:53 +08:00
|
|
|
@${PYTHON} -m mkdocs ${MKDOCS_OPTION} -f docs/mkdocs.yml
|
2020-07-31 03:21:33 +08:00
|
|
|
|
2020-12-24 07:24:07 +08:00
|
|
|
.PHONY: tests #: Run unit tests.
|
|
|
|
|
tests:
|
2021-02-08 00:19:53 +08:00
|
|
|
@${PYTHON} -m unittest discover -s tests
|
2020-12-24 07:24:07 +08:00
|
|
|
|
2021-02-08 00:19:53 +08:00
|
|
|
.PHONY: run
|
|
|
|
|
run:
|
|
|
|
|
@${PYTHON} -m ankisyncd
|
2020-07-31 04:47:36 +08:00
|
|
|
|
2020-07-31 03:09:39 +08:00
|
|
|
%:
|
|
|
|
|
@test -f scripts/${*}.sh
|
2021-02-08 00:19:53 +08:00
|
|
|
@${BASH} scripts/${*}.sh
|
2020-12-24 07:22:16 +08:00
|
|
|
|
|
|
|
|
.PHONY: init #: Download Python dependencies.
|
|
|
|
|
init:
|
2021-02-08 00:19:53 +08:00
|
|
|
@${POETRY} install
|
|
|
|
|
|
2020-12-28 04:56:34 +08:00
|
|
|
%:
|
|
|
|
|
@test -f scripts/${*}.sh
|
|
|
|
|
@${SHELL} scripts/${*}.sh
|
|
|
|
|
|
|
|
|
|
.PHONY: release #: Tag and deploy to PyPI.
|
|
|
|
|
release:
|
|
|
|
|
@${SHELL} scripts/release.sh
|
2021-02-08 00:19:53 +08:00
|
|
|
.PHONY: open
|
|
|
|
|
open:
|
|
|
|
|
@${OPEN} http://127.0.0.1:27701
|