[FE training-materials-updates] Makefile: refactor the all and help targets
Thomas Petazzoni
thomas.petazzoni at free-electrons.com
Wed Apr 1 17:37:29 CEST 2015
Repository : git://git.free-electrons.com/training-materials.git
On branch : master
Link : http://git.free-electrons.com/training-materials/commit/?id=47a18bcdf526797fcf3d8c3e0e59bcb864902111
>---------------------------------------------------------------
commit 47a18bcdf526797fcf3d8c3e0e59bcb864902111
Author: Thomas Petazzoni <thomas.petazzoni at free-electrons.com>
Date: Wed Apr 1 10:40:07 2015 +0200
Makefile: refactor the all and help targets
Instead of duplicating code, let's use a wonderful invention of
computer science people: loops.
Signed-off-by: Thomas Petazzoni <thomas.petazzoni at free-electrons.com>
>---------------------------------------------------------------
47a18bcdf526797fcf3d8c3e0e59bcb864902111
Makefile | 41 +++++++++++++++++++++--------------------
1 file changed, 21 insertions(+), 20 deletions(-)
diff --git a/Makefile b/Makefile
index 8555f05..16e8651 100644
--- a/Makefile
+++ b/Makefile
@@ -10,6 +10,11 @@ EPSTOPDF = epstopdf
# Needed macros
UPPERCASE = $(shell echo $1 | tr "[:lower:]" "[:upper:]")
+define sep
+
+
+endef
+
# List of slides for the different courses
KERNEL_SLIDES = \
@@ -592,29 +597,25 @@ $(VARS): FORCE
clean:
$(RM) -rf $(OUTDIR) *.pdf *-labs *.xz
-all: full-sysdev-slides.pdf full-sysdev-labs.pdf full-kernel-slides.pdf full-kernel-labs.pdf full-android-slides.pdf full-android-labs.pdf full-boottime-slides.pdf full-boottime-labs.pdf kernel-agenda.pdf android-agenda.pdf boottime-agenda.pdf
+ALL_TRAININGS = \
+ android \
+ boottime \
+ kernel \
+ sysdev \
+ yocto
+
+all: $(foreach p,$(ALL_TRAININGS),full-$(p)-slides.pdf full-$(p)-labs.pdf $(p)-agenda.pdf)
help:
@echo "Available targets:"
@echo
- @echo " full-sysdev-labs.pdf Complete labs for the 'sysdev' course"
- @echo " full-kernel-labs.pdf Complete labs for the 'kernel' course"
- @echo " full-android-labs.pdf Complete labs for the 'android' course"
- @echo " full-boottime-labs.pdf Complete labs for the 'boottime' course"
- @echo " full-yocto-labs.pdf Complete labs for the 'yocto' course"
- @echo " full-sysdev-slides.pdf Complete slides for the 'sysdev' course"
- @echo " full-kernel-slides.pdf Complete slides for the 'kernel' course"
- @echo " full-android-slides.pdf Complete slides for the 'android' course"
- @echo " full-boottime-slides.pdf Complete slides for the 'boottime' course"
- @echo " full-yocto-slides.pdf Complete slides for the 'yocto' course"
- @echo " android-agenda.pdf Agenda for the 'android' course"
- @echo " autotools-agenda.pdf Agenda for the 'autotools' course"
- @echo " boottime-agenda.pdf Agenda for the 'boottime' course"
- @echo " buildroot-agenda.pdf Agenda for the 'buildroot' course"
- @echo " sysdev-agenda.pdf Agenda for the 'sysdev' course"
- @echo " kernel-agenda.pdf Agenda for the 'kernel' course"
- @echo " yocto-agenda.pdf Agenda for the 'yocto' course"
+ $(foreach p,$(ALL_TRAININGS),\
+ @printf " %-30s %s\n" "full-$(p)-labs.pdf" "Complete labs for the '$(p)' course"$(sep))
+ $(foreach p,$(ALL_TRAININGS),\
+ @printf " %-30s %s\n" "full-$(p)-slides.pdf" "Complete slides for the '$(p)' course"$(sep))
+ $(foreach p,$(ALL_TRAININGS),\
+ @printf " %-30s %s\n" "$(p)-agenda.pdf" "Agenda for the '$(p)' course"$(sep))
@echo
- @echo " <some-chapter>-slides.pdf Slides for a particular chapter in slides/"
- @echo " <some-chapter>-labs.pdf Labs for a particular chapter in labs/"
+ @echo " <some-chapter>-slides.pdf Slides for a particular chapter in slides/"
+ @echo " <some-chapter>-labs.pdf Labs for a particular chapter in labs/"
@echo
More information about the training-materials-updates
mailing list