Hi all, I'm currently learning the use of Makefile and how to automate the creation of lilypond files. In the process, it's important to keep a clean repertory structure, as suggested in the documentation http://lilypond.org/doc/v2.18/Documentation/usage/make-and-makefiles.html <http://lilypond.org/doc/v2.18/Documentation/usage/make-and-makefiles.html>
However, I had problems when generating some midi files when you want them to be placed automatically in the appropriate folder. The documentation suggests this code: # The pattern rule to create PDF and MIDI files from a LY input file. # The .pdf output files are put into the `PDF' subdirectory, and the # .midi files go into the `MIDI' subdirectory. %.pdf %.midi: %.ly $(LILY_CMD) $<; \ # this line begins with a tab if test -f "$*.pdf"; then \ mv "$*.pdf" PDF/; \ fi; \ if test -f "$*.midi"; then \ mv "$*.midi" MIDI/; \ fi But if you have a bookoutputname set in your .ly file (for instance if you want multiple midi files within the same file), this code won't work because the midi file name won't match the original *.ly name and the generated files will stay at the root folder. After some time thinking about that problem (I'm not a bash expert at all), I came to this solution: %.pdf %.midi: %.ly $(LILY_CMD) $<; \ # this line begins with a tab for file in *; do \ if [[ $$file == *.pdf ]]; then \ mv $$file PDF/; \ fi; \ if [[ $$file == *.midi ]]; then \ mv $$file MIDI/; \ fi; \ done What do you think, would it be a good idea to update the example in the documentation or not? -- Sent from: http://lilypond.1069038.n5.nabble.com/User-f3.html