+1.3.130.jcn4
+============
+
+* Makefile template using dependencies: make/ly.make. Needs some
+simple examples.
+
+* Depencies fixes for lilypond, ly2dvi and lilypond-book.
+
1.3.130.jcn3
============
MAJOR_VERSION=1
MINOR_VERSION=3
PATCH_LEVEL=130
-MY_PATCH_LEVEL=jcn3
+MY_PATCH_LEVEL=jcn4
# use the above to send patches: MY_PATCH_LEVEL is always empty for a
# released version.
}
\paper{
linewidth=-1.;
+ \translator {
+ \VoiceContext
+ % If we want to test extreme beams,
+ % we should not have them auto-kneed
+ Beam \override #'auto-knee-gap = ##f
+ }
}
}
/* options */
extern bool dependency_global_b;
+extern String dependency_prefix_global;
extern Array<String> dump_header_fieldnames_global;
extern bool no_paper_global_b;
extern bool no_timestamps_global_b;
/* Write dependencies file? */
bool dependency_global_b = false;
+/* Prepend to dependencies */
+String dependency_prefix_global;
+
/* Names of header fields to be dumped to a separate file. */
Array<String> dump_header_fieldnames_global;
{_i ("DIR"), "include", 'I', _i ("add DIR to search path")},
{_i ("FILE"), "init", 'i', _i ("use FILE as init file")},
{0, "dependencies", 'M', _i ("write Makefile dependencies for every input file")},
+ {_i ("DIR"), "dep-prefix", 'P', _i ("prepend DIR to dependencies")},
{0, "no-paper", 'm', _i ("produce MIDI output only")},
{_i ("NAME"), "output", 'o', _i ("write output to NAME")},
{0, "safe", 's', _i ("inhibit file output naming and exporting")},
{0, "version", 'v', _i ("print version number")},
{0, "verbose", 'V', _i("verbose")},
{0, "warranty", 'w', _i ("show warranty and copyright")},
- {0,0,0, 0}
+ {0,0,0,0}
};
void
format_to_ext (String format)
{
if (format == "tex")
- /* .lytex change in separate (revertable) patch: 1.3.130.jcn4 */
+ /* .lytex change put off */
return "tex"; // "lytex";
return format;
}
case 'f':
output_format_global = oparser_p_static->optional_argument_ch_C_;
break;
+ case 'P':
+ dependency_prefix_global = oparser_p_static->optional_argument_ch_C_;
+ break;
case 'H':
dump_header_fieldnames_global.push (oparser_p_static->optional_argument_ch_C_);
break;
(c) 1997--2000 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
+#include "config.h"
+
+#include <errno.h>
+#include <sys/types.h>
+#if HAVE_SYS_STAT_H
+#include <sys/stat.h>
+#endif
+#include <unistd.h>
+
#include <fstream.h>
#include "main.hh"
#include "score.hh"
f << "# Generated automatically by: " << gnu_lilypond_version_str () << '\n';
String out;
for (int i=0; i < targets.size (); i ++)
- out += targets[i] + " ";
+ out += dependency_prefix_global + targets[i] + " ";
out += ": ";
+#if 0
+ struct stat stat_buf;
+#endif
for (int i=0; i < deps.size (); i ++)
{
if (out.length_i() > WRAPWIDTH)
f << out << "\\\n";
out = " ";
}
- out += " " + deps[i];
+ String dep = deps[i];
+ if (!dependency_prefix_global.empty_b ())
+ {
+#if 0//thinko?
+ if (stat (dep.ch_C (), &stat_buf) == -1 && errno == ENOENT)
+ ; //make emacs happy
+#else
+ if (dep.index_i ('/') < 0)
+#endif
+ dep = dependency_prefix_global + dep;
+ }
+ out += " " + dep;
}
f << out << endl;
}
export PATH:=$(topdir)/lily/out:$(topdir)/buildscripts/out:$(PATH)
-# Huh, PATHSEP, but still '/' for dirsep?
-# Doesn't make sense.
-ifeq (0,1)
+export MFINPUTS:=$(topdir)/mf/:$(MFINPUTS)::
+export TEXINPUTS:=$(topdir)/mf/out/:$(topdir)/tex/:$(topdir)/ps/:$(TEXINPUTS):$(pwd)::
+export LILYINCLUDE:=$(topdir)/ps:$(topdir)/scm:$(topdir)/ly:$(topdir)/mf/out::$(TEX_TFMDIR):$(LILYINCLUDE)
+
+export LILYPONDPREFIX:=$(depth)/
+
+
+the-script-dir=$(wildcard $(script-dir))
-export MFINPUTS:=$(topdir)/mf/$(PATHSEP)$(MFINPUTS)$(PATHSEP)$(PATHSEP)
-export TEXINPUTS:=$(topdir)/mf/out/$(PATHSEP)$(topdir)/tex/$(PATHSEP)$(topdir)/ps/$(PATHSEP)$(TEXINPUTS)$(PATHSEP)$(pwd)$(PATHSEP)$(PATHSEP)
-export LILYINCLUDE:=$(topdir)/ps$(PATHSEP)$(topdir)/scm$(PATHSEP)$(topdir)/ly$(PATHSEP)$(topdir)/mf/out$(PATHSEP)$(PATHSEP)$(TEX_TFMDIR)$(PATHSEP)$(LILYINCLUDE)
+ifneq ($(the-script-dir),)
+
+$(message running from source tree stepmake)
+
+ABC2LY = $(script-dir)/abc2ly.py
+CONVERT_LY = $(script-dir)/convert-ly.py
+LY2DVI = $(script-dir)/ly2dvi.py
+LILYPOND_BOOK = $(script-dir)/lilypond-book.py
+LILYPOND_BOOK_INCLUDES = -I $(pwd) -I $(input-dir)/tricks/ -I $(input-dir)/regression/ -I $(input-dir)/test/
+PS_TO_GIFS = $(buildscript-dir)/ps-to-gifs.sh
+PS_TO_PNGS = $(buildscript-dir)/ps-to-pgns.sh
else
-export MFINPUTS:=$(topdir)/mf/:$(MFINPUTS)::
-export TEXINPUTS:=$(topdir)/mf/out/:$(topdir)/tex/:$(topdir)/ps/:$(TEXINPUTS):$(pwd)::
-export LILYINCLUDE:=$(topdir)/ps:$(topdir)/scm:$(topdir)/ly:$(topdir)/mf/out::$(TEX_TFMDIR):$(LILYINCLUDE)
+$(message running from installed stepmake)
+
+ABC2LY = $(shell $(SHELL) -c 'type -p abc2ly')
+LY2DVI = $(shell $(SHELL) -c 'type -p ly2dvi')
+CONVERT_LY = $(shell $(SHELL) -c 'type -p convert-ly')
+LILYPOND_BOOK = $(shell $(SHELL) -c 'type -p lilypond-book')
+LILYPOND_BOOK_INCLUDES = -I. -I.. -I$(outdir)
+PS_TO_GIFS = $(shell $(SHELL) -c 'type -p ps-to-gifs')
+PS_TO_PNGS = $(shell $(SHELL) -c 'type -p ps-to-pgns')
endif
-export LILYPONDPREFIX:=$(depth)/
$(outdir)/%.latex: %.doc
rm -f $@
- LILYPONDPREFIX=$(LILYPONDPREFIX)/.. $(PYTHON) $(script-dir)/lilypond-book.py --outdir=$(outdir) -I $(pwd) -I $(input-dir)/tricks/ -I $(input-dir)/regression/ -I $(input-dir)/test/ --dependencies $<
+# LILYPONDPREFIX=$(LILYPONDPREFIX)/.. $(PYTHON) $(LILYPOND_BOOK) $(LILYPOND_BOOK_INCLUDES) --dependencies --outdir=$(outdir) $<
+ $(PYTHON) $(LILYPOND_BOOK) $(LILYPOND_BOOK_INCLUDES) --dependencies --outdir=$(outdir) $<
chmod -w $@
# don't do ``cd $(outdir)'', and assume that $(outdir)/.. is the src dir.
# it is not, for --srcdir builds
$(outdir)/%.texi: %.tely
rm -f $@
- LILYPONDPREFIX=$(LILYPONDPREFIX)/.. $(PYTHON) $(script-dir)/lilypond-book.py --outdir=$(outdir) -I $(pwd) -I $(input-dir)/tricks/ -I $(input-dir)/regression/ -I $(input-dir)/test/ --dependencies --format=texi $<
+# LILYPONDPREFIX=$(LILYPONDPREFIX)/.. $(PYTHON) $(LILYPOND_BOOK) $(LILYPOND_BOOK_INCLUDES) --dependencies --outdir=$(outdir) --format=texi $<
+ $(PYTHON) $(LILYPOND_BOOK) $(LILYPOND_BOOK_INCLUDES) --dependencies --outdir=$(outdir) --format=texi $<
chmod -w $@
# nexi: no-lily texi
# for plain info doco: don't run lily
$(outdir)/%.nexi: %.tely
rm -f $@
- LILYPONDPREFIX=$(LILYPONDPREFIX)/.. $(PYTHON) $(script-dir)/lilypond-book.py --outdir=$(outdir) --no-lily -I $(pwd) -I $(input-dir)/tricks/ -I $(input-dir)/regression/ -I $(input-dir)/test/ --dependencies --format=texi $<
+# LILYPONDPREFIX=$(LILYPONDPREFIX)/.. $(PYTHON) $(LILYPOND_BOOK) $(LILYPOND_BOOK_INCLUDES) --dependencies --outdir=$(outdir) --format=texi --no-lily $<
+ $(PYTHON) $(LILYPOND_BOOK) $(LILYPOND_BOOK_INCLUDES) --dependencies --outdir=$(outdir) --format=texi --no-lily $<
mv $(@D)/$(*F).texi $@
chmod -w $@
#!/usr/bin/make
-# Mutopia Makefile Project
-#
-
-#
-# For testing installed lily
-#
-make-root=$(wildcard $(HOME)/tmp/test/usr/share/lilypond/make)
-#make-root=$(wildcard $(HOME)/usr/src/lilypond/make)
-make-root?=$(wildcard /usr/share/lilypond/make)
-
-ifneq ($(make-root),)
-
-depth=$(make-root)/..
-LOCALSTEPMAKE_TEMPLATES=mutopia
-include $(make-root)/stepmake.make
-
-else
- burp
#
-# Minimalistic standalone part. I'd very much like to install make/*
-# and stepmake/stepmake/* in /usr/share/lilypond, and junk this.
-#
-
-outdir=out
-PAPERSIZE=
-LY_FILES=$(wildcard *.ly)
-
-default:
- echo $(DEP_FILES)
- $(examples)
-clean:
- rm -f $(outdir)/* $(outdir)-letter/*
-
-
-#
-# stepmake/stepmake/files.ly
-#
-DEP_FILES:=$(wildcard $(outdir)/*.dep)
-
-#
-# stepmake/stepmake/generic-targets.make
-#
-include $(outdir)/dummy.dep $(DEP_FILES)
-
-$(outdir)/dummy.dep:
- -mkdir -p $(outdir)
- touch $(outdir)/dummy.dep
-
+# Mutopia Makefile Project
#
-# make/mutopia-rules.make
+# Rename this file to GNUmakefile, and issue `make help'
#
-# don't junk intermediate .dvi files. They're easier to view than
-# .ps or .png
-.PRECIOUS: $(outdir)/%.dvi
#
-# should we dist ps-to-pngs?
+# Magic: find and include LilyPond's StepMake rules
#
-$(outdir)/%.png: $(outdir)/%.ps
- ps-to-pngs $<
- -mv $(name-stem)-page*.png $(outdir)/
- touch $@
-
-$(outdir)/%.dvi: %.ly
- ly2dvi --outdir=$(outdir) --dependencies $<
- -mv $(basename $<)*.midi $(outdir)
-
-$(outdir)-$(PAPERSIZE)/%.dvi: %.ly
- ly2dvi.py --outdir=$(outdir)-$(PAPERSIZE) --dependencies --papersize=$(PAPERSIZE) $<
- -mv $(basename $<)*.midi $(outdir)-$(PAPERSIZE)
-
-
+# First, try source tree
+# Second, try installed tree in $HOME
+# Third, try system installed tree
#
-# stepmake/stepmake/tex-rules.make
#
-$(outdir)/%.tex: %.tex
- cp $< $@
-
-$(outdir)/%.dvi: $(outdir)/%.tex
- (cd $(outdir); tex \\nonstopmode \\input $(<F))
-
-$(outdir)/%.dvi: $(outdir)/%.latex
- (cd $(outdir)&& \
- latex \\nonstopmode \\input $(<F)&&\
- (bibtex $(basename $(<F)) || true) && \
- latex \\nonstopmode \\input $(<F)&&\
- (makeindex $(basename $(<F)) || true) && \
- latex \\nonstopmode \\input $(<F) )
-
-$(outdir)/%.ps: $(outdir)/%.dvi
- cd $(outdir) && dvips -ta4 -o $(@F) $(<F)
-
-$(outdir)-$(PAPERSIZE)/%.ps: $(outdir)-$(PAPERSIZE)/%.dvi
- cd $(outdir) && dvips -t$(PAPERSIZE) -o $(@F) $(<F)
-
-
+##For testing installed lily
+##make-root=$(wildcard $(HOME)/tmp/test/usr/share/lilypond/make)
#
-# make/ly-rules.make
#
-
-$(outdir)/%.latex: %.doc
- rm -f $@
- lilypond-book --outdir=$(outdir) --dependencies $<
- chmod -w $@
-
+make-root=$(wildcard $(HOME)/usr/src/lilypond/make)
+make-root?=$(wildcard /usr/share/lilypond/make)
+make-root?=$(wildcard /usr/share/lilypond/make)
+ifneq ($(make-root),)
+$(message running from $(make-root))
+depth=$(make-root)/..
+LOCALSTEPMAKE_TEMPLATES=ly mutopia
+include $(make-root)/stepmake.make
+else
+$(error can't find LilyPond's stepmake installation)
endif
+#
#
# This needs some work.
#
-
parts=$(patsubst %.ly,%,$(wildcard *-part.ly))
-
-tarball=coriolan
-mutopia-examples=coriolan $(parts)
-mutopia-letter=$(mutopia-examples:%=out-letter/%.ps.gz)
-
-
-mutopia:
- $(MAKE) examples="$(mutopia-examples)" PAPERSIZE=letter local-WWW $(mutopia-letter)
+tarball=$(name)
+mutopia-examples=$(name)
$(outdir)/%.gif: $(outdir)/%.ps
- sh $(buildscript-dir)/ps-to-gifs.sh $<
+ sh $(PS_TO_GIFS) $<
-mv $(name-stem)-page*.gif $(outdir)/
touch $@
$(outdir)/%.png: $(outdir)/%.ps
- sh $(buildscript-dir)/ps-to-pngs.sh $<
+ sh $(PS_TO_PNGS) $<
-mv $(name-stem)-page*.png $(outdir)/
touch $@
ln -f $< $@
$(outdir)/%.ly: %.abc
- $(PYTHON) $(script-dir)/abc2ly.py -o $@ $<
+ $(PYTHON) $(ABC2LY) -o $@ $<
$(outdir)/%.dvi: $(outdir)/%.ly
- $(PYTHON) $(script-dir)/ly2dvi.py --outdir=$(outdir) --dependencies $<
+ $(PYTHON) $(LY2DVI) --outdir=$(outdir) --dependencies $<
-mv $(basename $(<F))*.midi $(outdir)
# don't junk intermediate .dvi files. They're easier to view than
.PRECIOUS: $(outdir)/%.dvi
$(outdir)/%.dvi: %.ly
- $(PYTHON) $(script-dir)/ly2dvi.py --outdir=$(outdir) --dependencies $<
+ $(PYTHON) $(LY2DVI) --outdir=$(outdir) --dependencies $<
-mv $(basename $<)*.midi $(outdir)
$(outdir)-$(PAPERSIZE)/%.dvi: %.ly
- $(PYTHON) $(script-dir)/ly2dvi.py --outdir=$(outdir)-$(PAPERSIZE) --dependencies --papersize=$(PAPERSIZE) $<
+ $(PYTHON) $(LY2DVI) --outdir=$(outdir)-$(PAPERSIZE) --dependencies --papersize=$(PAPERSIZE) $<
-mv $(basename $<)*.midi $(outdir)-$(PAPERSIZE)
$(outdir)/%.dvi: %.fly
- $(PYTHON) $(script-dir)/ly2dvi.py -o $(outdir) $<
+ $(PYTHON) $(LY2DVI) -o $(outdir) $<
-mv $(basename $<)*.midi $(outdir)
+.PHONY: mutopia png ps scores tar
all: $(OUT_FILES)
local-WWW: $(ly_examples) $(fly_examples) $(ps_examples) $(png_examples)
-# (cd $(outdir); $(PYTHON) ../$(buildscript-dir)/mutopia-index.py --prefix=../ --suffix=/$(outdir) $(html_subdirs) $(all_examples))
-# $(footify) $(outdir)/index.html
local-web:
$(MAKE) conf=www local-WWW
$(LOOP)
local-convert-ly:
- $(PYTHON) $(script-dir)/convert-ly.py -e *ly
+ $(PYTHON) $(CONVERT_LY) -e *ly
tar:
mkdir -p $(outdir)/$(tarball)
cp -p *.ly $(outdir)/$(tarball)
cd $(outdir) && tar czf $(tarball).tar.gz $(tarball)
+
+png: $(png_examples)
+
+ps: $(ps_examples)
+
+scores: $(score_ps)
+ $(MAKE) ps_examples="$<" ps
+
+mutopia-letter=$(mutopia-examples:%=out-letter/%.ps.gz)
+
+mutopia:
+ $(MAKE) examples="$(mutopia-examples)" PAPERSIZE=letter local-WWW $(mutopia-letter)
+
+local-help:
+ @echo -e "\
+ convert-ly convert all LilyPond sources\n\
+ mutopia update PNGs, PostScript a4 and letter of all mutopia-examples\n\
+ png update PNGs of all examples\n\
+ ps update PostScript of all examples\n\
+ scores update PostScript of all scores\n\
+"\
+#
include $(make-dir)/lilypond-vars.make
LY_FILES = $(wildcard *.ly)
+SCORE_LY_FILES = $(shell fgrep -l score *.ly)
+
FLY_FILES = $(wildcard *.fly)
SLY_FILES = $(wildcard *.sly)
OUT_FILES = $(addprefix $(outdir)/,$(M4_FILES:%.m4=%)) \
$(addprefix $(outdir)/,$(LYM4_FILES:%.lym4=%.ly))
+
+score_ps = $(addprefix $(outdir)/, $(addsuffix .ps.gz, $($SCORE_LY_FILES)))
\ No newline at end of file
depth = ../..
# do Coriolan if you have plenty RAM / CPU / quotum
-examples=
+# examples=coriolan
-examples=
LOCALSTEPMAKE_TEMPLATES=mutopia
include $(depth)/make/stepmake.make
tarball=coriolan
mutopia-examples=coriolan $(parts)
-mutopia-letter=$(mutopia-examples:%=out-letter/%.ps.gz)
-mutopia:
- $(MAKE) examples="$(mutopia-examples)" PAPERSIZE=letter local-WWW $(mutopia-letter)
+
return st
def compile_all_files (chunks):
+ global foutn
eps = []
tex = []
png = []
x = os.path.join (g_here_dir, x)
return ' -I %s' % x
- incs = map (incl_opt, include_path)
+ incs = map (incl_opt, include_path)
lilyopts = string.join (incs, ' ' )
- texfiles = string.join (tex, ' ')
if do_deps:
lilyopts = lilyopts + ' --dependencies '
- #system ('touch %s' % texfiles)
+ if g_outdir:
+ lilyopts = lilyopts + '--dep-prefix=' + g_outdir + '/'
+ texfiles = string.join (tex, ' ')
system ('lilypond --header=texidoc %s %s' % (lilyopts, texfiles))
#
- # Ugh, fixing up dependencies for outdir/ and .tex generation
+ # Ugh, fixing up dependencies for .tex generation
#
if do_deps:
depfiles=map (lambda x: re.sub ('(.*)\.ly', '\\1.dep', x), tex)
for i in depfiles:
text=open (i).read ()
- text=re.sub ('\n([^:\n]*):', '\n' + g_outdir + '/' + foutn + ':', text)
- text=re.sub (' ([^ /\n]*).ly', ' ' + g_outdir + '/\\1.ly', text)
+ text=re.sub ('\n([^:\n]*):', '\n' + foutn + ':', text)
open (i, 'w').write (text)
for e in eps:
cmd = r"""gs -sDEVICE=pgm -dTextAlphaBits=4 -dGraphicsAlphaBits=4 -q -sOutputFile=- -r90 -dNOPAUSE %s -c quit | pnmcrop | pnmtopng > %s"""
cmd = cmd % (g + '.eps', g + '.png')
system (cmd)
- if g_outdir:
- os.chdir(d)
+ os.chdir (d)
def update_file (body, name):
def write_deps (fn, target, chunks):
global read_files
- sys.stdout.write('writing `%s\'\n' % os.path.join(g_outdir, fn))
+ sys.stdout.write('Writing `%s\'\n' % os.path.join(g_outdir, fn))
f = open (os.path.join(g_outdir, fn), 'w')
f.write ('%s%s: ' % (g_dep_prefix, target))
for d in read_files:
for d in basenames:
if g_outdir:
d=g_outdir + '/' + d
+ if g_dep_prefix:
+ #if not os.isfile (d): # thinko?
+ if not re.search ('/', d):
+ d = g_dep_prefix + d
f.write ('%s.tex ' % d)
f.write ('\n')
#if len (basenames):
return newchunks
+foutn=""
def do_file(input_filename):
global foutn
file_settings = {}
scan_preamble(chunks)
chunks = process_lilypond_blocks(my_outname, chunks)
+ foutn = os.path.join (g_outdir, my_outname + '.' + format)
+
# Do It.
if __main__.g_run_lilypond:
compile_all_files (chunks)
x = 0
chunks = completize_preamble (chunks)
- foutn = os.path.join(g_outdir, my_outname + '.' + format)
sys.stderr.write ("Writing `%s'\n" % foutn)
fout = open (foutn, 'w')
for c in chunks:
inc = ''
if len(Props.get('include')) > 0:
inc = string.join (map (lambda x: '-I "%s"' % x, Props.get('include')))
- else:
-
- if Props.get('dependencies'):
- dep=' --dependencies'
- else:
- dep=''
- return inc + dep
- return inc
+ dep=''
+ if Props.get('dependencies'):
+ dep=' --dependencies'
+ return inc + dep
def writeLilylog(file,contents):
if Props.get('keeplilypond'):
outdir=Props.get ('output')
for i in depFiles:
text=open (i).read ()
- # brr
- # text=re.sub ('\n([^:]*:)', '\n' + outdir + '/\\1', text)
+ # ugh, should use lilypond -o DIR/foo.tex
+ # or --dep-prefix to fix dependencies
text=re.sub ('\n([^:]*).tex', '\n' + outdir + '/\\1.dvi', text)
text=re.sub (' ([^:]*).tex', ' ' + outdir + '/\\1.dvi', text)
open (os.path.join (outdir, i), 'w').write (text)
# title generic make targets
# file make/Targets.make
-.PHONY : all clean config default dist doc exe help html lib TAGS\
+.PHONY : all clean config default diff dist doc exe help html lib TAGS\
po
all: default
generic-help:
@echo -e "\
Makefile for $(PACKAGE_NAME) $(TOPLEVEL_VERSION)\n\
-Usage: $(MAKE) ["VARIABLE=value"]... [TARGET]\n\
+Usage: make ["VARIABLE=value"]... [TARGET]\n\
\n\
Targets:\n"
help: generic-help local-help
@echo -e "\
all update everything\n\
- clean remove all genated stuff in $(oudir)\n\
+ clean remove all genated stuff in $(outdir)\n\
config rerun configure\n\
deb build Debian package\n\
default same as the empty target\n\