logo/Makefile

65 lines
1.6 KiB
Makefile
Raw Normal View History

SRC := $(shell find logo/ -type f)
CONDA := source $$(conda info --base)/etc/profile.d/conda.sh; conda activate;
SVGS := $(shell find -type f -wholename "./docs/*.svg")
PNGS := $(patsubst ./docs/svg/%.svg,./docs/png/%.png, $(SVGS))
2022-08-12 17:03:00 -05:00
REV := $(shell date +'%Y.%m.%d-' )$(shell git describe --always --dirty | sed s'/dirty/dev/')
.PHONY: all
all:
@echo "==> Generating SVGs <=="
@mkdir -p docs/svg
2022-08-12 17:03:00 -05:00
@$(MAKE) svgs
@echo "==> Generating PNGs <=="
2022-08-13 10:28:45 -05:00
@cat docs/index.html | sed 's/svg/png/g' | sed 's/\.\/png/\./g' > docs/png/index.html
@mkdir -p docs/png
2022-08-12 17:03:00 -05:00
@$(MAKE) pngs
.PHONY: pngs
## generate all of the logo pngs
pngs: $(PNGS)
docs/png/%.png: docs/svg/%.svg
@inkscape --export-filename=$@ $<
2022-08-12 17:03:00 -05:00
.PHONY: logos
## generate all of the logo svgs
svgs: $(SRC)
./generate-all.py $(REV)
.PHONY: lint
## apply isort/black/flake8
lint:
@isort logo
@black logo
@flake8 logo
.PHONY: bootstrap pdm-env conda-env
## bootstrap the conda environment
bootstrap: pdm-env
conda-env:
$(CONDA) CONDA_ALWAYS_YES="true" mamba create -p ./env python --force
pdm-env: conda-env
$(CONDA) conda activate ./env; \
pip install pdm; \
pdm install
.PHONY: clean
## remove old files
clean:
rm -f *.svg *.png
2022-08-12 18:06:53 -05:00
rm -f docs/*.svg
2022-08-12 17:03:00 -05:00
rm -f docs/svg/*
rm -f docs/png/*
.PHONY: help
help: ## try `make help`
@awk '/^[a-z.A-Z_-]+:/ { helpMessage = match(lastLine, /^##(.*)/); \
2022-08-13 10:29:00 -05:00
if (helpMessage) { helpCommand = substr($$1, 0, index($$1, ":")-1); \
helpMessage = substr(lastLine, RSTART + 3, RLENGTH); \
printf "\033[36m%-9s\033[0m - %s\n", \
helpCommand, helpMessage;}} { lastLine = $$0 }' $(MAKEFILE_LIST)