mirror of
https://github.com/ankitects/anki.git
synced 2025-09-18 22:12:21 -04:00
move top level scripts into makefile
This commit is contained in:
parent
5126a1e28a
commit
1c1fbde733
9 changed files with 71 additions and 67 deletions
4
.github/workflows/checks.yml
vendored
4
.github/workflows/checks.yml
vendored
|
@ -21,6 +21,4 @@ jobs:
|
||||||
run: |
|
run: |
|
||||||
# add requirements
|
# add requirements
|
||||||
sudo apt install portaudio19-dev gettext rename
|
sudo apt install portaudio19-dev gettext rename
|
||||||
export UNOPT=1
|
make check build BUILDFLAGS=""
|
||||||
./check
|
|
||||||
./build
|
|
||||||
|
|
69
Makefile
Normal file
69
Makefile
Normal file
|
@ -0,0 +1,69 @@
|
||||||
|
SHELL := bash
|
||||||
|
.SHELLFLAGS := -eu -o pipefail -c
|
||||||
|
.DELETE_ON_ERROR:
|
||||||
|
MAKEFLAGS += --warn-undefined-variables
|
||||||
|
MAKEFLAGS += --no-builtin-rules
|
||||||
|
SUBMAKE := $(MAKE) --print-directory
|
||||||
|
.SUFFIXES:
|
||||||
|
|
||||||
|
BUILDFLAGS := --release --strip
|
||||||
|
RUNFLAGS :=
|
||||||
|
CHECKABLE := rslib pylib qt
|
||||||
|
DEVEL := rspy pylib qt
|
||||||
|
|
||||||
|
# - modern pip required for wheel
|
||||||
|
# - add qt if missing
|
||||||
|
pyenv:
|
||||||
|
python3 -m venv pyenv && \
|
||||||
|
. pyenv/bin/activate && \
|
||||||
|
pip install --upgrade pip setuptools && \
|
||||||
|
python -c 'import PyQt5' 2>/dev/null || pip install -r qt/requirements.qt
|
||||||
|
|
||||||
|
# update build hash
|
||||||
|
meta/buildhash:
|
||||||
|
oldhash=$$(test -f meta/buildhash && cat meta/buildhash || true); \
|
||||||
|
newhash=$$(git rev-parse --short HEAD); \
|
||||||
|
if [ "$$oldhash" != "$$newhash" ]; then \
|
||||||
|
echo $$newhash > meta/buildhash; \
|
||||||
|
fi
|
||||||
|
|
||||||
|
.PHONY: run
|
||||||
|
run: pyenv meta/buildhash
|
||||||
|
@. pyenv/bin/activate && \
|
||||||
|
for dir in $(DEVEL); do \
|
||||||
|
$(SUBMAKE) -C $$dir develop BUILDFLAGS="$(BUILDFLAGS)"; \
|
||||||
|
done; \
|
||||||
|
echo "Starting Anki..."; \
|
||||||
|
qt/runanki $(RUNFLAGS)
|
||||||
|
|
||||||
|
.PHONY: build
|
||||||
|
build: pyenv meta/buildhash
|
||||||
|
@. pyenv/bin/activate && \
|
||||||
|
for dir in $(DEVEL); do \
|
||||||
|
$(SUBMAKE) -C $$dir build BUILDFLAGS="$(BUILDFLAGS)"; \
|
||||||
|
done; \
|
||||||
|
helpers/rename-with-buildhash
|
||||||
|
@echo
|
||||||
|
@echo "Build complete."
|
||||||
|
|
||||||
|
.PHONY: clean
|
||||||
|
clean:
|
||||||
|
rm -rf dist
|
||||||
|
@for dir in $(DEVEL); do \
|
||||||
|
$(SUBMAKE) -C $$dir clean; \
|
||||||
|
done
|
||||||
|
|
||||||
|
.PHONY: check
|
||||||
|
check: pyenv meta/buildhash
|
||||||
|
@. pyenv/bin/activate && \
|
||||||
|
for dir in $(CHECKABLE); do \
|
||||||
|
$(SUBMAKE) -C $$dir check; \
|
||||||
|
done;
|
||||||
|
@echo
|
||||||
|
@echo "All checks passed!"
|
||||||
|
|
||||||
|
.PHONY: fix
|
||||||
|
fix:
|
||||||
|
for dir in $(CHECKABLE); do \
|
||||||
|
$(SUBMAKE) -C $$dir fix; \
|
||||||
|
done; \
|
14
build
14
build
|
@ -1,14 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
set -e
|
|
||||||
|
|
||||||
. scripts.inc
|
|
||||||
|
|
||||||
rm -rf dist
|
|
||||||
|
|
||||||
for dir in $DEVEL; do
|
|
||||||
echo $dir
|
|
||||||
(cd $dir && make build BUILDFLAGS="$BUILDFLAGS")
|
|
||||||
done
|
|
||||||
|
|
||||||
helpers/rename-with-buildhash
|
|
16
check
16
check
|
@ -1,16 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
set -e
|
|
||||||
|
|
||||||
. scripts.inc
|
|
||||||
|
|
||||||
# install prereqs before checking
|
|
||||||
for dir in $DEVEL; do
|
|
||||||
echo $dir
|
|
||||||
(cd $dir && make develop BUILDFLAGS="$BUILDFLAGS")
|
|
||||||
done
|
|
||||||
|
|
||||||
for dir in $CHECKABLE; do
|
|
||||||
echo $dir
|
|
||||||
(cd $dir && make check)
|
|
||||||
done
|
|
12
clean
12
clean
|
@ -1,12 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
set -e
|
|
||||||
|
|
||||||
. scripts.inc
|
|
||||||
|
|
||||||
rm -rf dist
|
|
||||||
|
|
||||||
for dir in $DEVEL; do
|
|
||||||
echo $dir
|
|
||||||
(cd $dir && make clean)
|
|
||||||
done
|
|
10
fix
10
fix
|
@ -1,10 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
set -e
|
|
||||||
|
|
||||||
. scripts.inc
|
|
||||||
|
|
||||||
for dir in $CHECKABLE; do
|
|
||||||
echo $dir
|
|
||||||
(cd $dir && make fix)
|
|
||||||
done
|
|
|
@ -1,4 +1,3 @@
|
||||||
PREFIX := /usr
|
|
||||||
SHELL := bash
|
SHELL := bash
|
||||||
.SHELLFLAGS := -eu -o pipefail -c
|
.SHELLFLAGS := -eu -o pipefail -c
|
||||||
.DELETE_ON_ERROR:
|
.DELETE_ON_ERROR:
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
PREFIX := /usr
|
|
||||||
SHELL := bash
|
SHELL := bash
|
||||||
.SHELLFLAGS := -eu -o pipefail -c
|
.SHELLFLAGS := -eu -o pipefail -c
|
||||||
.DELETE_ON_ERROR:
|
.DELETE_ON_ERROR:
|
||||||
|
|
11
run
11
run
|
@ -1,12 +1,3 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
set -e
|
make -C $(dirname $0) run RUNFLAGS="$*"
|
||||||
|
|
||||||
. scripts.inc
|
|
||||||
|
|
||||||
for dir in $DEVEL; do
|
|
||||||
echo $dir
|
|
||||||
(cd $dir && make develop BUILDFLAGS="$BUILDFLAGS")
|
|
||||||
done
|
|
||||||
|
|
||||||
qt/runanki "$@"
|
|
||||||
|
|
Loading…
Reference in a new issue