[prev in list] [next in list] [prev in thread] [next in thread] 

List:       lilypond-user
Subject:    Re: musicxml2ly in python
From:       Jacques Menu <imj-muzhic () bluewin ! ch>
Date:       2022-02-25 15:17:57
Message-ID: C6A455BE-3BAF-41DA-B65D-583BF67D0CBA () bluewin ! ch
[Download RAW message or body]

Hello Sebastian,

This can also be done with a make file, but maybe that is not your use case.
 Doing so offers means to place the generated files in sub-folders and to remove them \
seamlessly.  Also, only the .xml files modified or created since the last ‘make' \
execution are converted.

Attached is an example Makefile, which I use to convert all the .xml files in a \
folder with my xml2ly.

It can be used with musicxml2ly too: drop this Makefile in the given folder and use \
it as shown below. 

‘OPTIONS=...‘ is neccesary in this case because there is otherwise a default \
‘-q' (quiet) to be used by xml2ly. It can be as simple as  ‘OPTIONS=‘.

HTH!

JM

—

jacquesmenu@macmini: ~/musicformats-git-dev/files/musicxmlfiles/keys > make help
Makefile for converting MusicXML files to LilyPond scores.
Supplied as part of the MusicFormats library, thanks to Dom Fober for providing it.
Output files are written in sub-folders of the current folder.

Available targets are:
  'all' (default) : call the 'lily' target.

  'lily'          : converts the set of MusicXML files to lilypond in folder 

  'pnglily'       : converts the output of 'lily' target to png in folder pnglily
  'pdflily'       : converts the output of 'lily' target to pdf in folder pdflily
  'midilily'      : converts the output of 'lily' target to pdf in folder midilily

  'clean'         : removes the sub-folders containing the results

Options:
  'XML2LY=/path/to/xml2ly
  'OPTIONS=...
  'LILYPOND=/path/to/lilypond
  When those options are not specified, the tools are taken from the current PATH \
variable,  and OPTIONS contains '-q' (quiet mode) for xml2ly.

jacquesmenu@macmini: ~/musicformats-git-dev/files/musicxmlfiles/keys > make \
XML2LY=musicxml2ly OPTIONS=--midi XML2LY   = musicxml2ly
OPTIONS  = --midi
LILYPOND = /Applications/LilyPond/lilypond-2.23.6/bin/lilypond

musicxml2ly version is: 
musicxml2ly (LilyPond) 2.22.1

lilypond version is: 
GNU LilyPond 2.23.6 (running Guile 2.2)

musicxml2ly --midi -o "lilypond/HumdrumScotKeys.ly" "HumdrumScotKeys.xml"
musicxml2ly: Reading MusicXML from HumdrumScotKeys.xml ...
musicxml2ly: Converting to LilyPond expressions...
musicxml2ly: Output to `lilypond/HumdrumScotKeys.ly'
musicxml2ly: Converting to current version (2.22.1) notations ...
/Applications/LilyPond/lilypond-2.23.6/bin/lilypond --pdf -l NONE -s -o \
"pdflily/HumdrumScotKeys" "lilypond/HumdrumScotKeys.ly"

Contents of lilypond sub-folder:
8 -rw-r--r--  1 jacquesmenu  staff  1708 Feb 25 16:14 lilypond/HumdrumScotKeys.ly

Contents of pdflily sub-folder:
88 -rw-r--r--  1 jacquesmenu  staff  42039 Feb 25 16:14 pdflily/HumdrumScotKeys.pdf

jacquesmenu@macmini: ~/musicformats-git-dev/files/musicxmlfiles/keys > ls -salR
total 24
 0 drwxr-xr-x    7 jacquesmenu  staff   224 Feb 25 16:14 .
 0 drwxr-xr-x  108 jacquesmenu  staff  3456 Feb 25 07:46 ..
16 -rw-r--r--@   1 jacquesmenu  staff  6148 Feb 25 12:51 .DS_Store
 8 -rw-r--r--    1 jacquesmenu  staff  2634 Apr 22  2021 HumdrumScotKeys.xml
 0 lrwxr-xr-x    1 jacquesmenu  staff    11 Feb 25 14:12 Makefile -> ../Makefile
 0 drwxr-xr-x    3 jacquesmenu  staff    96 Feb 25 16:14 lilypond
 0 drwxr-xr-x    4 jacquesmenu  staff   128 Feb 25 16:14 pdflily

./lilypond:
total 8
0 drwxr-xr-x  3 jacquesmenu  staff    96 Feb 25 16:14 .
0 drwxr-xr-x  7 jacquesmenu  staff   224 Feb 25 16:14 ..
8 -rw-r--r--  1 jacquesmenu  staff  1708 Feb 25 16:14 HumdrumScotKeys.ly

./pdflily:
total 96
 0 drwxr-xr-x  4 jacquesmenu  staff    128 Feb 25 16:14 .
 0 drwxr-xr-x  7 jacquesmenu  staff    224 Feb 25 16:14 ..
 8 -rw-r--r--  1 jacquesmenu  staff    170 Feb 25 16:14 HumdrumScotKeys.midi
88 -rw-r--r--  1 jacquesmenu  staff  42039 Feb 25 16:14 HumdrumScotKeys.pdf

jacquesmenu@macmini: ~/musicformats-git-dev/files/musicxmlfiles/keys > make clean

jacquesmenu@macmini: ~/musicformats-git-dev/files/musicxmlfiles/keys > ls -sal
total 24
 0 drwxr-xr-x    5 jacquesmenu  staff   160 Feb 25 15:57 .
 0 drwxr-xr-x  108 jacquesmenu  staff  3456 Feb 25 07:46 ..
16 -rw-r--r--@   1 jacquesmenu  staff  6148 Feb 25 12:51 .DS_Store
 8 -rw-r--r--    1 jacquesmenu  staff  2634 Apr 22  2021 HumdrumScotKeys.xml
 0 lrwxr-xr-x    1 jacquesmenu  staff    11 Feb 25 14:12 Makefile -> ../Makefile


[Attachment #3 (multipart/mixed)]

[Attachment #5 (unknown)]

<html><head><meta http-equiv="Content-Type" content="text/html; \
charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; \
line-break: after-white-space;" class="">Hello&nbsp;Sebastian,<div class=""><br \
class=""></div><div class="">This can also be done with a make file, but maybe that \
is not your use case.</div><div class="">&nbsp;Doing so offers means to place the \
generated files in sub-folders and to remove them seamlessly.&nbsp;</div><div \
class="">Also, only the .xml files modified or created since the last ‘make' \
execution are converted.</div><div class=""><br class=""></div><div class="">Attached \
is an example Makefile, which I use to convert all the .xml files in a folder with my \
xml2ly.</div><div class=""><br class=""></div><div class="">It can be used with \
musicxml2ly too: drop this Makefile in the given folder and use it as shown \
below.&nbsp;</div><div class=""><br class=""></div><div class="">‘<font \
face="Menlo" size="2" class="">OPTIONS=...‘ is neccesary in this case because there \
is otherwise a default&nbsp;‘-q' (quiet) to be used by xml2ly. It can be as simple \
as&nbsp;</font>&nbsp;‘<font face="Menlo" size="2" \
class="">OPTIONS=‘.</font></div><div class=""><br class=""></div><div \
class=""><div>HTH!</div><div><br class=""></div><div>JM</div><div><br \
class=""></div><div>—</div></div><div><br class=""></div><div class=""><div \
style="margin: 0px; font-stretch: normal; font-size: 13px; line-height: normal; \
font-family: Menlo;" class=""><div style="margin: 0px; font-stretch: normal; \
line-height: normal;" class=""><div style="margin: 0px; font-stretch: normal; \
line-height: normal;" class=""><span style="font-variant-ligatures: \
no-common-ligatures; color: #400bd9" class=""><b \
class="">jacquesmenu@macmini</b></span><span style="font-variant-ligatures: \
no-common-ligatures" class="">: ~/musicformats-git-dev/files/musicxmlfiles/keys &gt; \
make help</span></div><div style="margin: 0px; font-stretch: normal; line-height: \
normal;" class=""><span style="font-variant-ligatures: no-common-ligatures" \
class="">Makefile for converting MusicXML files to LilyPond scores.</span></div><div \
style="margin: 0px; font-stretch: normal; line-height: normal;" class=""><span \
style="font-variant-ligatures: no-common-ligatures" class="">Supplied as part of the \
MusicFormats library, thanks to Dom Fober for providing it.</span></div><div \
style="margin: 0px; font-stretch: normal; line-height: normal;" class=""><span \
style="font-variant-ligatures: no-common-ligatures" class="">Output files are written \
in sub-folders of the current folder.</span></div><div style="margin: 0px; \
font-stretch: normal; line-height: normal; min-height: 15px;" class=""><span \
style="font-variant-ligatures: no-common-ligatures" class=""></span><br \
class=""></div><div style="margin: 0px; font-stretch: normal; line-height: normal;" \
class=""><span style="font-variant-ligatures: no-common-ligatures" class="">Available \
targets are:</span></div><div style="margin: 0px; font-stretch: normal; line-height: \
normal;" class=""><span style="font-variant-ligatures: no-common-ligatures" \
class="">&nbsp; 'all' (default) : call the 'lily' target.</span></div><div \
style="margin: 0px; font-stretch: normal; line-height: normal; min-height: 15px;" \
class=""><span style="font-variant-ligatures: no-common-ligatures" \
class=""></span><br class=""></div><div style="margin: 0px; font-stretch: normal; \
line-height: normal;" class=""><span style="font-variant-ligatures: \
no-common-ligatures" class="">&nbsp; 'lily'&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; : \
converts the set of MusicXML files to lilypond in folder&nbsp;</span></div><div \
style="margin: 0px; font-stretch: normal; line-height: normal; min-height: 15px;" \
class=""><span style="font-variant-ligatures: no-common-ligatures" \
class=""></span><br class=""></div><div style="margin: 0px; font-stretch: normal; \
line-height: normal;" class=""><span style="font-variant-ligatures: \
no-common-ligatures" class="">&nbsp; 'pnglily' &nbsp; &nbsp; &nbsp; : converts the \
output of 'lily' target to png in folder pnglily</span></div><div style="margin: 0px; \
font-stretch: normal; line-height: normal;" class=""><span \
style="font-variant-ligatures: no-common-ligatures" class="">&nbsp; 'pdflily' &nbsp; \
&nbsp; &nbsp; : converts the output of 'lily' target to pdf in folder \
pdflily</span></div><div style="margin: 0px; font-stretch: normal; line-height: \
normal;" class=""><span style="font-variant-ligatures: no-common-ligatures" \
class="">&nbsp; 'midilily'&nbsp; &nbsp; &nbsp; : converts the output of 'lily' target \
to pdf in folder midilily</span></div><div style="margin: 0px; font-stretch: normal; \
line-height: normal; min-height: 15px;" class=""><span style="font-variant-ligatures: \
no-common-ligatures" class=""></span><br class=""></div><div style="margin: 0px; \
font-stretch: normal; line-height: normal;" class=""><span \
style="font-variant-ligatures: no-common-ligatures" class="">&nbsp; 'clean' &nbsp; \
&nbsp; &nbsp; &nbsp; : removes the sub-folders containing the \
results</span></div><div style="margin: 0px; font-stretch: normal; line-height: \
normal; min-height: 15px;" class=""><span style="font-variant-ligatures: \
no-common-ligatures" class=""></span><br class=""></div><div style="margin: 0px; \
font-stretch: normal; line-height: normal;" class=""><span \
style="font-variant-ligatures: no-common-ligatures" \
class="">Options:</span></div><div style="margin: 0px; font-stretch: normal; \
line-height: normal;" class=""><span style="font-variant-ligatures: \
no-common-ligatures" class="">&nbsp; 'XML2LY=/path/to/xml2ly</span></div><div \
style="margin: 0px; font-stretch: normal; line-height: normal;" class=""><span \
style="font-variant-ligatures: no-common-ligatures" class="">&nbsp; \
'OPTIONS=...</span></div><div style="margin: 0px; font-stretch: normal; line-height: \
normal;" class=""><span style="font-variant-ligatures: no-common-ligatures" \
class="">&nbsp; 'LILYPOND=/path/to/lilypond</span></div><div style="margin: 0px; \
font-stretch: normal; line-height: normal;" class=""><span \
style="font-variant-ligatures: no-common-ligatures" class="">&nbsp; When those \
options are not specified, the tools are taken from the current PATH \
variable,</span></div><div style="margin: 0px; font-stretch: normal; line-height: \
normal;" class=""><span style="font-variant-ligatures: no-common-ligatures" \
class="">&nbsp; and OPTIONS contains '-q' (quiet mode) for xml2ly.</span></div><div \
style="margin: 0px; font-stretch: normal; line-height: normal;" class=""><span \
style="font-variant-ligatures: no-common-ligatures; color: #400bd9" class=""><b \
class=""><br class=""></b></span></div><div style="margin: 0px; font-stretch: normal; \
line-height: normal;" class=""><div style="margin: 0px; font-stretch: normal; \
line-height: normal;" class=""><div style="margin: 0px; font-stretch: normal; \
line-height: normal;" class=""><div style="margin: 0px; font-stretch: normal; \
line-height: normal;" class=""><div style="margin: 0px; font-stretch: normal; \
line-height: normal;" class=""><span style="font-variant-ligatures: \
no-common-ligatures; color: #400bd9" class=""><b \
class="">jacquesmenu@macmini</b></span><span style="font-variant-ligatures: \
no-common-ligatures" class="">: ~/musicformats-git-dev/files/musicxmlfiles/keys &gt; \
make XML2LY=musicxml2ly OPTIONS=--midi</span></div><div style="margin: 0px; \
font-stretch: normal; line-height: normal;" class=""><span \
style="font-variant-ligatures: no-common-ligatures" class="">XML2LY &nbsp; = \
musicxml2ly</span></div><div style="margin: 0px; font-stretch: normal; line-height: \
normal;" class=""><span style="font-variant-ligatures: no-common-ligatures" \
class="">OPTIONS&nbsp; = --midi</span></div><div style="margin: 0px; font-stretch: \
normal; line-height: normal;" class=""><span style="font-variant-ligatures: \
no-common-ligatures" class="">LILYPOND = \
/Applications/LilyPond/lilypond-2.23.6/bin/lilypond</span></div><div style="margin: \
0px; font-stretch: normal; line-height: normal; min-height: 15px;" class=""><span \
style="font-variant-ligatures: no-common-ligatures" class=""></span><br \
class=""></div><div style="margin: 0px; font-stretch: normal; line-height: normal;" \
class=""><span style="font-variant-ligatures: no-common-ligatures" \
class="">musicxml2ly version is:&nbsp;</span></div><div style="margin: 0px; \
font-stretch: normal; line-height: normal;" class=""><span \
style="font-variant-ligatures: no-common-ligatures" class="">musicxml2ly (LilyPond) \
2.22.1</span></div><div style="margin: 0px; font-stretch: normal; line-height: \
normal; min-height: 15px;" class=""><span style="font-variant-ligatures: \
no-common-ligatures" class=""></span><br class=""></div><div style="margin: 0px; \
font-stretch: normal; line-height: normal;" class=""><span \
style="font-variant-ligatures: no-common-ligatures" class="">lilypond version \
is:&nbsp;</span></div><div style="margin: 0px; font-stretch: normal; line-height: \
normal;" class=""><span style="font-variant-ligatures: no-common-ligatures" \
class="">GNU LilyPond 2.23.6 (running Guile 2.2)</span></div><div style="margin: 0px; \
font-stretch: normal; line-height: normal; min-height: 15px;" class=""><span \
style="font-variant-ligatures: no-common-ligatures" class=""></span><br \
class=""></div><div style="margin: 0px; font-stretch: normal; line-height: normal;" \
class=""><span style="font-variant-ligatures: no-common-ligatures" \
class="">musicxml2ly --midi -o "lilypond/<a href="http://HumdrumScotKeys.ly" \
class="">HumdrumScotKeys.ly</a>" "HumdrumScotKeys.xml"</span></div><div \
style="margin: 0px; font-stretch: normal; line-height: normal;" class=""><span \
style="font-variant-ligatures: no-common-ligatures" class="">musicxml2ly: Reading \
MusicXML from HumdrumScotKeys.xml ...</span></div><div style="margin: 0px; \
font-stretch: normal; line-height: normal;" class=""><span \
style="font-variant-ligatures: no-common-ligatures" class="">musicxml2ly: Converting \
to LilyPond expressions...</span></div><div style="margin: 0px; font-stretch: normal; \
line-height: normal;" class=""><span style="font-variant-ligatures: \
no-common-ligatures" class="">musicxml2ly: Output to `lilypond/<a \
href="http://HumdrumScotKeys.ly" class="">HumdrumScotKeys.ly</a>'</span></div><div \
style="margin: 0px; font-stretch: normal; line-height: normal;" class=""><span \
style="font-variant-ligatures: no-common-ligatures" class="">musicxml2ly: Converting \
to current version (2.22.1) notations ...</span></div><div style="margin: 0px; \
font-stretch: normal; line-height: normal;" class=""><span \
style="font-variant-ligatures: no-common-ligatures" \
class="">/Applications/LilyPond/lilypond-2.23.6/bin/lilypond --pdf -l NONE -s -o \
"pdflily/HumdrumScotKeys" "lilypond/<a href="http://HumdrumScotKeys.ly" \
class="">HumdrumScotKeys.ly</a>"</span></div><div style="margin: 0px; font-stretch: \
normal; line-height: normal; min-height: 15px;" class=""><span \
style="font-variant-ligatures: no-common-ligatures" class=""></span><br \
class=""></div><div style="margin: 0px; font-stretch: normal; line-height: normal;" \
class=""><span style="font-variant-ligatures: no-common-ligatures" class="">Contents \
of lilypond sub-folder:</span></div><div style="margin: 0px; font-stretch: normal; \
line-height: normal;" class=""><span style="font-variant-ligatures: \
no-common-ligatures" class="">8 -rw-r--r--&nbsp; 1 jacquesmenu&nbsp; staff&nbsp; 1708 \
Feb 25 16:14 lilypond/<a href="http://HumdrumScotKeys.ly" \
class="">HumdrumScotKeys.ly</a></span></div><div style="margin: 0px; font-stretch: \
normal; line-height: normal; min-height: 15px;" class=""><span \
style="font-variant-ligatures: no-common-ligatures" class=""></span><br \
class=""></div><div style="margin: 0px; font-stretch: normal; line-height: normal;" \
class=""><span style="font-variant-ligatures: no-common-ligatures" class="">Contents \
of pdflily sub-folder:</span></div><div style="margin: 0px; font-stretch: normal; \
line-height: normal;" class=""><span style="font-variant-ligatures: \
no-common-ligatures" class="">88 -rw-r--r--&nbsp; 1 jacquesmenu&nbsp; staff&nbsp; \
42039 Feb 25 16:14 pdflily/HumdrumScotKeys.pdf</span></div><div class=""><span \
style="font-variant-ligatures: no-common-ligatures" class=""><br \
class=""></span></div></div></div></div></div><div class=""><span \
style="font-variant-ligatures: no-common-ligatures" class=""><div style="margin: 0px; \
font-stretch: normal; line-height: normal;" class=""><span \
style="font-variant-ligatures: no-common-ligatures; color: #400bd9" class=""><b \
class="">jacquesmenu@macmini</b></span><span style="font-variant-ligatures: \
no-common-ligatures" class="">: ~/musicformats-git-dev/files/musicxmlfiles/keys &gt; \
ls -salR</span></div><div style="margin: 0px; font-stretch: normal; line-height: \
normal;" class=""><span style="font-variant-ligatures: no-common-ligatures" \
class="">total 24</span></div><div style="margin: 0px; font-stretch: normal; \
line-height: normal;" class=""><span style="font-variant-ligatures: \
no-common-ligatures" class="">&nbsp;0 drwxr-xr-x&nbsp; &nbsp; 7 jacquesmenu&nbsp; \
staff &nbsp; 224 Feb 25 16:14 .</span></div><div style="margin: 0px; font-stretch: \
normal; line-height: normal;" class=""><span style="font-variant-ligatures: \
no-common-ligatures" class="">&nbsp;0 drwxr-xr-x&nbsp; 108 jacquesmenu&nbsp; \
staff&nbsp; 3456 Feb 25 07:46 ..</span></div><div style="margin: 0px; font-stretch: \
normal; line-height: normal;" class=""><span style="font-variant-ligatures: \
no-common-ligatures" class="">16 -rw-r--r--@ &nbsp; 1 jacquesmenu&nbsp; staff&nbsp; \
6148 Feb 25 12:51 .DS_Store</span></div><div style="margin: 0px; font-stretch: \
normal; line-height: normal;" class=""><span style="font-variant-ligatures: \
no-common-ligatures" class="">&nbsp;8 -rw-r--r--&nbsp; &nbsp; 1 jacquesmenu&nbsp; \
staff&nbsp; 2634 Apr 22&nbsp; 2021 HumdrumScotKeys.xml</span></div><div \
style="margin: 0px; font-stretch: normal; line-height: normal;" class=""><span \
style="font-variant-ligatures: no-common-ligatures" class="">&nbsp;0 lrwxr-xr-x&nbsp; \
&nbsp; 1 jacquesmenu&nbsp; staff&nbsp; &nbsp; 11 Feb 25 14:12 Makefile -&gt; \
../Makefile</span></div><div style="margin: 0px; font-stretch: normal; line-height: \
normal;" class=""><span style="font-variant-ligatures: no-common-ligatures" \
class="">&nbsp;0 drwxr-xr-x&nbsp; &nbsp; 3 jacquesmenu&nbsp; staff&nbsp; &nbsp; 96 \
Feb 25 16:14 lilypond</span></div><div style="margin: 0px; font-stretch: normal; \
line-height: normal;" class=""><span style="font-variant-ligatures: \
no-common-ligatures" class="">&nbsp;0 drwxr-xr-x&nbsp; &nbsp; 4 jacquesmenu&nbsp; \
staff &nbsp; 128 Feb 25 16:14 pdflily</span></div><div style="margin: 0px; \
font-stretch: normal; line-height: normal; min-height: 15px;" class=""><span \
style="font-variant-ligatures: no-common-ligatures" class=""></span><br \
class=""></div><div style="margin: 0px; font-stretch: normal; line-height: normal;" \
class=""><span style="font-variant-ligatures: no-common-ligatures" \
class="">./lilypond:</span></div><div style="margin: 0px; font-stretch: normal; \
line-height: normal;" class=""><span style="font-variant-ligatures: \
no-common-ligatures" class="">total 8</span></div><div style="margin: 0px; \
font-stretch: normal; line-height: normal;" class=""><span \
style="font-variant-ligatures: no-common-ligatures" class="">0 drwxr-xr-x&nbsp; 3 \
jacquesmenu&nbsp; staff&nbsp; &nbsp; 96 Feb 25 16:14 .</span></div><div \
style="margin: 0px; font-stretch: normal; line-height: normal;" class=""><span \


["Makefile" (Makefile)]

#
# Makefile for testing the musicformats library' xml2ly (or musicxml2ly, by the way)
#

xmlfiles          = $(shell find . -name "*.xml")
xmllily           = $(shell find . -name "*.xml")

lilyout           := $(xmllily:./%.xml=lilypond/%.ly)

pdflily           := $(patsubst ./%.xml, pdflily/%.pdf, $(xmlfiles))
pnglily           := $(patsubst ./%.xml, pnglily/%.png, $(xmlfiles))
midilily          := $(patsubst ./%.xml, pdflily/%.midi, $(xmlfiles))

validlily 	      = $(patsubst %.ly, %.outly, $(lilyout))

# In makefiles, $@ is the name of the target being generated,
# and $< the first prerequisite (usually a source file).
# You can find a list of all these special variables in the GNU Make manual

MAKE      ?= make

XML2LY    ?= xml2ly
#XML2LY    ?= time xml2ly
#XML2LY    ?= musicxml2ly
#XML2LY    ?= time musicxml2ly

OPTIONS   ?= -q

#LILYPOND  ?= /opt/local/bin/lilypond
  # 2.23.5 (running Guile 1.8)

LILYPOND  ?= /Applications/LilyPond/lilypond-2.23.6/bin/lilypond
  # 2.23.6 (running Guile 2.2)

.PHONY: lilyignored lily
.DELETE_ON_ERROR:

all:
	@echo "XML2LY   = $(XML2LY)"
	@echo "OPTIONS  = $(OPTIONS)"
	@echo "LILYPOND = $(LILYPOND)"
	@echo

	@#echo "xmlfiles:"
	@#echo "$(xmlfiles)"
	@#echo

	@#echo "xmllily:"
	@#echo "$(xmllily)"
	@#echo

	@#echo "lilyout:"
	@#echo "$(lilyout)"
	@#echo

	@#echo "pdflily:"
	@#echo "$(pdflily)"
	@#echo

	@$(MAKE) pdflily

clean:
	@[ ! -d lilypond ] || rm -r lilypond
	@[ ! -d pdflily ]  || rm -r pdflily
	@[ ! -d pnglilyv ] || rm -r pnglily
	@[ ! -d midilily ] || rm -r midilily

help:
	@echo "Makefile for converting MusicXML files to LilyPond scores."
	@echo "Supplied as part of the MusicFormats library, thanks to Dom Fober for \
providing it."  @echo "Output files are written in sub-folders of the current \
folder."  @echo
	@echo "Available targets are:"
	@echo "  'all' (default) : call the 'lily' target."
	@echo
	@echo "  'lily'          : converts the set of MusicXML files to lilypond in folder \
"  @#echo "  'lilyignored'   : converts a subset of MusicXML files to lilypond, but \
fails as expected"  @echo
	@echo "  'pnglily'       : converts the output of 'lily' target to png in folder \
pnglily"  @echo "  'pdflily'       : converts the output of 'lily' target to pdf in \
folder pdflily"  @echo "  'midilily'      : converts the output of 'lily' target to \
pdf in folder midilily"  @echo
	@echo "  'clean'         : removes the sub-folders containing the results"
	@echo
	@echo "Options:"
	@echo "  'XML2LY=/path/to/xml2ly"
	@echo "  'OPTIONS=..."
	@echo "  'LILYPOND=/path/to/lilypond"
	@echo "  When those options are not specified, the tools are taken from the current \
PATH variable,"  @echo "  and OPTIONS contains '-q' (quiet mode) for xml2ly."

#########################################################################
lily:
	@type $(XML2LY) > /dev/null || (echo "### $(XML2LY) must be available from your \
PATH."; false;)  @$(MAKE) dolily

dolily: $(lilyout)

#########################################################################
lilyclean:
	@echo "lilyout = " $(lilyout) ", " $(shell wc < echo $(lilyout))
	rm $(lilyout)

#########################################################################
pdflily:
	@#type $(XML2LY) || (echo "### $(XML2LY) must be available from your PATH."; false;)
	@echo "$(XML2LY) version is: "
	@$(XML2LY) --version | head -1
	@echo

	@#type $(LILYPOND) || (echo "### lilypond must be available from your PATH."; \
false;)  @echo "lilypond version is: "
	@$(LILYPOND) --version | head -1
	@echo

	@#echo "xmlfiles:"
	@#echo "$(xmlfiles)"
	@#echo

	@#echo "xmllily:"
	@#echo "$(xmllily)"
	@#echo

	@#echo "lilyout:"
	@#echo "$(lilyout)"
	@#echo

	@#echo "pdflily:"
	@#echo "$(pdflily)"
	@#echo

	@$(MAKE) lily
	@$(MAKE) dopdflily

	@echo

	@echo "Contents of lilypond sub-folder:"
	@[[ -d lilypond ]] &&  ls -sal lilypond/*.ly
	@echo

	@echo "Contents of pdflily sub-folder:"
	@[[ -d pdflily ]] &&  ls -sal pdflily/*.pdf
dopdflily: $(pdflily)

#########################################################################
pdflilyclean:
	@echo "pdflily = " $(pdflily) ", " $(shell wc < echo $(pdflily))
	@echo "midilily = " $(midilily) ", " $(shell wc < echo $(midilily))
	rm $(pdflily)
	rm $(midilily)

#########################################################################
pnglily:
	@type $(LILYPOND) || (echo "### lilypond must be available from your PATH."; false;)
	@$(MAKE) lily
	@$(MAKE) dopnglily

dopnglily: $(pnglily)

#########################################################################
pnglilyclean:
	@echo "pnglily = " $(pnglily) ", " $(shell wc < echo $(pnglily))
	rm $(pnglily)
	rm $(midilily)

#########################################################################
validate:
	@echo Validating version $(version) with $(VERSION) $(tmp)
	@$(MAKE) validlily

validlily: $(validlily)

#########################################################################
# rules for XML2LY
lilypond/%.ly: ./%.xml
	@[ -d $(@D) ] || mkdir -p $(@D)
	$(XML2LY) $(OPTIONS) -o "$@" "$<"

#lilyignored/%.ly: ./%.xml
#	@[ -d $(@D) ] || mkdir -p $(@D)
#	$(XML2LY) -q -o $@ $<  || true

#########################################################################
# rules for lilypond with pdf output
pdflily/%.pdf: lilypond/%.ly
	@[ -d $(@D) ] || mkdir -p $(@D)
	$(LILYPOND) --pdf -l NONE -s -o "$(basename $@)" "$<"

#########################################################################
# rules for lilypond with png output
pnglily/%.png: lilypond/%.ly
	@[ -d $(@D) ] || mkdir -p $(@D)
	$(LILYPOND) --png -l NONE -s -o $(basename $@) $<

#########################################################################
# rules for xml output validation
%.outly: %.ly
	$(eval tmp := $(patsubst %, %, $<))
	@[ -f  $(tmp) ] || echo $< : new file
	@diff $<  $(tmp) 2>/dev/null >/dev/null || ([ -f  $(tmp) ] && echo "open -t $< \
$(patsubst %, %, $<) # to check changes"; true)


[Attachment #7 (unknown)]

<html><head><meta http-equiv="Content-Type" content="text/html; \
charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: \
space; line-break: after-white-space;" class=""><div class=""><div style="margin: \
0px; font-stretch: normal; font-size: 13px; line-height: normal; font-family: Menlo;" \
class=""><div style="margin: 0px; font-stretch: normal; line-height: normal;" \
class=""><div class=""><span style="font-variant-ligatures: no-common-ligatures" \
class=""><div class=""></div><div class=""><br class=""></div><div class=""><span \
style="font-variant-ligatures: no-common-ligatures" class=""><br \
class=""></span></div><div class=""><br \
class=""></div></span></div></div></div></div></body></html>



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic