diff --git a/crepbook.cls b/crepbook.cls index d2102170..3295dd91 100644 --- a/crepbook.cls +++ b/crepbook.cls @@ -18,6 +18,8 @@ % Options \newif{\iftabs} \DeclareOption{tabs}{\ifchorded\tabstrue\fi} +\newif{\iflilypond} +\DeclareOption{lilypond}{\ifchorded\lilypondtrue\fi} % Default options : pass to the songs package \DeclareOption*{\PassOptionsToPackage{\CurrentOption}{songs}} @@ -150,6 +152,12 @@ \renewcommand{\gtab}[2]{}% \fi% +\newcommand{\lilypond}[1]{% + \iflilypond% + \includegraphics{#1} + \fi% +} + \newcommand{\image}[2]{% \ifchorded% \begin{flushright}% diff --git a/makefile b/makefile index bf1e66f4..e813aeda 100644 --- a/makefile +++ b/makefile @@ -38,6 +38,15 @@ else IKIWIKI=ikiwiki endif +ifeq ($(shell which lilypond),) +LILYPOND=$(ECHO) "** lilypond not found" >&2 ; $(ECHO) lilypond +LILYFILE='' +else +LILYPOND=lilypond +LILYSRC=$(wildcard songs/*/*.ly) +LILYFILE=$(LILYSRC:%.ly=%.pdf) +endif + # Get dependencies (that can also have dependencies) define get_dependencies deps=`perl -ne '($$_)=/^[^%]*\\\(?:include|input)\{(.*?)\}/;@_=split /,/; foreach $$t (@_) { print "$$t "}' $<` @@ -65,6 +74,8 @@ ps: $(PSF) pdf: $(PDF) xpdf $< +lilypond: $(LILYFILE) + clean: cleandoc @rm -f $(SRC:%.tex=%.d) @rm -f $(CIBLE:%=%.aux) @@ -77,6 +88,7 @@ clean: cleandoc cleanall: clean @rm -f $(PDF) $(PSF) + @rm -f $(LILYFILE) depend: @@ -125,3 +137,8 @@ $(SONGS): $(SONGS_SRC) %.sbd: %.sgl @$(MAKE_SONGDB) --songs=$< --output=$@ + +%.pdf: %.ly + @$(LILYPOND) --output=$(@:%.pdf=%) $< + @rm $(@:%.pdf=%.ps) +