mirror of
https://github.com/ankitects/anki.git
synced 2025-09-24 16:56:36 -04:00
Renamed FIND_EXEC to FIND, replaced IS_WINDOWS by specific commands
as PYTHON_BIN, ACTIVE_SCRIPT and INSTALL_PYAUDIO. Fixed echo statements not using @ to suppress double message output. Deprecated the usage of ECHOCMD := /bin/echo -e because it has no effect: https://stackoverflow.com/questions/60387684/how-to-make-the-makefile-echos-to-use-bin-echo-e # Conflicts: # Makefile
This commit is contained in:
parent
0f87955a29
commit
26cdff29ec
7 changed files with 36 additions and 38 deletions
39
Makefile
39
Makefile
|
@ -1,10 +1,11 @@
|
|||
SHELL := /bin/bash
|
||||
ECHOCMD := /bin/echo -e
|
||||
|
||||
ifeq ($(OS),Windows_NT)
|
||||
IS_WINDOWS := true
|
||||
PYTHON_BIN := python
|
||||
ACTIVATE_SCRIPT := pyenv/Scripts/activate
|
||||
else
|
||||
IS_WINDOWS :=
|
||||
PYTHON_BIN := python3
|
||||
ACTIVATE_SCRIPT := pyenv/bin/activate
|
||||
endif
|
||||
|
||||
.SHELLFLAGS := -eu -o pipefail -c
|
||||
|
@ -26,8 +27,8 @@ all: run
|
|||
# - modern pip required for wheel
|
||||
# - add qt if missing
|
||||
pyenv:
|
||||
python$(if ${IS_WINDOWS},,3) -m venv pyenv && \
|
||||
. pyenv/$(if ${IS_WINDOWS},Scripts,bin)/activate && \
|
||||
"${PYTHON_BIN}" -m venv pyenv && \
|
||||
. "${ACTIVATE_SCRIPT}" && \
|
||||
python --version && \
|
||||
python -m pip install --upgrade pip setuptools && \
|
||||
python -c 'import PyQt5' 2>/dev/null || python -m pip install -r qt/requirements.qt
|
||||
|
@ -43,37 +44,37 @@ buildhash:
|
|||
|
||||
.PHONY: develop
|
||||
develop: pyenv buildhash
|
||||
set -e && \
|
||||
. pyenv/$(if ${IS_WINDOWS},Scripts,bin)/activate && \
|
||||
set -eo pipefail && \
|
||||
. "${ACTIVATE_SCRIPT}" && \
|
||||
for dir in $(DEVEL); do \
|
||||
$(SUBMAKE) -C $$dir develop BUILDFLAGS="$(BUILDFLAGS)"; \
|
||||
done
|
||||
|
||||
.PHONY: run
|
||||
run: develop
|
||||
set -e && \
|
||||
. pyenv/$(if ${IS_WINDOWS},Scripts,bin)/activate && \
|
||||
set -eo pipefail && \
|
||||
. "${ACTIVATE_SCRIPT}" && \
|
||||
echo "Starting Anki..."; \
|
||||
python qt/runanki $(RUNFLAGS)
|
||||
|
||||
.PHONY: build
|
||||
build: clean-dist build-rspy build-pylib build-qt add-buildhash
|
||||
echo
|
||||
echo "Build complete."
|
||||
@echo
|
||||
@echo "Build complete."
|
||||
|
||||
.PHONY: build-rspy
|
||||
build-rspy: pyenv buildhash
|
||||
. pyenv/$(if ${IS_WINDOWS},Scripts,bin)/activate && \
|
||||
. "${ACTIVATE_SCRIPT}" && \
|
||||
$(SUBMAKE) -C rspy build BUILDFLAGS="$(BUILDFLAGS)"
|
||||
|
||||
.PHONY: build-pylib
|
||||
build-pylib:
|
||||
. pyenv/$(if ${IS_WINDOWS},Scripts,bin)/activate && \
|
||||
. "${ACTIVATE_SCRIPT}" && \
|
||||
$(SUBMAKE) -C pylib build
|
||||
|
||||
.PHONY: build-qt
|
||||
build-qt:
|
||||
. pyenv/$(if ${IS_WINDOWS},Scripts,bin)/activate && \
|
||||
. "${ACTIVATE_SCRIPT}" && \
|
||||
$(SUBMAKE) -C qt build
|
||||
|
||||
.PHONY: clean
|
||||
|
@ -93,19 +94,19 @@ check: pyenv buildhash
|
|||
for dir in $(CHECKABLE_RS); do \
|
||||
$(SUBMAKE) -C $$dir check; \
|
||||
done; \
|
||||
. pyenv/$(if ${IS_WINDOWS},Scripts,bin)/activate && \
|
||||
. "${ACTIVATE_SCRIPT}" && \
|
||||
$(SUBMAKE) -C rspy develop && \
|
||||
$(SUBMAKE) -C pylib develop && \
|
||||
for dir in $(CHECKABLE_PY); do \
|
||||
$(SUBMAKE) -C $$dir check; \
|
||||
done;
|
||||
echo
|
||||
echo "All checks passed!"
|
||||
@echo
|
||||
@echo "All checks passed!"
|
||||
|
||||
.PHONY: fix
|
||||
fix:
|
||||
set -e && \
|
||||
. pyenv/$(if ${IS_WINDOWS},Scripts,bin)/activate && \
|
||||
set -eo pipefail && \
|
||||
. "${ACTIVATE_SCRIPT}" && \
|
||||
for dir in $(CHECKABLE_RS) $(CHECKABLE_PY); do \
|
||||
$(SUBMAKE) -C $$dir fix; \
|
||||
done; \
|
||||
|
|
|
@ -82,9 +82,11 @@ Windows users (using Visual Studio)
|
|||
|
||||
1. Download and install Cygwin and put its `/bin/` directory on your system path.
|
||||
1. Install the Cygwin Packages: `apt-cyg install rsync make`
|
||||
1. If the Cygwin `/usr/bin/` directory exists, move all files from `/usr/bin/` to `/bin/`.
|
||||
1. Download `gettext` 0.20.1 or superior and put its `bin` directory on your system path.
|
||||
1. https://mlocati.github.io/articles/gettext-iconv-windows.html
|
||||
1. If the Cygwin `/usr/bin/` directory exists, move all files from `/usr/bin/` to `/bin/`.
|
||||
The problem with the `/usr/bin/` is that it should not exists. Cygwin should map/mount `/bin/`
|
||||
into `/usr/bin/`, i.e., they should be the same directory.
|
||||
1. Download and install Python for Windows (not from Cygwin) and put `python.exe` (not `python3.exe`) on your system path.
|
||||
1. Download and install pip for your Windows Python.
|
||||
1. Download and install rust (compiler), npm, git and put them your system path.
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
SHELL := /bin/bash
|
||||
ECHOCMD := /bin/echo -e
|
||||
FIND_EXEC := $(if $(wildcard /bin/find),,/usr)/bin/find
|
||||
FIND := $(if $(wildcard /bin/find),/bin/find,/usr/bin/find)
|
||||
|
||||
.SHELLFLAGS := -eu -o pipefail -c
|
||||
.DELETE_ON_ERROR:
|
||||
|
@ -57,7 +56,7 @@ clean:
|
|||
# Checking python
|
||||
######################
|
||||
|
||||
CHECKDEPS := $(shell ${FIND_EXEC} anki tests -name '*.py' | grep -v buildinfo.py)
|
||||
CHECKDEPS := $(shell ${FIND} anki tests -name '*.py' | grep -v buildinfo.py)
|
||||
|
||||
.build/mypy: $(CHECKDEPS)
|
||||
mypy anki
|
||||
|
|
13
qt/Makefile
13
qt/Makefile
|
@ -1,11 +1,10 @@
|
|||
SHELL := /bin/bash
|
||||
ECHOCMD := /bin/echo -e
|
||||
FIND_EXEC := $(if $(wildcard /bin/find),,/usr)/bin/find
|
||||
FIND := $(if $(wildcard /bin/find),/bin/find,/usr/bin/find)
|
||||
|
||||
ifeq ($(OS),Windows_NT)
|
||||
IS_WINDOWS := true
|
||||
INSTALL_PYAUDIO := python -m pip install git+https://github.com/evandroforks/pyaudio
|
||||
else
|
||||
IS_WINDOWS :=
|
||||
INSTALL_PYAUDIO := @echo Skipping pyaudio for Windows...
|
||||
endif
|
||||
|
||||
.SHELLFLAGS := -eu -o pipefail -c
|
||||
|
@ -23,7 +22,7 @@ PHONY: all
|
|||
all: check
|
||||
|
||||
.build/run-deps: setup.py
|
||||
$(if ${IS_WINDOWS},python -m pip install git+https://github.com/evandroforks/pyaudio,)
|
||||
${INSTALL_PYAUDIO}
|
||||
python -m pip install -e .
|
||||
@touch $@
|
||||
|
||||
|
@ -31,7 +30,7 @@ all: check
|
|||
python -m pip install -r requirements.dev
|
||||
@touch $@
|
||||
|
||||
.build/ui: $(shell ${FIND_EXEC} designer -type f)
|
||||
.build/ui: $(shell ${FIND} designer -type f)
|
||||
./tools/build_ui.sh
|
||||
@touch $@
|
||||
|
||||
|
@ -83,7 +82,7 @@ JSDEPS := $(patsubst ts/src/%.ts, web/%.js, $(TSDEPS))
|
|||
|
||||
PYLIB := ../pylib
|
||||
|
||||
CHECKDEPS := $(shell ${FIND_EXEC} aqt tests -name '*.py' | grep -v buildinfo.py)
|
||||
CHECKDEPS := $(shell ${FIND} aqt tests -name '*.py' | grep -v buildinfo.py)
|
||||
|
||||
.build/mypy: $(CHECKDEPS) .build/qt-stubs
|
||||
mypy aqt
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
SHELL := /bin/bash
|
||||
ECHOCMD := /bin/echo -e
|
||||
|
||||
.SHELLFLAGS := -eu -o pipefail -c
|
||||
.DELETE_ON_ERROR:
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
SHELL := /bin/bash
|
||||
ECHOCMD := /bin/echo -e
|
||||
FIND_EXEC := $(if $(wildcard /bin/find),,/usr)/bin/find
|
||||
FIND := $(if $(wildcard /bin/find),/bin/find,/usr/bin/find)
|
||||
|
||||
.SHELLFLAGS := -eu -o pipefail -c
|
||||
.DELETE_ON_ERROR:
|
||||
|
@ -26,7 +25,7 @@ develop: .build/vernum ftl/repo
|
|||
ftl/repo:
|
||||
(cd ftl && ./scripts/fetch-latest-translations)
|
||||
|
||||
ALL_SOURCE := $(shell ${FIND_EXEC} src -type f) $(wildcard ftl/*.ftl)
|
||||
ALL_SOURCE := $(shell ${FIND} src -type f) $(wildcard ftl/*.ftl)
|
||||
|
||||
# nightly currently required for ignoring files in rustfmt.toml
|
||||
RUST_TOOLCHAIN := $(shell cat rust-toolchain)
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
SHELL := /bin/bash
|
||||
ECHOCMD := /bin/echo -e
|
||||
FIND_EXEC := $(if $(wildcard /bin/find),,/usr)/bin/find
|
||||
FIND := $(if $(wildcard /bin/find),/bin/find,/usr/bin/find)
|
||||
|
||||
.SHELLFLAGS := -eu -o pipefail -c
|
||||
.DELETE_ON_ERROR:
|
||||
|
@ -22,8 +21,8 @@ all: develop
|
|||
develop: .build/develop
|
||||
|
||||
DEPS := .build/tools .build/vernum ../meta/buildhash $(wildcard $(QT_FTLS)/*.ftl) \
|
||||
$(shell ${FIND_EXEC} ../rslib/src -name '*.rs') $(wildcard ../proto/*) \
|
||||
$(shell ${FIND_EXEC} ../rslib/ftl -type f)
|
||||
$(shell ${FIND} ../rslib/src -name '*.rs') $(wildcard ../proto/*) \
|
||||
$(shell ${FIND} ../rslib/ftl -type f)
|
||||
|
||||
.build/develop: $(DEPS)
|
||||
touch ../proto/backend.proto
|
||||
|
|
Loading…
Reference in a new issue