yartsu/Makefile

79 lines
2.3 KiB
Makefile
Raw Permalink Normal View History

2023-01-20 11:24:52 -06:00
VERSION ?= $(shell git describe --tags --always --dirty=-dev | sed 's/^v//g')
SRC_FILES := $(wildcard yartsu/*)
2022-06-14 18:35:47 -05:00
2023-05-14 13:58:06 -05:00
msg = $(if $(tprint),$(call tprint,{a.bold}==> {a.magenta}$(1){a.end}),@echo '==> $(1)')
2022-06-15 13:38:45 -05:00
2023-01-20 11:24:52 -06:00
check: lint typecheck ## apply formatting, linting and typechecking (default)
2023-05-07 23:44:51 -05:00
typecheck: ## perform typechecking
2022-06-14 18:35:47 -05:00
pdm run mypy yartsu
2023-01-20 11:24:52 -06:00
lint: ## format/lint with pre-commit(black,isort,flake8)
2022-06-14 18:35:47 -05:00
pdm run pre-commit run --all
2023-05-14 13:58:06 -05:00
.PHONY: release-assets build
2022-06-16 01:47:31 -05:00
2023-05-07 23:47:58 -05:00
release-assets: build/x86_64-unknown-linux-gnu/release/install/yartsu/yartsu check-version
tar czf build/yartsu-$(VERSION)-x86_64-linux.tar.gz \
build/x86_64-unknown-linux-gnu/release/install/yartsu
2023-01-20 11:24:52 -06:00
release: check-tag release-assets ## create github release and attach gzipped binary
gh release create $(TAG) build/yartsu-$(VERSION)-x86_64-linux.tar.gz -p -d
2022-06-15 13:38:45 -05:00
2023-01-20 11:24:52 -06:00
publish: check-version dist ## publish to pypi with twine
2022-06-15 13:38:45 -05:00
twine upload dist/*
2023-01-20 11:24:52 -06:00
dist: ## build wheel/targz with pdm
2022-06-15 13:38:45 -05:00
pdm build
2023-05-14 13:58:06 -05:00
build-bin: build/x86_64-unknown-linux-gnu/release/install/yartsu/yartsu ## build with pyoxidizer
2022-06-14 18:35:47 -05:00
build/x86_64-unknown-linux-gnu/release/install/yartsu/yartsu: $(SRC_FILES)
2023-05-14 13:58:06 -05:00
$(call msg,Building yartsu w/ pyxoxidizer <==)
2022-06-25 18:34:56 -05:00
@pyoxidizer build --release
2023-01-20 11:24:52 -06:00
install-bin: build/x86_64-unknown-linux-gnu/release/install/yartsu/yartsu ## install pyoxidizer binary
2023-05-14 13:58:06 -05:00
$(call msg,Installing yartsu to ~/bin)
2022-06-25 18:34:56 -05:00
@cp ./build/x86_64-unknown-linux-gnu/release/install/yartsu/yartsu ~/bin
2023-05-14 18:01:50 -05:00
docs: docs/index.md docs/rich-diff.md ## generate docs/svg
2023-05-14 13:58:06 -05:00
@mkdocs build
2023-05-14 14:32:36 -05:00
docs/index.md: README.md
@cp $< $@
2023-01-20 11:24:52 -06:00
docs-theme:
2022-06-25 18:34:56 -05:00
@./scripts/theme-showcase-gen
2022-06-14 18:35:47 -05:00
2023-05-14 18:01:50 -05:00
docs/rich-diff.md:
@./scripts/rich-diff > $@
2023-05-15 13:07:32 -05:00
.PHONY: docs-logos
docs-logos: assets/logo.svg assets/logo-minimal.svg
assets/logo.svg: assets/logo.txt
@lolcat -F .5 -S 9 -f $< | yartsu -o $@
assets/logo-minimal.svg: assets/logo-minimal.txt
@lolcat -F .5 -S 9 -f $< | yartsu -o $@ -w "$(shell wc -L $< | awk '{print $$1}')" -t ' '
assets/help.svg:
@yartsu -o $@ -t "yartsu --help" -- yartsu -h
2022-06-14 18:35:47 -05:00
2023-01-20 11:24:52 -06:00
clean: ## cleanup build and loose files
2022-06-25 18:34:56 -05:00
@rm -rf build dist capture.svg
2023-05-14 15:19:30 -05:00
@rm docs/themes/*.svg -f
2022-06-25 18:34:56 -05:00
# conditionals
check-tag:
@[ "${TAG}" ] || ( echo ">> TAG is not set"; exit 1 )
@git describe HEAD --tags --exact-match
check-version:
@if [[ "${VERSION}" == *"+"* ]]; then \
echo ">> VERSION is dev"; \
echo ">> $(VERSION)"; \
exit 1; \
fi
2023-04-26 17:26:31 -05:00
-include .task.cfg.mk