From 02ede0600099a820fcfdd106f134815ce967c6ab Mon Sep 17 00:00:00 2001 From: Egor Tensin Date: Fri, 26 Feb 2021 13:42:55 +0300 Subject: Makefile: best practices --- Makefile | 32 +++++++++++++++++++++++--------- 1 file changed, 23 insertions(+), 9 deletions(-) diff --git a/Makefile b/Makefile index ef551bf..ea5d69e 100644 --- a/Makefile +++ b/Makefile @@ -1,17 +1,31 @@ -MKDIR = mkdir -p -RMDIR = $(RM) -r +MAKEFLAGS += --no-builtin-rules --no-builtin-variables --warn-undefined-variables +.DEFAULT_GOAL := all +.DELETE_ON_ERROR: +.SUFFIXES: +SHELL := bash +.SHELLFLAGS := -eu -o pipefail -c -name = cv +MKDIR := mkdir -p -- +RMDIR := $(RM) -r -- -$(name)/$(name).pdf : $(name).tex $(name)/ img/* +name := cv +pdf := $(name)/$(name).pdf + +.PHONY: DO +DO: + +.PHONY: all +all: $(pdf) + +$(pdf): $(name).tex img/selfie_face.jpg | $(name)/ pdflatex -interaction=nonstopmode -halt-on-error -output-directory=$(name)/ $< -$(name)/ : +%/: $(MKDIR) $@ -.PHONY : clean clean-all - -clean : +.PHONY: clean +clean: -clean-all : clean +.PHONY: clean-all +clean-all: clean $(RMDIR) $(name)/ -- cgit v1.2.3