2022-01-17 05:58:25 +08:00
|
|
|
#!/usr/bin/env make
|
2020-07-31 03:09:39 +08:00
|
|
|
|
2022-01-17 05:58:25 +08:00
|
|
|
ANKISYNCD_NAME ?= Anki Sync Server
|
2022-01-17 06:51:51 +08:00
|
|
|
ANKISYNCD_VERSION ?= v2.3.0
|
2022-01-17 05:58:25 +08:00
|
|
|
ANKISYNCD_DESCRIPTION ?= Self-hosted Anki Sync Server.
|
2020-07-31 03:09:39 +08:00
|
|
|
|
2020-12-24 07:27:21 +08:00
|
|
|
ENV ?= local
|
2020-07-31 03:09:39 +08:00
|
|
|
-include config/.env.${ENV}
|
2022-01-17 05:58:25 +08:00
|
|
|
-include config/secrets/.env.*.${ENV}
|
2020-07-31 03:09:39 +08:00
|
|
|
export
|
|
|
|
|
|
|
|
|
|
.DEFAULT_GOAL := help
|
|
|
|
|
.PHONY: help #: Display list of command and exit.
|
|
|
|
|
help:
|
2022-01-17 05:58:25 +08:00
|
|
|
@${AWK} 'BEGIN {FS = " ?#?: "; print "${ANKISYNCD_NAME} ${ANKISYNCD_VERSION}\n${ANKISYNCD_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:09:39 +08:00
|
|
|
|
2020-07-31 03:21:33 +08:00
|
|
|
.PHONY: docs #: Build and serve documentation.
|
2022-01-17 05:58:25 +08:00
|
|
|
docs:
|
|
|
|
|
@${MKDOCS} ${MKDOCS_CMD} -f docs/mkdocs.yml ${MKDOCS_OPTS}
|
2020-07-31 03:21:33 +08:00
|
|
|
|
2020-12-24 07:24:07 +08:00
|
|
|
.PHONY: tests #: Run unit tests.
|
|
|
|
|
tests:
|
2022-01-17 05:58:25 +08:00
|
|
|
@${UNITTEST} discover -s tests
|
2020-12-24 07:24:07 +08:00
|
|
|
|
2021-02-08 00:19:53 +08:00
|
|
|
.PHONY: run
|
|
|
|
|
run:
|
2022-01-17 05:58:25 +08:00
|
|
|
@${PYTHON} src/ankisyncd/__main__.py
|
2020-07-31 04:47:36 +08:00
|
|
|
|
2022-01-17 05:58:25 +08:00
|
|
|
# Run scripts using make
|
2020-07-31 03:09:39 +08:00
|
|
|
%:
|
2022-01-17 05:58:25 +08:00
|
|
|
@if [[ -f "scripts/${*}.sh" ]]; then \
|
|
|
|
|
${BASH} "scripts/${*}.sh"; fi
|
2020-12-24 07:22:16 +08:00
|
|
|
|
|
|
|
|
.PHONY: init #: Download Python dependencies.
|
|
|
|
|
init:
|
2021-02-08 00:19:53 +08:00
|
|
|
@${POETRY} install
|
|
|
|
|
|
2022-01-17 05:58:25 +08:00
|
|
|
.PHONY: release #: Create new Git release and tags.
|
2022-01-17 06:23:51 +08:00
|
|
|
release: release-branch release-tags
|
2022-01-17 05:58:25 +08:00
|
|
|
|
2021-02-08 00:19:53 +08:00
|
|
|
.PHONY: open
|
|
|
|
|
open:
|
2022-01-17 05:58:25 +08:00
|
|
|
@${OPEN} ${ANKISYNCD_URL}
|