Makefile: Append "-chords" or "-full" to audio/MIDI files.
authorRicardo Wurmus <rekado@elephly.net>
Fri, 5 May 2017 22:37:00 +0000 (00:37 +0200)
committerRicardo Wurmus <rekado@elephly.net>
Fri, 5 May 2017 22:37:00 +0000 (00:37 +0200)
Makefile
rules.mk

index 99a515a..b8392f7 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -5,6 +5,13 @@ CPU_CORES=`grep -m1 "cpu cores" /proc/cpuinfo | tr -cd '[:digit:]'`
 # The command to run lilypond
 LILY_CMD = LILYPOND_USE_CHORDS=$(LILYPOND_USE_CHORDS) lilypond -dinclude-settings=settings.ly -ddelete-intermediate-files -drelative-includes -djob-count=$(CPU_CORES)
 
+# Append "-chords" to guide tracks when $(LILYPOND_USE_CHORDS) is set
+ifeq ($(LILYPOND_USE_CHORDS),1)
+  GUIDE_SUFFIX=-chords
+else
+  GUIDE_SUFFIX=-full
+endif
+
 SUBDIRS := 01-song1 02-song2 03-circus 04-white-noise
 
 all: $(SUBDIRS)
index ff8e111..d01813e 100644 (file)
--- a/rules.mk
+++ b/rules.mk
@@ -1,6 +1,6 @@
-$(NAME): $(NAME)/$(NAME).wav
+$(NAME): $(NAME)/$(NAME)$(GUIDE_SUFFIX).wav
 
-$(NAME)/$(NAME).wav: $(NAME)/$(NAME).midi
+$(NAME)/$(NAME)$(GUIDE_SUFFIX).wav: $(NAME)/$(NAME)$(GUIDE_SUFFIX).midi
        fluidsynth -r 48000 -F $@ -l -R no -i -n -a alsa $(SOUNDFONT) $<
 
 $(NAME)/parts/%.pdf: $(NAME)/parts/%.ly $(NAME)/music/%.ly
@@ -9,8 +9,8 @@ $(NAME)/parts/%.pdf: $(NAME)/parts/%.ly $(NAME)/music/%.ly
 $(NAME)/$(NAME).pdf: $(NAME)/$(NAME).ly $(wildcard $(NAME)/music/*.ly)
        $(LILY_CMD) --output=$(dir $@) $<
 
-$(NAME)/$(NAME).midi: $(NAME)/$(NAME).ly $(wildcard $(NAME)/music/*.ly)
-       $(LILY_CMD) --output=$(dir $@) $<
+$(NAME)/$(NAME)$(GUIDE_SUFFIX).midi: $(NAME)/$(NAME).ly $(wildcard $(NAME)/music/*.ly)
+       $(LILY_CMD) --output=$(dir $@) $< && mv $(subst .ly,.midi,$<) $@
 
 $(NAME)/$(NAME)-klick-mono.wav: $(NAME)/$(NAME).tempo
        klick -W $@ -f $<
@@ -18,14 +18,14 @@ $(NAME)/$(NAME)-klick-mono.wav: $(NAME)/$(NAME).tempo
 $(NAME)/$(NAME)-klick.wav: $(NAME)/$(NAME)-klick-mono.wav
        sox $< $@ channels 2
 
-$(NAME)/guide.wav: $(NAME)/$(NAME)-klick.wav $(NAME)/$(NAME).wav
+$(NAME)/guide$(GUIDE_SUFFIX).wav: $(NAME)/$(NAME)-klick.wav $(NAME)/$(NAME)$(GUIDE_SUFFIX).wav
        sox --combine mix $< -v 0.25 $(word 2,$^) $@
 
-$(NAME)/$(NAME).ogg: $(NAME)/$(NAME).wav
+$(NAME)/$(NAME)$(GUIDE_SUFFIX).ogg: $(NAME)/$(NAME)$(GUIDE_SUFFIX).wav
        oggenc $<
 
-$(NAME)/upload-ogg: $(NAME)/$(NAME).ogg
+$(NAME)/upload-ogg: $(NAME)/$(NAME)$(GUIDE_SUFFIX).ogg
        scp $< elephly.net:~/elephly.net/secret/band/$<
 
-$(NAME)/upload-wav: $(NAME)/$(NAME).wav
+$(NAME)/upload-wav: $(NAME)/$(NAME)$(GUIDE_SUFFIX).wav
        scp $< elephly.net:~/elephly.net/secret/band/$<