anki-sync-server/Makefile

56 lines
1.3 KiB
Makefile
Raw Normal View History

#!/usr/bin/env make
ANKISYNCD_NAME ?= Anki Sync Server
2022-07-02 21:40:12 +08:00
ANKISYNCD_VERSION ?= v2.4.0
ANKISYNCD_DESCRIPTION ?= Self-hosted Anki Sync Server.
ENV ?= local
-include config/.env.${ENV}
-include config/secrets/.env.*.${ENV}
export
.DEFAULT_GOAL := help
.PHONY: help #: Display list of command and exit.
help:
@${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)
.PHONY: docs #: Build and serve documentation.
docs:
@${MKDOCS} ${MKDOCS_CMD} -f docs/mkdocs.yml ${MKDOCS_OPTS}
2020-12-24 07:24:07 +08:00
.PHONY: tests #: Run unit tests.
tests:
@${UNITTEST} discover -s tests
2020-12-24 07:24:07 +08:00
.PHONY: run
run:
@${PYTHON} src/ankisyncd/__main__.py
# Run scripts using make
%:
@if [[ -f "scripts/${*}.sh" ]]; then \
${BASH} "scripts/${*}.sh"; fi
.PHONY: config #: Create new config file.
config: config/.env.${ENV}
config/.env.%:
@cp -n config/.env.example config/.env.${ENV}
.PHONY: init #: Download Python dependencies.
init:
@${POETRY} install
.PHONY: build
build:
@${POETRY} build
.PHONY: release #: Create new Git release and tags.
release: release-branch release-tags
.PHONY: publish
publish: build
@${POETRY} publish
.PHONY: open
open:
@${OPEN} ${ANKISYNCD_URL}