DocumentsPublics/Makefile

41 lines
1.3 KiB
Makefile
Raw Permalink Normal View History

2023-03-30 17:52:56 +02:00
UID=$(shell id -u)
export UID
GID=$(shell id -g)
export GID
#-----------------------------------------
# Allow passing arguments to make
#-----------------------------------------
SUPPORTED_COMMANDS := generate.pdf
SUPPORTS_MAKE_ARGS := $(findstring $(firstword $(MAKECMDGOALS)), $(SUPPORTED_COMMANDS))
ifneq "$(SUPPORTS_MAKE_ARGS)" ""
COMMAND_ARGS := $(wordlist 2,$(words $(MAKECMDGOALS)),$(MAKECMDGOALS))
$(eval $(COMMAND_ARGS):;@:)
endif
#-----------------------------------------
# Help commands
#-----------------------------------------
.DEFAULT_GOAL := help
help: ## Prints this help
@grep -E '^[a-zA-Z_\-\0.0-9]+:.*?## .*$$' ${MAKEFILE_LIST} | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
clean: ## Nettoie et éteint le projet
@rm -rf public/*
@docker-compose down # stop + rm
docker.up: ## Démarre simplement la stack
@docker-compose up -d # create + start en daemon
docker.pull: ## Récupère la dernière image
-@docker-compose pull
dev: clean docker.pull docker.up ## Démarre la génération de document en mode développement
TARGET_DIR=${COMMAND_ARGS}
export TARGET_DIR
generate.pdf: ## Génère le pdf du document donné (make generate.pdf TARGET_DIR=ri)
@docker-compose run --rm -e SPI_FORMAT=pdf -e SPI_WATCH=false -e "MULTIPLE_TARGET=${TARGET_DIR}" pandoc