aboutsummaryrefslogtreecommitdiff
path: root/Makefile
blob: 2cacabecda613fdb11e052c65ba62f9a179c80a4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# The full path to the Makefile
MAKEFILE_PATH := $(abspath $(lastword $(MAKEFILE_LIST)))
# The path to the directory of the Makefile
MAKEFILE_DIR := $(dir $(MAKEFILE_PATH))

.SHELLFLAGS := -e -o pipefail -c

include $(MAKEFILE_DIR)/common.mk

SRC_DIRS := $(shell find "(" -not -path "./templates/*" -a -not -path "./latex/*" -a -not -path "*/Aufgaben/*" -a "(" -name "*.md" -o -name "*.tex" ")" ")" -printf "%h\n" | uniq)

# Hide or not the calls depending of VERBOSE
ifeq ($(VERBOSE),TRUE)
	HIDE :=
else
	HIDE := @
endif

.DEFAULT_GOAL := all
all: $(SRC_DIRS)

define generateRules
$(1):
	@echo \#\# Building $$@ \#\#
	@pushd $$(@) >/dev/null && lesson-make || popd >/dev/null
endef

$(foreach dir, $(SRC_DIRS), $(eval $(call generateRules, $(dir))))
$(eval $(call generateRules, templates))

.PHONY: $(SRC_DIRS) templates