2022-10-31 16:45:55 +01:00
|
|
|
# Sources of inspiration:
|
|
|
|
# https://makefiletutorial.com/
|
|
|
|
# https://code.larlet.fr/makefile/
|
|
|
|
# https://www.thapaliya.com/en/writings/well-documented-makefiles/
|
|
|
|
|
|
|
|
.DEFAULT_GOAL:=help
|
|
|
|
SHELL:=/bin/bash
|
|
|
|
|
2022-11-02 19:21:32 +01:00
|
|
|
pandoc=$(shell command -v pandoc)
|
|
|
|
pandoc_version=$(shell pandoc --version | sed -e 's/.* // ; 1q')
|
|
|
|
awk=$(shell command -v awk)
|
|
|
|
|
2022-12-21 21:07:22 +01:00
|
|
|
templates_directory="./templates"
|
|
|
|
notes_directory="./notes"
|
|
|
|
|
2022-10-31 16:45:55 +01:00
|
|
|
.PHONY: help deps
|
|
|
|
|
|
|
|
help: ## Display this help
|
|
|
|
@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m<target>\033[0m\n\nTargets:\n"} /^[a-zA-Z_-]+:.*?##/ { printf " \033[36m%-10s\033[0m %s\n", $$1, $$2 }' $(MAKEFILE_LIST)
|
|
|
|
|
|
|
|
deps: ## Check dependencies
|
|
|
|
$(info Checking and getting dependencies)
|
2022-11-02 19:21:32 +01:00
|
|
|
ifeq ($(strip ($pandoc)),)
|
|
|
|
@echo "pandoc is required"
|
|
|
|
else
|
|
|
|
@echo "pandoc" $(pandoc_version) "is installed"
|
|
|
|
endif
|
|
|
|
ifeq ($(strip ($awk)),)
|
|
|
|
@echo "awk is required"
|
|
|
|
else
|
|
|
|
@echo "awk is installed"
|
|
|
|
endif
|
2022-12-21 21:07:22 +01:00
|
|
|
|
|
|
|
new: ## Create a new file
|
|
|
|
$(info Creating a new file)
|
|
|
|
date=$(shell date +%Y)
|
|
|
|
name=$(date).md
|
|
|
|
@echo $(name)
|
|
|
|
cp $(templates_directory)/default.md $(notes_directory)/$(name)
|