[bootlin/training-materials updates] master: Makefile: rework 'help' and 'all' targets to only use existing targets (ef57741a)

Thomas Petazzoni thomas.petazzoni at bootlin.com
Fri Oct 29 10:46:40 CEST 2021

Repository : https://github.com/bootlin/training-materials
On branch  : master
Link       : https://github.com/bootlin/training-materials/commit/ef57741a973325dc7892bc42758ae9b37433359c


commit ef57741a973325dc7892bc42758ae9b37433359c
Author: Thomas Petazzoni <thomas.petazzoni at bootlin.com>
Date:   Sun Aug 8 13:33:11 2021 +0200

    Makefile: rework 'help' and 'all' targets to only use existing targets
    For example, the graphics course has no labs PDF and no labs tarball.
    Signed-off-by: Thomas Petazzoni <thomas.petazzoni at bootlin.com>


 Makefile | 21 +++++++++++++--------
 1 file changed, 13 insertions(+), 8 deletions(-)

diff --git a/Makefile b/Makefile
index 7f04193f..517428bb 100644
--- a/Makefile
+++ b/Makefile
@@ -300,7 +300,12 @@ clean:
 ALL_TRAININGS = $(sort $(patsubst %.mk,%,$(notdir $(wildcard mk/*.mk))))
-all: $(foreach p,$(ALL_TRAININGS),full-$(p)-slides.pdf full-$(p)-labs.pdf $(p)-agenda.pdf)
+ALL_SLIDES = $(foreach p,$(ALL_TRAININGS),$(if $($(call UPPERCASE,$(p)_SLIDES)),full-$(p)-slides.pdf))
+ALL_LABS = $(foreach p,$(ALL_TRAININGS),$(if $($(call UPPERCASE,$(p)_LABS)),full-$(p)-labs.pdf))
+ALL_AGENDAS = $(patsubst %.tex,%.pdf,$(notdir $(wildcard agenda/*.tex)))
+ALL_LABS_TARBALLS = $(patsubst %,%-labs.tar.xz,$(filter-out common,$(notdir $(wildcard lab-data/*))))
 	@echo $(ALL_TRAININGS)
@@ -310,14 +315,14 @@ HELP_FIELD_FORMAT = " %-34s %s\n"
 	@echo "Available targets:"
-	$(foreach p,$(ALL_TRAININGS),\
-		@printf $(HELP_FIELD_FORMAT) "full-$(p)-labs.pdf" "Complete labs for the '$(p)' course"$(sep))
-	$(foreach p,$(ALL_TRAININGS),\
-		@printf $(HELP_FIELD_FORMAT) "full-$(p)-slides.pdf" "Complete slides for the '$(p)' course"$(sep))
-	$(foreach p,$(sort $(patsubst agenda/%.tex,%.pdf,$(wildcard agenda/*.tex))),\
+	$(foreach p,$(ALL_SLIDES),\
+		@printf $(HELP_FIELD_FORMAT) "$(p)" "Complete slides for the '$(patsubst full-%-slides.pdf,%,$(p))' course"$(sep))
+	$(foreach p,$(ALL_LABS),\
+		@printf $(HELP_FIELD_FORMAT) "$(p)" "Complete labs for the '$(patsubst full-%-labs.pdf,%,$(p))' course"$(sep))
+	$(foreach p,$(ALL_AGENDAS),\
 		@printf $(HELP_FIELD_FORMAT) "$(p)" "Agenda for the '$(patsubst %-agenda.pdf,%,$(p))' course"$(sep))
-	$(foreach p,$(ALL_TRAININGS),\
-		@printf $(HELP_FIELD_FORMAT) "$(p)-labs.tar.xz" "Lab data for the '$(p)' course"$(sep))
+	$(foreach p,$(ALL_LABS_TARBALLS),\
+		@printf $(HELP_FIELD_FORMAT) "$(p)" "Lab data for the '$(patsubst %-labs.tar.xz,%,$(p))' course"$(sep))
 	@printf $(HELP_FIELD_FORMAT) "<some-chapter>-slides.pdf" "Slides for a particular chapter in slides/"
 	@printf $(HELP_FIELD_FORMAT) "<some-chapter>-labs.pdf" "Labs for a particular chapter in labs/"

More information about the training-materials-updates mailing list