[FE training-materials-updates] Makefile: Allow using dashes for the name of the training

Gregory Clement gregory.clement at free-electrons.com
Tue Sep 13 16:49:08 CEST 2016


Repository : git://git.free-electrons.com/training-materials.git
On branch  : sysdev-4d
Link       : http://git.free-electrons.com/training-materials/commit/?id=c1c7e58a0bdab9c48b4b8232825e2e78be2b5116

>---------------------------------------------------------------

commit c1c7e58a0bdab9c48b4b8232825e2e78be2b5116
Author: Gregory CLEMENT <gregory.clement at free-electrons.com>
Date:   Tue Sep 13 16:49:08 2016 +0200

    Makefile: Allow using dashes for the name of the training
    
    For the full labs or full slides rules, instead of using the dash as
    separator we can remove the first and the last word as the pattern is
    fixed.
    
    It allows using dashes in the name of the training and for the related
    files used in the common directory.
    
    Signed-off-by: Gregory CLEMENT <gregory.clement at free-electrons.com>


>---------------------------------------------------------------

c1c7e58a0bdab9c48b4b8232825e2e78be2b5116
 Makefile | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/Makefile b/Makefile
index e6f2573..62032a5 100644
--- a/Makefile
+++ b/Makefile
@@ -519,10 +519,10 @@ ifdef SLIDES
 # Compute the set of chapters to build depending on the name of the
 # PDF file that was requested.
 ifeq ($(firstword $(subst -, , $(SLIDES))),full)
-SLIDES_TRAINING      = $(lastword $(subst -, , $(SLIDES)))
+SLIDES_TRAINING      = $(strip $(subst -slides, , $(subst full-, , $(SLIDES))))
 SLIDES_COMMON_BEFORE = common/slide-header.tex \
 		       common/$(SLIDES_TRAINING)-title.tex
-SLIDES_CHAPTERS      = $($(call UPPERCASE, $(SLIDES_TRAINING))_SLIDES)
+SLIDES_CHAPTERS      = $($(call UPPERCASE, $($(subst  -,_, $(SLIDES_TRAINING))))_SLIDES)
 SLIDES_COMMON_AFTER  = common/slide-footer.tex
 else
 SLIDES_TRAINING      = $(firstword $(subst -, ,  $(SLIDES)))
@@ -541,7 +541,6 @@ SLIDES_COMMON_AFTER  = common/slide-footer.tex
 endif
 
 TRAINING = $(SLIDES_TRAINING)
-
 ifeq ($(SLIDES_CHAPTERS),)
 $(error "No chapter to build, maybe you're building a single chapter whose name doesn't start with a training session name")
 endif
@@ -587,10 +586,10 @@ endif
 
 ifdef LABS
 ifeq ($(firstword $(subst -, , $(LABS))),full)
-LABS_TRAINING      = $(lastword $(subst -, , $(LABS)))
+LABS_TRAINING      = $(strip $(subst -labs, , $(subst full-, , $(LABS))))
 LABS_HEADER        = common/labs-header.tex
 LABS_VARSFILE      = common/$(LABS_TRAINING)-labs-vars.tex
-LABS_CHAPTERS      = $($(call UPPERCASE, $(LABS_TRAINING))_LABS)
+LABS_CHAPTERS      = $($(call UPPERCASE, $($(subst  -,_, $(LABS_TRAINING))))_LABS)
 LABS_FOOTER        = common/labs-footer.tex
 else
 LABS_TRAINING      = $(firstword $(subst -, , $(LABS)))




More information about the training-materials-updates mailing list