aboutsummaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile30
1 files changed, 30 insertions, 0 deletions
diff --git a/Makefile b/Makefile
new file mode 100644
index 00000000..13993c53
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,30 @@
+# 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))
+
+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 && make-lesson || popd >/dev/null
+endef
+
+$(foreach dir, $(SRC_DIRS), $(eval $(call generateRules, $(dir))))
+$(eval $(call generateRules, templates))
+
+.PHONY: $(SRC_DIRS) templates
+