mirror of
https://github.com/ankitects/anki.git
synced 2025-09-18 22:12:21 -04:00
remove old makefiles
This commit is contained in:
parent
99140f6023
commit
b17d537a9e
6 changed files with 0 additions and 711 deletions
204
Makefile
204
Makefile
|
@ -1,204 +0,0 @@
|
||||||
SHELL := /bin/bash
|
|
||||||
|
|
||||||
ifndef SHELLFLAGS
|
|
||||||
SHELLFLAGS :=
|
|
||||||
endif
|
|
||||||
|
|
||||||
.SHELLFLAGS := -eu -o pipefail ${SHELLFLAGS} -c
|
|
||||||
MAKEFLAGS += --warn-undefined-variables
|
|
||||||
MAKEFLAGS += --no-builtin-rules
|
|
||||||
FIND := $(if $(wildcard /bin/find),/bin/find,/usr/bin/find)
|
|
||||||
|
|
||||||
ifndef OS
|
|
||||||
OS := unknown
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifeq (${OS},Windows_NT)
|
|
||||||
# Windows terminal is confusing it with its `cmd` builtin `rename` command
|
|
||||||
ifndef RENAME_BIN
|
|
||||||
RENAME_BIN := perl scripts/rename
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifndef ACTIVATE_SCRIPT
|
|
||||||
ACTIVATE_SCRIPT := pyenv/Scripts/activate
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifndef PYTHON_BIN
|
|
||||||
PYTHON_BIN := python
|
|
||||||
endif
|
|
||||||
else
|
|
||||||
ifndef RENAME_BIN
|
|
||||||
RENAME_BIN := scripts/rename
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifndef ACTIVATE_SCRIPT
|
|
||||||
ACTIVATE_SCRIPT := pyenv/bin/activate
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifndef PYTHON_BIN
|
|
||||||
PYTHON_BIN := python3
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifndef ANKI_EXTRA_PIP
|
|
||||||
ANKI_EXTRA_PIP := true
|
|
||||||
endif
|
|
||||||
|
|
||||||
.DELETE_ON_ERROR:
|
|
||||||
SUBMAKE := $(MAKE) --print-directory
|
|
||||||
.SUFFIXES:
|
|
||||||
|
|
||||||
BUILDFLAGS := --release --strip
|
|
||||||
DEVFLAGS :=
|
|
||||||
RUNFLAGS :=
|
|
||||||
CHECKABLE_PY := pylib qt
|
|
||||||
CHECKABLE_RS := rslib rspy
|
|
||||||
DEVEL := rslib rspy pylib ts qt
|
|
||||||
|
|
||||||
.PHONY: all
|
|
||||||
all: run
|
|
||||||
|
|
||||||
# - modern pip required for wheel
|
|
||||||
# - add qt if missing
|
|
||||||
pyenv:
|
|
||||||
# https://github.com/PyO3/maturin/issues/283 - Expected `python` to be a python interpreter inside a virtualenv
|
|
||||||
set -eu -o pipefail ${SHELLFLAGS}; \
|
|
||||||
"${PYTHON_BIN}" -m venv pyenv; \
|
|
||||||
case "$$(uname -s)" in CYGWIN*|MINGW*|MSYS*) \
|
|
||||||
dos2unix "${ACTIVATE_SCRIPT}"; \
|
|
||||||
VIRTUAL_ENV="$$(pwd)"; \
|
|
||||||
VIRTUAL_ENV="$$(cygpath -m "$${VIRTUAL_ENV}")"; \
|
|
||||||
sed -i -- "s@VIRTUAL_ENV=\".*\"@VIRTUAL_ENV=\"$$(pwd)/pyenv\"@g" "${ACTIVATE_SCRIPT}"; \
|
|
||||||
sed -i -- "s@export PATH@export PATH; VIRTUAL_ENV=\"$${VIRTUAL_ENV}/pyenv\";@g" "${ACTIVATE_SCRIPT}"; \
|
|
||||||
;; esac; \
|
|
||||||
. "${ACTIVATE_SCRIPT}"; \
|
|
||||||
python --version; \
|
|
||||||
python -m pip install --upgrade pip setuptools; \
|
|
||||||
${ANKI_EXTRA_PIP}; \
|
|
||||||
if ! python -c 'import PyQt5' 2>/dev/null; then \
|
|
||||||
python -m pip install -r qt/requirements.qt; \
|
|
||||||
fi;
|
|
||||||
|
|
||||||
# update build hash
|
|
||||||
.PHONY: buildhash
|
|
||||||
buildhash:
|
|
||||||
@set -eu -o pipefail ${SHELLFLAGS}; \
|
|
||||||
oldhash=$$(test -f meta/buildhash && cat meta/buildhash || true); \
|
|
||||||
newhash=$$(git rev-parse --short=8 HEAD || echo dev); \
|
|
||||||
if [ "$$oldhash" != "$$newhash" ]; then \
|
|
||||||
echo $$newhash > meta/buildhash; \
|
|
||||||
fi
|
|
||||||
|
|
||||||
.PHONY: develop
|
|
||||||
develop: pyenv buildhash prepare
|
|
||||||
@set -eu -o pipefail ${SHELLFLAGS}; \
|
|
||||||
. "${ACTIVATE_SCRIPT}"; \
|
|
||||||
for dir in $(DEVEL); do \
|
|
||||||
$(SUBMAKE) -C $$dir develop DEVFLAGS="$(DEVFLAGS)"; \
|
|
||||||
done
|
|
||||||
|
|
||||||
.PHONY: run
|
|
||||||
run: develop
|
|
||||||
@set -eu -o pipefail ${SHELLFLAGS}; \
|
|
||||||
. "${ACTIVATE_SCRIPT}"; \
|
|
||||||
echo "Starting Anki..."; \
|
|
||||||
python qt/runanki $(RUNFLAGS)
|
|
||||||
|
|
||||||
.PHONY: prepare
|
|
||||||
prepare: rslib/ftl/repo qt/ftl/repo qt/po/repo
|
|
||||||
|
|
||||||
rslib/ftl/repo:
|
|
||||||
$(MAKE) pull-i18n
|
|
||||||
qt/ftl/repo:
|
|
||||||
$(MAKE) pull-i18n
|
|
||||||
qt/po/repo:
|
|
||||||
$(MAKE) pull-i18n
|
|
||||||
|
|
||||||
.PHONY: build
|
|
||||||
build: clean-dist build-ts build-rspy build-pylib build-qt add-buildhash
|
|
||||||
@echo
|
|
||||||
@echo "Build complete."
|
|
||||||
|
|
||||||
.PHONY: build-ts
|
|
||||||
build-ts:
|
|
||||||
$(SUBMAKE) -C ts build
|
|
||||||
|
|
||||||
.PHONY: build-rspy
|
|
||||||
build-rspy: pyenv buildhash
|
|
||||||
@set -eu -o pipefail ${SHELLFLAGS}; \
|
|
||||||
. "${ACTIVATE_SCRIPT}"; \
|
|
||||||
$(SUBMAKE) -C rspy build BUILDFLAGS="$(BUILDFLAGS)"
|
|
||||||
|
|
||||||
.PHONY: build-pylib
|
|
||||||
build-pylib:
|
|
||||||
@set -eu -o pipefail ${SHELLFLAGS}; \
|
|
||||||
. "${ACTIVATE_SCRIPT}"; \
|
|
||||||
$(SUBMAKE) -C pylib build
|
|
||||||
|
|
||||||
.PHONY: build-qt
|
|
||||||
build-qt:
|
|
||||||
@set -eu -o pipefail ${SHELLFLAGS}; \
|
|
||||||
. "${ACTIVATE_SCRIPT}"; \
|
|
||||||
$(SUBMAKE) -C qt build
|
|
||||||
|
|
||||||
.PHONY: clean
|
|
||||||
clean: clean-dist
|
|
||||||
@set -eu -o pipefail ${SHELLFLAGS}; \
|
|
||||||
for dir in $(DEVEL); do \
|
|
||||||
$(SUBMAKE) -C $$dir clean; \
|
|
||||||
done
|
|
||||||
|
|
||||||
# remove any files in dist/ folder without current build hash
|
|
||||||
.PHONY: clean-dist
|
|
||||||
clean-dist: buildhash
|
|
||||||
"${FIND}" dist \! -name "*$$(cat meta/buildhash)*" -type f -delete
|
|
||||||
|
|
||||||
.PHONY: check
|
|
||||||
check: pyenv buildhash prepare
|
|
||||||
@set -eu -o pipefail ${SHELLFLAGS}; \
|
|
||||||
.github/scripts/trailing-newlines.sh; \
|
|
||||||
. "${ACTIVATE_SCRIPT}"; \
|
|
||||||
for dir in $(CHECKABLE_RS) ts $(CHECKABLE_PY); do \
|
|
||||||
$(SUBMAKE) -C $$dir check; \
|
|
||||||
done;
|
|
||||||
@echo
|
|
||||||
@echo "All checks passed!"
|
|
||||||
|
|
||||||
.PHONY: fix
|
|
||||||
fix: develop
|
|
||||||
@set -eu -o pipefail ${SHELLFLAGS}; \
|
|
||||||
. "${ACTIVATE_SCRIPT}"; \
|
|
||||||
for dir in $(CHECKABLE_RS) $(CHECKABLE_PY); do \
|
|
||||||
$(SUBMAKE) -C $$dir fix; \
|
|
||||||
done; \
|
|
||||||
|
|
||||||
.PHONY: add-buildhash
|
|
||||||
add-buildhash:
|
|
||||||
@set -eu -o pipefail ${SHELLFLAGS}; \
|
|
||||||
ver="$$(cat meta/version)"; \
|
|
||||||
hash="$$(cat meta/buildhash)"; \
|
|
||||||
${RENAME_BIN} -f "s/-$${ver}(\.|-)/-$${ver}+$${hash}\$$1/" dist/*-"$${ver}"*
|
|
||||||
|
|
||||||
|
|
||||||
.PHONY: pull-i18n
|
|
||||||
pull-i18n:
|
|
||||||
(cd rslib/ftl && scripts/fetch-latest-translations)
|
|
||||||
(cd qt/ftl && scripts/fetch-latest-translations)
|
|
||||||
(cd qt/po && scripts/fetch-latest-translations)
|
|
||||||
|
|
||||||
.PHONY: push-i18n-ftl
|
|
||||||
push-i18n-ftl: pull-i18n
|
|
||||||
(cd rslib/ftl && scripts/upload-latest-templates)
|
|
||||||
(cd qt/ftl && scripts/upload-latest-templates)
|
|
||||||
|
|
||||||
.PHONY: push-i18n-po
|
|
||||||
push-i18n-po: pull-i18n
|
|
||||||
(cd qt/po && scripts/upload-latest-template)
|
|
||||||
|
|
||||||
.PHONY: ts-dev
|
|
||||||
ts-dev: develop
|
|
||||||
@set -eu -o pipefail ${SHELLFLAGS}; \
|
|
||||||
. "${ACTIVATE_SCRIPT}"; \
|
|
||||||
tmux new -d -s anki-ts "ANKIDEV=1 ANKI_API_PORT=9001 python qt/runanki $(RUNFLAGS)"
|
|
||||||
tmux split-window "(cd ts && make dev)"
|
|
||||||
tmux attach
|
|
125
pylib/Makefile
125
pylib/Makefile
|
@ -1,125 +0,0 @@
|
||||||
SHELL := /bin/bash
|
|
||||||
|
|
||||||
ifndef SHELLFLAGS
|
|
||||||
SHELLFLAGS :=
|
|
||||||
endif
|
|
||||||
|
|
||||||
.SHELLFLAGS := -eu -o pipefail ${SHELLFLAGS} -c
|
|
||||||
MAKEFLAGS += --warn-undefined-variables
|
|
||||||
MAKEFLAGS += --no-builtin-rules
|
|
||||||
|
|
||||||
RUNARGS :=
|
|
||||||
MYPY_ARGS :=
|
|
||||||
FIND := $(if $(wildcard /bin/find),/bin/find,/usr/bin/find)
|
|
||||||
|
|
||||||
ifndef OS
|
|
||||||
OS := unknown
|
|
||||||
endif
|
|
||||||
|
|
||||||
# https://anki.tenderapp.com/discussions/beta-testing/1860-error-unused-type-ignore-comment
|
|
||||||
ifneq (${OS},Windows_NT)
|
|
||||||
MYPY_ARGS := --warn-unused-ignores
|
|
||||||
endif
|
|
||||||
|
|
||||||
.DELETE_ON_ERROR:
|
|
||||||
.SUFFIXES:
|
|
||||||
BLACKARGS := -t py36 anki tests setup.py tools/*.py --exclude='_pb2|buildinfo|_gen'
|
|
||||||
ISORTARGS := --profile black anki tests setup.py
|
|
||||||
|
|
||||||
$(shell mkdir -p .build ../dist)
|
|
||||||
|
|
||||||
PHONY: all
|
|
||||||
all: check
|
|
||||||
|
|
||||||
.build/run-deps: setup.py
|
|
||||||
SKIP_ANKI_RSPY=true python -m pip install -e .
|
|
||||||
@touch $@
|
|
||||||
|
|
||||||
.build/dev-deps: requirements.dev
|
|
||||||
python -m pip install -r requirements.dev
|
|
||||||
@touch $@
|
|
||||||
|
|
||||||
PROTODEPS := ../proto/backend.proto ../proto/fluent.proto
|
|
||||||
|
|
||||||
.build/py-proto: .build/dev-deps $(PROTODEPS)
|
|
||||||
protoc --proto_path=../proto --python_out=anki --mypy_out=anki $(PROTODEPS)
|
|
||||||
perl -i'' -pe 's/from fluent_pb2/from anki.fluent_pb2/' anki/backend_pb2.pyi
|
|
||||||
perl -i'' -pe 's/import fluent_pb2/import anki.fluent_pb2/' anki/backend_pb2.py
|
|
||||||
python tools/genbackend.py
|
|
||||||
python -m black -t py36 anki/rsbackend_gen.py
|
|
||||||
@touch $@
|
|
||||||
|
|
||||||
.build/hooks: tools/genhooks.py tools/hookslib.py
|
|
||||||
python tools/genhooks.py
|
|
||||||
python -m black -t py36 anki/hooks.py
|
|
||||||
@touch $@
|
|
||||||
|
|
||||||
BUILD_STEPS := .build/vernum .build/run-deps .build/dev-deps anki/buildinfo.py .build/py-proto .build/hooks
|
|
||||||
|
|
||||||
# Checking
|
|
||||||
######################
|
|
||||||
|
|
||||||
.PHONY: check
|
|
||||||
check: $(BUILD_STEPS) .build/mypy .build/test .build/fmt .build/imports .build/lint
|
|
||||||
|
|
||||||
.PHONY: fix
|
|
||||||
fix: $(BUILD_STEPS)
|
|
||||||
isort $(ISORTARGS)
|
|
||||||
python -m black $(BLACKARGS)
|
|
||||||
|
|
||||||
.PHONY: clean
|
|
||||||
clean:
|
|
||||||
rm -rf .build anki.egg-info build dist
|
|
||||||
|
|
||||||
# Checking python
|
|
||||||
######################
|
|
||||||
|
|
||||||
CHECKDEPS := $(shell "${FIND}" anki tests -name '*.py' | grep -v buildinfo.py)
|
|
||||||
|
|
||||||
.build/mypy: $(CHECKDEPS)
|
|
||||||
python -m mypy ${MYPY_ARGS} anki
|
|
||||||
@touch $@
|
|
||||||
|
|
||||||
.build/test: $(CHECKDEPS)
|
|
||||||
SHIFT_CLOCK_HACK=1 python -m pytest --durations=1 -s
|
|
||||||
@touch $@
|
|
||||||
|
|
||||||
.build/lint: $(CHECKDEPS)
|
|
||||||
python -m pylint -j 0 --rcfile=.pylintrc -f colorized \
|
|
||||||
--extension-pkg-whitelist=ankirspy anki tests setup.py
|
|
||||||
@touch $@
|
|
||||||
|
|
||||||
.build/imports: $(CHECKDEPS)
|
|
||||||
isort $(ISORTARGS) --check
|
|
||||||
@touch $@
|
|
||||||
|
|
||||||
.build/fmt: $(CHECKDEPS)
|
|
||||||
python -m black --check $(BLACKARGS)
|
|
||||||
@touch $@
|
|
||||||
|
|
||||||
# Building
|
|
||||||
######################
|
|
||||||
|
|
||||||
.PHONY: build
|
|
||||||
build: .build/build
|
|
||||||
|
|
||||||
.build/build: $(BUILD_STEPS) $(CHECKDEPS)
|
|
||||||
rm -rf dist build
|
|
||||||
python setup.py -q bdist_wheel
|
|
||||||
rsync -a dist/*.whl ../dist/
|
|
||||||
touch $@
|
|
||||||
|
|
||||||
# prepare code for running in place
|
|
||||||
.PHONY: develop
|
|
||||||
develop: $(BUILD_STEPS)
|
|
||||||
|
|
||||||
anki/buildinfo.py: ../meta/version ../meta/buildhash
|
|
||||||
echo "buildhash='$$(cat ../meta/buildhash)'" > $@
|
|
||||||
echo "version='$$(cat ../meta/version)'" >> $@
|
|
||||||
|
|
||||||
VER := $(shell cat ../meta/version)
|
|
||||||
.build/vernum: ../meta/version
|
|
||||||
sed -i.bak 's/.*automatically updated 1.*/ install_requires.append("ankirspy==$(VER)") # automatically updated 1/' setup.py
|
|
||||||
sed -i.bak 's/.*automatically updated 2.*/ version="$(VER)", # automatically updated 2/' setup.py
|
|
||||||
rm setup.py.bak
|
|
||||||
@touch $@
|
|
157
qt/Makefile
157
qt/Makefile
|
@ -1,157 +0,0 @@
|
||||||
SHELL := /bin/bash
|
|
||||||
|
|
||||||
ifndef SHELLFLAGS
|
|
||||||
SHELLFLAGS :=
|
|
||||||
endif
|
|
||||||
|
|
||||||
.SHELLFLAGS := -eu -o pipefail ${SHELLFLAGS} -c
|
|
||||||
MAKEFLAGS += --warn-undefined-variables
|
|
||||||
MAKEFLAGS += --no-builtin-rules
|
|
||||||
|
|
||||||
FIND := $(if $(wildcard /bin/find),/bin/find,/usr/bin/find)
|
|
||||||
MYPY_ARGS :=
|
|
||||||
PYLINT_ARGS :=
|
|
||||||
|
|
||||||
ifndef OS
|
|
||||||
OS := unknown
|
|
||||||
endif
|
|
||||||
|
|
||||||
# https://anki.tenderapp.com/discussions/beta-testing/1860-error-unused-type-ignore-comment
|
|
||||||
ifneq (${OS},Windows_NT)
|
|
||||||
MYPY_ARGS := --warn-unused-ignores
|
|
||||||
else
|
|
||||||
PYLINT_ARGS := --ignored-modules=win32file,pywintypes,socket,win32pipe
|
|
||||||
endif
|
|
||||||
|
|
||||||
.DELETE_ON_ERROR:
|
|
||||||
.SUFFIXES:
|
|
||||||
|
|
||||||
BLACKARGS := -t py36 aqt tests setup.py tools/*.py --exclude='aqt/forms|buildinfo|colors'
|
|
||||||
ISORTARGS := --profile black aqt tests setup.py
|
|
||||||
|
|
||||||
$(shell mkdir -p .build ../dist)
|
|
||||||
|
|
||||||
PHONY: all
|
|
||||||
all: check
|
|
||||||
|
|
||||||
.build/run-deps: setup.py
|
|
||||||
python -m pip install -e .
|
|
||||||
@touch $@
|
|
||||||
|
|
||||||
.build/dev-deps: requirements.dev
|
|
||||||
python -m pip install -r requirements.dev
|
|
||||||
@touch $@
|
|
||||||
|
|
||||||
.build/ui: $(shell "${FIND}" designer -type f)
|
|
||||||
./tools/build_ui.sh
|
|
||||||
@touch $@
|
|
||||||
|
|
||||||
.build/i18n: $(wildcard po/repo/desktop/*/anki.po)
|
|
||||||
(cd po && \
|
|
||||||
./scripts/build-mo-files && \
|
|
||||||
./scripts/copy-qt-files)
|
|
||||||
@touch $@
|
|
||||||
|
|
||||||
TSDEPS := $(wildcard ts/src/*.ts) $(wildcard ts/scss/*.scss) $(wildcard ../ts/src/scss/*)
|
|
||||||
|
|
||||||
.build/js: $(TSDEPS)
|
|
||||||
(cd ts && make build)
|
|
||||||
python ./tools/extract_scss_colors.py
|
|
||||||
@touch $@
|
|
||||||
|
|
||||||
.build/hooks: tools/genhooks_gui.py ../pylib/tools/hookslib.py
|
|
||||||
python tools/genhooks_gui.py
|
|
||||||
python -m black aqt/gui_hooks.py
|
|
||||||
@touch $@
|
|
||||||
|
|
||||||
BUILD_STEPS := .build/vernum .build/run-deps .build/dev-deps .build/js .build/ui aqt/buildinfo.py .build/hooks .build/i18n
|
|
||||||
|
|
||||||
# Checking
|
|
||||||
######################
|
|
||||||
|
|
||||||
.PHONY: check
|
|
||||||
check: .build/pyaudio $(BUILD_STEPS) .build/mypy .build/test .build/fmt .build/imports .build/lint .build/ts-fmt
|
|
||||||
|
|
||||||
# https://github.com/ankitects/anki/pull/611 - Automatically install pyaudio when running make check
|
|
||||||
.build/pyaudio:
|
|
||||||
python -m pip install pyaudio
|
|
||||||
@touch $@
|
|
||||||
|
|
||||||
.PHONY: fix
|
|
||||||
fix: $(BUILD_STEPS)
|
|
||||||
isort $(ISORTARGS)
|
|
||||||
python -m black $(BLACKARGS)
|
|
||||||
(cd ts && make fix)
|
|
||||||
|
|
||||||
.PHONY: clean
|
|
||||||
clean:
|
|
||||||
rm -rf .build aqt.egg-info build dist
|
|
||||||
|
|
||||||
# Checking Typescript
|
|
||||||
######################
|
|
||||||
|
|
||||||
JSDEPS := $(patsubst ts/src/%.ts, web/%.js, $(TSDEPS))
|
|
||||||
|
|
||||||
.build/ts-fmt: $(TSDEPS)
|
|
||||||
(cd ts && make check)
|
|
||||||
@touch $@
|
|
||||||
|
|
||||||
# Checking python
|
|
||||||
######################
|
|
||||||
|
|
||||||
PYLIB := ../pylib
|
|
||||||
|
|
||||||
CHECKDEPS := $(shell "${FIND}" aqt tests -name '*.py' | grep -v buildinfo.py)
|
|
||||||
|
|
||||||
.build/mypy: $(CHECKDEPS) .build/qt-stubs
|
|
||||||
python -m mypy ${MYPY_ARGS} aqt
|
|
||||||
@touch $@
|
|
||||||
|
|
||||||
.build/test: $(CHECKDEPS)
|
|
||||||
python -m pytest -s
|
|
||||||
@touch $@
|
|
||||||
|
|
||||||
.build/lint: $(CHECKDEPS)
|
|
||||||
python -m pylint -j 0 --rcfile=.pylintrc -f colorized ${PYLINT_ARGS} \
|
|
||||||
--extension-pkg-whitelist=PyQt5,ankirspy aqt tests setup.py
|
|
||||||
@touch $@
|
|
||||||
|
|
||||||
.build/imports: $(CHECKDEPS)
|
|
||||||
isort $(ISORTARGS) --check
|
|
||||||
@touch $@
|
|
||||||
|
|
||||||
.build/fmt: $(CHECKDEPS)
|
|
||||||
python -m black --check $(BLACKARGS)
|
|
||||||
@touch $@
|
|
||||||
|
|
||||||
.build/qt-stubs:
|
|
||||||
./tools/typecheck-setup.sh
|
|
||||||
@touch $@
|
|
||||||
|
|
||||||
# Building
|
|
||||||
######################
|
|
||||||
|
|
||||||
.PHONY: build
|
|
||||||
build: .build/build
|
|
||||||
|
|
||||||
.build/build: $(BUILD_STEPS) $(CHECKDEPS) $(wildcard ../ts/dist/*)
|
|
||||||
rm -rf dist build
|
|
||||||
rsync -a ../ts/dist/ aqt_data/web/
|
|
||||||
python setup.py -q bdist_wheel
|
|
||||||
rsync -a dist/*.whl ../dist/
|
|
||||||
touch $@
|
|
||||||
|
|
||||||
.PHONY: develop
|
|
||||||
develop: $(BUILD_STEPS) $(wildcard ../ts/dist/*)
|
|
||||||
rsync -a ../ts/dist/ aqt_data/web/
|
|
||||||
|
|
||||||
aqt/buildinfo.py: ../meta/version ../meta/buildhash
|
|
||||||
echo "buildhash='$$(cat ../meta/buildhash)'" > $@
|
|
||||||
echo "version='$$(cat ../meta/version)'" >> $@
|
|
||||||
|
|
||||||
VER := $(shell cat ../meta/version)
|
|
||||||
.build/vernum: ../meta/version
|
|
||||||
sed -i.bak 's/.*automatically updated 1.*/ "anki==$(VER)", # automatically updated 1/' setup.py
|
|
||||||
sed -i.bak 's/.*automatically updated 2.*/ version="$(VER)", # automatically updated 2/' setup.py
|
|
||||||
rm setup.py.bak
|
|
||||||
@touch $@
|
|
|
@ -1,54 +0,0 @@
|
||||||
SHELL := /bin/bash
|
|
||||||
|
|
||||||
ifndef SHELLFLAGS
|
|
||||||
SHELLFLAGS :=
|
|
||||||
endif
|
|
||||||
|
|
||||||
.SHELLFLAGS := -eu -o pipefail ${SHELLFLAGS} -c
|
|
||||||
MAKEFLAGS += --warn-undefined-variables
|
|
||||||
MAKEFLAGS += --no-builtin-rules
|
|
||||||
|
|
||||||
FIND := $(if $(wildcard /bin/find),/bin/find,/usr/bin/find)
|
|
||||||
.DELETE_ON_ERROR:
|
|
||||||
|
|
||||||
$(shell mkdir -p .build)
|
|
||||||
|
|
||||||
.PHONY: all check fix clean develop
|
|
||||||
|
|
||||||
all: check
|
|
||||||
|
|
||||||
check: .build/vernum .build/check
|
|
||||||
|
|
||||||
fix:
|
|
||||||
cargo fmt
|
|
||||||
|
|
||||||
clean:
|
|
||||||
rm -rf .build target
|
|
||||||
|
|
||||||
develop: .build/vernum ftl/repo
|
|
||||||
|
|
||||||
ftl/repo:
|
|
||||||
(cd ftl && ./scripts/fetch-latest-translations)
|
|
||||||
|
|
||||||
ALL_SOURCE := $(shell "${FIND}" src -type f | egrep -v "i18n/autogen|i18n/ftl|_proto.rs") $(wildcard ftl/*.ftl)
|
|
||||||
|
|
||||||
# nightly currently required for ignoring files in rustfmt.toml
|
|
||||||
RUST_TOOLCHAIN := $(shell cat rust-toolchain)
|
|
||||||
|
|
||||||
.build/rs-tools: rust-toolchain
|
|
||||||
rustup toolchain install $(RUST_TOOLCHAIN)
|
|
||||||
rustup component add rustfmt-preview --toolchain $(RUST_TOOLCHAIN)
|
|
||||||
rustup component add clippy-preview --toolchain $(RUST_TOOLCHAIN)
|
|
||||||
@touch $@
|
|
||||||
|
|
||||||
.build/check: ftl/repo .build/rs-tools $(ALL_SOURCE)
|
|
||||||
cargo test --lib -- --nocapture
|
|
||||||
cargo fmt -- --check
|
|
||||||
cargo clippy -- -D warnings
|
|
||||||
@touch $@
|
|
||||||
|
|
||||||
VER := $(shell cat ../meta/version)
|
|
||||||
.build/vernum: ../meta/version
|
|
||||||
sed -i.bak 's/.*automatically updated.*/version = "$(VER)" # automatically updated/' Cargo.toml
|
|
||||||
rm Cargo.toml.bak
|
|
||||||
@touch $@
|
|
112
rspy/Makefile
112
rspy/Makefile
|
@ -1,112 +0,0 @@
|
||||||
SHELL := /bin/bash
|
|
||||||
|
|
||||||
ifndef SHELLFLAGS
|
|
||||||
SHELLFLAGS :=
|
|
||||||
endif
|
|
||||||
|
|
||||||
.SHELLFLAGS := -eu -o pipefail ${SHELLFLAGS} -c
|
|
||||||
MAKEFLAGS += --warn-undefined-variables
|
|
||||||
MAKEFLAGS += --no-builtin-rules
|
|
||||||
|
|
||||||
FIND := $(if $(wildcard /bin/find),/bin/find,/usr/bin/find)
|
|
||||||
|
|
||||||
ifndef OS
|
|
||||||
OS := unknown
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifeq (${OS},Windows_NT)
|
|
||||||
ifndef PYTHON_FILE
|
|
||||||
PYTHON_FILE := $(shell which python)
|
|
||||||
USE_CYGPATH_COMMAND := case "$$(uname -s)" in CYGWIN*|MINGW*|MSYS*) printf "yes";; esac;
|
|
||||||
USE_CYGPATH := $(shell ${USE_CYGPATH_COMMAND})
|
|
||||||
|
|
||||||
ifneq (,${USE_CYGPATH})
|
|
||||||
PYTHON_FILE := $(shell cygpath -w "${PYTHON_FILE}")
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
else
|
|
||||||
ifndef PYTHON_FILE
|
|
||||||
PYTHON_FILE := $(shell which python3)
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
.DELETE_ON_ERROR:
|
|
||||||
$(shell mkdir -p .build ../dist)
|
|
||||||
|
|
||||||
OUTDIR := ../dist
|
|
||||||
BUILDFLAGS := --release --strip
|
|
||||||
DEVFLAGS :=
|
|
||||||
RSPY_TARGET_DIR ?= target
|
|
||||||
|
|
||||||
QT_FTL_TEMPLATES := ../qt/ftl
|
|
||||||
QT_FTL_LOCALES := ../qt/ftl/repo/desktop
|
|
||||||
|
|
||||||
BUILD_VARIABLES = FTL_TEMPLATE_DIRS="$(QT_FTL_TEMPLATES)" \
|
|
||||||
FTL_LOCALE_DIRS="$(QT_FTL_LOCALES)" \
|
|
||||||
CARGO_TARGET_DIR="$(RSPY_TARGET_DIR)" \
|
|
||||||
MACOSX_DEPLOYMENT_TARGET=10.7
|
|
||||||
|
|
||||||
.PHONY: all develop build check fix clean
|
|
||||||
|
|
||||||
all: develop
|
|
||||||
|
|
||||||
develop: .build/develop
|
|
||||||
|
|
||||||
DEPS := .build/tools .build/vernum ../meta/buildhash \
|
|
||||||
$(wildcard $(QT_FTL_TEMPLATES)/*.ftl) \
|
|
||||||
$(wildcard $(QT_FTL_LOCALES)/*/*.ftl) \
|
|
||||||
$(shell "${FIND}" ../rslib/src -name '*.rs' -or -name '*.sql') $(wildcard ../proto/*) \
|
|
||||||
$(shell "${FIND}" ../rslib/ftl -type f) \
|
|
||||||
$(shell "${FIND}" ./src -type f)
|
|
||||||
|
|
||||||
.build/develop: $(DEPS)
|
|
||||||
touch ../proto/backend.proto
|
|
||||||
${BUILD_VARIABLES} \
|
|
||||||
maturin develop $(DEVFLAGS)
|
|
||||||
touch $@
|
|
||||||
|
|
||||||
build: .build/build
|
|
||||||
|
|
||||||
.build/build: $(DEPS)
|
|
||||||
touch ../proto/backend.proto
|
|
||||||
${BUILD_VARIABLES} \
|
|
||||||
maturin build -i "${PYTHON_FILE}" -o "$(OUTDIR)" $(BUILDFLAGS)
|
|
||||||
touch $@
|
|
||||||
|
|
||||||
check: .build/check
|
|
||||||
|
|
||||||
clippy: .build/clippy
|
|
||||||
|
|
||||||
fix:
|
|
||||||
cargo fmt
|
|
||||||
|
|
||||||
clean:
|
|
||||||
rm -rf .build target
|
|
||||||
|
|
||||||
# nightly currently required for ignoring files in rustfmt.toml
|
|
||||||
RUST_TOOLCHAIN := $(shell cat rust-toolchain)
|
|
||||||
|
|
||||||
.build/tools: requirements.txt rust-toolchain
|
|
||||||
python -m pip install -r requirements.txt
|
|
||||||
rustup toolchain install $(RUST_TOOLCHAIN)
|
|
||||||
rustup component add rustfmt-preview --toolchain $(RUST_TOOLCHAIN)
|
|
||||||
rustup component add clippy-preview --toolchain $(RUST_TOOLCHAIN)
|
|
||||||
@touch $@
|
|
||||||
|
|
||||||
# we should not call clippy because it break things when running make check Mac OS
|
|
||||||
# https://github.com/ankitects/anki/pull/597
|
|
||||||
.build/check: .build/develop
|
|
||||||
cargo fmt -- --check
|
|
||||||
@touch $@
|
|
||||||
|
|
||||||
# cargo clippy also run build.rs, thus it must be called using the BUILD_VARIABLES
|
|
||||||
.build/clippy: $(DEPS)
|
|
||||||
${BUILD_VARIABLES} \
|
|
||||||
cargo clippy -- -D warnings
|
|
||||||
@touch $@
|
|
||||||
|
|
||||||
VER := $(shell cat ../meta/version)
|
|
||||||
.build/vernum: ../meta/version
|
|
||||||
sed -i.bak 's/.*automatically updated.*/version = "$(VER)" # automatically updated/' Cargo.toml
|
|
||||||
rm Cargo.toml.bak
|
|
||||||
@touch $@
|
|
59
ts/Makefile
59
ts/Makefile
|
@ -1,59 +0,0 @@
|
||||||
SHELL := /bin/bash
|
|
||||||
|
|
||||||
ifndef SHELLFLAGS
|
|
||||||
SHELLFLAGS :=
|
|
||||||
endif
|
|
||||||
|
|
||||||
.SHELLFLAGS := -eu -o pipefail ${SHELLFLAGS} -c
|
|
||||||
MAKEFLAGS += --warn-undefined-variables
|
|
||||||
MAKEFLAGS += --no-builtin-rules
|
|
||||||
|
|
||||||
ifndef OS
|
|
||||||
OS := unknown
|
|
||||||
endif
|
|
||||||
|
|
||||||
.DELETE_ON_ERROR:
|
|
||||||
.SUFFIXES:
|
|
||||||
|
|
||||||
$(shell mkdir -p .build)
|
|
||||||
|
|
||||||
PHONY: all
|
|
||||||
all: check
|
|
||||||
|
|
||||||
PROTODEPS := ../proto/backend.proto ../proto/fluent.proto
|
|
||||||
BUILDDEPS := .build/npm webpack.config.js
|
|
||||||
|
|
||||||
.build/proto: $(BUILDDEPS) $(PROTODEPS)
|
|
||||||
npx pbjs -t json-module -w es6 ../proto/backend.proto -o src/backend/proto.js
|
|
||||||
npx pbjs -t static-module ../proto/backend.proto | npx pbts -o src/backend/proto.d.ts -
|
|
||||||
@touch $@
|
|
||||||
|
|
||||||
PHONY: dev
|
|
||||||
dev: .build/proto
|
|
||||||
npm run dev
|
|
||||||
|
|
||||||
PHONY: build
|
|
||||||
build: .build/build
|
|
||||||
|
|
||||||
PHONY: develop
|
|
||||||
develop: .build/build
|
|
||||||
|
|
||||||
.build/build: .build/proto $(BUILDDEPS) $(wildcard src/*/*.svelte src/*/*.ts src/*/*.scss)
|
|
||||||
npm run build
|
|
||||||
@touch $@
|
|
||||||
|
|
||||||
.build/npm: package.json
|
|
||||||
npm i
|
|
||||||
touch $@
|
|
||||||
|
|
||||||
.PHONY: check
|
|
||||||
check: .build/proto
|
|
||||||
npm run check
|
|
||||||
|
|
||||||
.PHONY: fix
|
|
||||||
fix: .build/build
|
|
||||||
npm run fix
|
|
||||||
|
|
||||||
.PHONY: clean
|
|
||||||
clean:
|
|
||||||
rm -rf .build node_modules src/backend/*
|
|
Loading…
Reference in a new issue