+1.3.130.jcn2
+============
+
+////* Changed default output extension to ".lytex".
+
+* Ignore outname = ; settings in output blocks.
+
+* Revised input and output naming, now it's possible to include a
+directory in the output name. This should fix some input/init name
+related bugs.
+
+* Fixed dependencies for outdir in lilypond-book and ly2dvi.
+
+* Uniformised tags to read: Generated automatically by: <program>.
+
+* Install make/* and stepmake/stepmake/* to enable making use of
+stepmake templates.
+
+* Added example mutopia makefile: make/ly.make.
+
+* Lilypond-book now writes lily-<HASH>.ly files.
+
1.3.130.jcn1
============
IN_FILES := $(wildcard *.in)
EXTRA_DIST_FILES = lilypond-font-lock.el lilypond-mode.el vimrc VERSION $(README_FILES) $(SCRIPTS) $(IN_FILES)
NON_ESSENTIAL_DIST_FILES = $(README_TXT_FILES)
+INSTALLATION_DIR=$(datadir)
+INSTALLATION_FILES=config.make VERSION
# bootstrap stepmake:
#
-STEPMAKE_TEMPLATES=toplevel yolily-toplevel po
+STEPMAKE_TEMPLATES=toplevel yolily-toplevel po install
include $(depth)/make/stepmake.make
#
MAJOR_VERSION=1
MINOR_VERSION=3
PATCH_LEVEL=130
-MY_PATCH_LEVEL=jcn1
+MY_PATCH_LEVEL=jcn2
# use the above to send patches: MY_PATCH_LEVEL is always empty for a
# released version.
+dnl WARNING WARNING WARNING WARNING
+dnl do not edit! this is aclocal.m4, generated from stepmake/aclocal.m4
dnl aclocal.m4 -*-shell-script-*-
dnl StepMake subroutines for configure.in
ZIP="zip -r -9" #
program_suffix=.exe
# urg
+ # ROOTSEP=':'
# DIRSEP='\\'
# PATHSEP=';'
#
# this way, you may have buildscripts/out/lilypond-profile
# 'automatically' sourced from /usr/etc/profile.d/ too.
#
+ ROOTSEP=':'
DIRSEP='/'
PATHSEP=':'
INSTALL="\$(SHELL) \$(stepdir)/../bin/install-dot-exe.sh -c"
else
+ ROOTSEP='/'
DIRSEP='/'
PATHSEP=':'
LN=ln
METAPOST = @METAPOST@
MFPLAIN_MP = @MFPLAIN_MP@
MSGFMT = @MSGFMT@
+ROOTSEP = @ROOTSEP@
PATHSEP = @PATHSEP@
PERL = @PERL@
PYTHON = @PYTHON@
#include "file-path.hh"
#include "flower-debug.hh"
+#ifndef PATHSEP
+#define PATHSEP ':'
+#endif
+
+#ifndef ROOTSEP
+#define ROOTSEP '/'
+#endif
+
#ifndef DIRSEP
#define DIRSEP '/'
#endif
-#ifndef PATHSEP
-#define PATHSEP ':'
+#ifndef EXTSEP
+#define EXTSEP '.'
#endif
+String
+Path::path () const
+{
+ String s;
+ if (!root.empty_b ())
+ s = root + to_str (ROOTSEP);
+ if (!dir.empty_b ())
+ s += dir + to_str (DIRSEP);
+ s += base;
+ if (!ext.empty_b ())
+ s += to_str (EXTSEP) + ext;
+ return s;
+}
+
/**
@param path the original full filename
@return 4 components of the path. They can be empty
*/
-void
-split_path (String path,
- String &drive, String &dirs, String &filebase, String &extension)
+Path
+split_path (String path)
{
- // peel off components, one by one.
- int di = path.index_i (':');
- if (di >= 0)
+ Path p;
+ int i = path.index_i (ROOTSEP);
+ if (i >= 0)
{
- drive = path.left_str (di + 1);
- path = path.right_str (path.length_i () - di -1);
+ p.root = path.left_str (i);
+ path = path.right_str (path.length_i () - i - 1);
}
- else
- drive = "";
- di = path.index_last_i (DIRSEP);
- if (di >=0)
+ i = path.index_last_i (DIRSEP);
+ if (i >= 0)
{
- dirs = path.left_str (di + 1);
- path = path.right_str (path.length_i ()-di -1);
+ p.dir = path.left_str (i);
+ path = path.right_str (path.length_i () - i - 1);
}
- else
- dirs = "";
- di = path.index_last_i ('.');
- if (di >= 0)
+ i = path.index_last_i ('.');
+ if (i >= 0)
{
- filebase = path.left_str (di);
- extension =path.right_str (path.length_i ()-di);
+ p.base = path.left_str (i);
+ p.ext = path.right_str (path.length_i () - i - 1);
}
else
- {
- extension = "";
- filebase = path;
- }
+ p.base = path;
+ return p;
}
void
*/
+class Path
+{
+public:
+ String root;
+ String dir;
+ String base;
+ String ext;
+
+ String path () const;
+};
+
class File_path : private Array<String>
{
public:
@return
String &drive, String &dirs, String &filebase, String &extension
*/
-void split_path (String path, String &drive, String &dirs, String &filebase, String &extension);
+Path split_path (String path);
#endif
extern int exit_status_i_;
extern bool experimental_features_global_b;
-extern char const* output_global_ch;
extern bool dependency_global_b;
extern bool verbose_global_b;
*/
extern Array<String> global_dumped_header_fieldnames;
-extern String default_outname_base_global;
-extern String default_outname_suffix_global;
+extern String outname_global;
+extern String outext_global;
extern int default_count_global;
extern All_font_metrics *all_fonts_global_p;
Global_translator *get_global_translator_p ();
Translator_group *get_group_translator_p (String type) const;
- String get_default_output () const;
void assign_translator (SCM transdef);
SCM find_translator_l (SCM name) const;
- String base_output_str () ;
+ String outname_str () ;
DECLARE_SMOBS(Music_output_def,);
};
bool no_timestamps_global_b = false;
bool find_old_relative_b = false;
-char const* output_global_ch = "tex";
All_font_metrics *all_fonts_global_p;
-String default_outname_base_global = "lelie";
-String outname_str_global;
-String init_str_global;
+String outname_global;
+// Hmm:
+// (lytex-scm (quote all-definitions))
+// String outext_global = "lytex";
+String outext_global = "tex";
+String init_name_global;
+
+// default? count
int default_count_global;
File_path global_path;
Getopt_long * oparser_global_p = 0;
-String distill_inname_str (String name_str, String& ext_r);
+Path distill_inname (String name_str);
/*
Internationalisation kludge in two steps:
{_i ("FILE"), "init", 'i', _i ("use FILE as init file")},
{0, "dependencies", 'M', _i ("write Makefile dependencies for every input file")},
{0, "no-paper", 'm', _i ("produce MIDI output only")},
- {_i ("BASENAME"), "output", 'o', _i ("write output to BASENAME[-x].extension")},
+ {_i ("NAME"), "output", 'o', _i ("write output to NAME")},
{0, "find-old-relative", 'Q', _i ("show all changes in relative syntax")},
{0, "safe", 's', _i ("inhibit file output naming and exporting")},
{0, "no-timestamps", 'T', _i ("don't timestamp the output")},
cout << endl;
call_constructors ();
- default_outname_base_global = "lelie";
all_fonts_global_p = new All_font_metrics (global_path.str ());
-
+
int p=0;
const char *arg ;
- while ((arg= oparser_global_p->get_next_arg ()))
+ while ((arg = oparser_global_p->get_next_arg ()) || p == 0)
{
+ String infile;
- if (outname_str_global == "")
- {
- Midi_def::reset_default_count ();
- Paper_def::reset_default_count ();
- }
- String f (arg);
- String i;
- f = distill_inname_str (f, i);
- if (f == "-")
- default_outname_base_global = "-";
+ if (arg)
+ infile = arg;
else
- {
- String a,b,c,d;
- split_path (f, a, b, c, d);
- default_outname_base_global = c;
- }
- if (outname_str_global.length_i ())
- default_outname_base_global = outname_str_global;
- if (init_str_global.length_i ())
- i = init_str_global;
+ infile = "-";
+
+ // What/when was this supposed to do?
+ // It looks like it reset the outname_str_global for every new
+ // file, but only if user didn't specify a outname? Huh?
+ // if (outname_str_global == "")
+ {
+ Midi_def::reset_default_count ();
+ Paper_def::reset_default_count ();
+ }
+
+ Path inpath = distill_inname (infile);
+ Path outpath = inpath;
+ outpath.ext = outext_global;
+ if (!outname_global.empty_b ())
+ outpath = split_path (outname_global);
+
+ String init;
+ if (!init_name_global.empty_b ())
+ init = init_name_global;
else
- i = "init" + i;
- do_one_file (i, f);
+ init = "init." + inpath.ext;
+
+ /* Burp: output name communication goes through _global */
+ String save_outname_global = outname_global;
+ outname_global = outpath.path ();
+ do_one_file (init, inpath.path ());
+ outname_global = save_outname_global;
p++;
}
- if (!p)
- {
- String i;
- if (init_str_global.length_i ())
- i = init_str_global;
- else
- i = "init.ly";
- default_outname_base_global = "-";
- if (outname_str_global.length_i ())
- default_outname_base_global = outname_str_global;
- do_one_file (i, default_outname_base_global);
- }
delete oparser_global_p;
- exit( exit_status_i_);
+ exit (exit_status_i_);
}
switch (opt->shortname_ch_)
{
case 'v':
- version();
+ version ();
exit (0); // we print a version anyway.
break;
case 't':
progress_indication ("*** enabling experimental features, you're on your own now ***\n");
break;
case 'o':
- outname_str_global = oparser_global_p->optional_argument_ch_C_;
+ {
+ String s = oparser_global_p->optional_argument_ch_C_;
+ Path p = split_path (s);
+ if (p.ext.empty_b ())
+ p.ext = outext_global;
+ outname_global = p.path ();
+ }
break;
case 'w':
notice ();
exit (0);
break;
case 'f':
- output_global_ch = oparser_global_p->optional_argument_ch_C_;
+ outext_global = oparser_global_p->optional_argument_ch_C_;
break;
case 'Q':
find_old_relative_b= true;
global_path.push (oparser_global_p->optional_argument_ch_C_);
break;
case 'i':
- init_str_global = oparser_global_p->optional_argument_ch_C_;
+ init_name_global = oparser_global_p->optional_argument_ch_C_;
break;
case 'h':
usage ();
}
/**
- make input file name from command arg.
+ Make input file name from command argument.
- @input file name
-
- @output file name with added default extension. "" is stdin.
- in reference argument: the extension. ".ly" if none
+ Path describes file name with added default extension,
+ ".ly" if none. "-" is stdin.
*/
-String
-distill_inname_str (String name_str, String& ext_r)
+Path
+distill_inname (String str)
{
- String str = name_str;
- if (str.length_i ())
+ Path p = split_path (str);
+ if (str.empty_b () || str == "-")
+ p.base = "-";
+ else
{
- if (str != "-")
+ String orig_ext = p.ext;
+ char const *extensions[] = {"ly", "fly", "sly", "", 0};
+ for (int i = 0; extensions[i]; i++)
{
- String a,b,c;
- split_path (str,a,b,c,ext_r);
-
- // add extension if not present.
- char const* extensions[] = {"", ".ly", ".fly", ".sly", "", 0};
- extensions[0] = ext_r.ch_C ();
- for (int i = 0; extensions[i]; i++)
- {
- if (!global_path.find (a+b+c+extensions[i]).empty_b ())
- {
- ext_r = extensions[i];
- break;
- }
- }
- str = a+b+c+ext_r;
- // in any case, assume (init).ly
- if (!ext_r.length_i ())
- ext_r = ".ly";
+ p.ext = orig_ext;
+ if (*extensions[i] && !p.ext.empty_b ())
+ p.ext += ".";
+ p.ext += extensions[i];
+ if (!global_path.find (p.path ()).empty_b ())
+ break;
}
+ /* Reshuffle extension */
+ p = split_path (p.path ());
}
- else
- {
- str = "-";
- ext_r = ".ly";
- }
- return str;
+ return p;
}
#include "global-translator.hh"
#include "translator-def.hh"
#include "main.hh"
+#include "file-path.hh"
#include "lily-guile.hh"
#include "ly-smobs.icc"
return dynamic_cast <Global_translator *> (tg);
}
-
-
-String
-Music_output_def::get_default_output () const
-{
- if (safe_global_b || !scope_p_->elem_b ("output"))
- return "";
- SCM s = scope_p_->scm_elem ("output");
-
- return gh_string_p (s) ? ly_scm2string (s) : String ("");
-}
-
-
-
int
Music_output_def::print_smob (SCM s, SCM p, scm_print_state *)
{
ugh: should move into Music_output_def (complication: .midi and .tex
need separate counts.) */
String
-Music_output_def::base_output_str ()
+Music_output_def::outname_str ()
{
- String str = get_default_output ();
-
- if (str.empty_b ())
+ String out = outname_global;
+ int def = get_next_default_count ();
+ if (def)
{
- str = default_outname_base_global;
- int def = get_next_default_count ();
- if (def)
- str += "-" + to_str (def);
+ Path p = split_path (out);
+ p.base += "-" + to_str (def);
+ out = p.path ();
}
-
- return str;
+ return out;
}
Paper_outputter*
Paper_def::paper_outputter_p ()
{
- String basename = base_output_str ();
- String outname = basename;
- if (outname != "-")
- outname += String (".") + output_global_ch;
+ String outname = outname_str ();
progress_indication (_f ("paper output to %s...",
outname == "-" ? String ("<stdout>") : outname));
target_str_global_array.push (outname);
Paper_outputter * po = new Paper_outputter (outname);
- po->basename_ = basename;
+ Path p = split_path (outname);
+ p.ext = "";
+ po->basename_ = p.path ();
return po;
}
lilypond -f scm x.ly
guile -s x.scm
*/
- verbatim_scheme_b_ = output_global_ch == String ("scm");
+ verbatim_scheme_b_ = outext_global == "scm";
if (verbatim_scheme_b_)
{
gh_define ("security-paranoia", SCM_BOOL_T);
}
- SCM exp = gh_list (ly_symbol2scm ((String (output_global_ch) + "-scm").ch_C()),
+ SCM exp = gh_list (ly_symbol2scm ((outext_global + "-scm").ch_C()),
ly_quote_scm (ly_symbol2scm ("all-definitions")),
SCM_UNDEFINED);
exp = scm_eval2 (exp, SCM_EOL);
(c) 1997--2000 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
+#include <errno.h>
+#include <sys/stat.h>
+#include <sys/types.h>
#include <fstream.h>
#include "main.hh"
#include "paper-stream.hh"
+#include "file-path.hh"
#include "debug.hh"
const int MAXLINELEN = 200;
open_file_stream (String filename)
{
ostream *os;
- if (filename.length_i () && (filename != "-"))
- os = new ofstream (filename.ch_C ());
+ if (!filename.empty_b () && (filename != "-"))
+ {
+ Path p = split_path (filename);
+ if (!p.dir.empty_b ())
+ if (mkdir (p.dir.ch_C (), 0777) == -1 && errno != EEXIST)
+ error (_f ("can't create directory: `%s'", p.dir));
+ os = new ofstream (filename.ch_C ());
+ }
else
os = new ostream (cout._strbuf);
if (!*os)
#include "performance.hh"
#include "score.hh"
#include "file-results.hh"
+#include "file-path.hh"
#include "lily-version.hh"
#include "killing-cons.tcc"
Midi_track midi_track;
// perhaps multiple text events?
+ String id_str;
String str = String (_("Creator: "));
if (no_timestamps_global_b)
- str += gnu_lilypond_str ();
+ id_str = gnu_lilypond_str ();
else
- str += gnu_lilypond_version_str();
+ id_str = gnu_lilypond_version_str();
+ str += id_str;
str += "\n";
/*
Midi_text creator (&creator_a);
midi_track.add (Moment (0), &creator);
- str = _("Automatically generated");
+ str = _("Generated automatically by: ");
+ str += id_str;
if (no_timestamps_global_b)
str += ".\n";
else
void
Performance::process()
{
- String out = midi_l_->get_default_output ();
- if (out.empty_b ())
+ String out = outname_global;
+ if (out == "-")
+ out = "lelie.midi";
+ int def = midi_l_->get_next_default_count ();
+ if (def)
{
-
- out = default_outname_base_global;
- if (out == "-")
- out = "lelie";
- int def = midi_l_->get_next_default_count ();
- if (def)
- {
- out += "-" + to_str (def);
- }
-
- out += ".midi";
+ Path p = split_path (out);
+ p.base += "-" + to_str (def);
+ out = p.path ();
}
Midi_stream midi_stream (out);
{
const int WRAPWIDTH = 65;
- progress_indication (_f ("Writing dependency file: `%s'...", fn.ch_C ()));
+ progress_indication (_f ("dependencies output to %s...", fn.ch_C ()));
progress_indication ("\n");
ofstream f (fn.ch_C ());
if (!f)
warning (_f ("can't open file: `%s'", fn));
- f << "# Automatically generated by " << gnu_lilypond_version_str () << '\n';
+ f << "# Generated automatically by: " << gnu_lilypond_version_str () << '\n';
String out;
for (int i=0; i < targets.size (); i ++)
out += targets[i] + " ";
{
if (dependency_global_b)
{
- write_dependency_file (default_outname_base_global + ".dep", target_str_global_array,
+ Path p = split_path (outname_global);
+ p.ext = "dep";
+ write_dependency_file (p.path (),
+ target_str_global_array,
inclusion_global_array);
}
}
# file make/Makefile
depth = ..
-STEPMAKE_TEMPLATES=makedir
-BLURBS=BLURB # COPERTINA FLAPTEKST
+STEPMAKE_TEMPLATES=makedir install
+##BLURBS=BLURB # COPERTINA FLAPTEKST
+
+INSTALLATION_DIR=$(datadir)/make
+INSTALLATION_FILES=$(DIST_FILES)
include $(depth)/make/stepmake.make
$(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 --dep-prefix=$(outdir)/ $<
+ 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 $<
chmod -w $@
# don't do ``cd $(outdir)'', and assume that $(outdir)/.. is the src dir.
# 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 --dep-prefix=$(outdir)/ --format=texi $<
+ 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 $<
mv $(@D)/$(*F).texi $@
chmod -w $@
--- /dev/null
+#!/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
+
+#
+# make/mutopia-rules.make
+#
+
+# don't junk intermediate .dvi files. They're easier to view than
+# .ps or .png
+.PRECIOUS: $(outdir)/%.dvi
+
+#
+# should we dist ps-to-pngs?
+#
+$(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)
+
+
+#
+# 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)
+
+
+#
+# make/ly-rules.make
+#
+
+$(outdir)/%.latex: %.doc
+ rm -f $@
+ lilypond-book --outdir=$(outdir) --dependencies $<
+ chmod -w $@
+
+endif
+
+
+#
+# Mutopia/user targets.
+# 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)
+
$(PYTHON) $(script-dir)/abc2ly.py -o $@ $<
$(outdir)/%.dvi: $(outdir)/%.ly
- $(PYTHON) $(script-dir)/ly2dvi.py -o $(outdir) $<
+ $(PYTHON) $(script-dir)/ly2dvi.py --outdir=$(outdir) --dependencies $<
-mv $(basename $(<F))*.midi $(outdir)
# don't junk intermediate .dvi files. They're easier to view than
-# .ps or .gif
+# .ps or .png
.PRECIOUS: $(outdir)/%.dvi
$(outdir)/%.dvi: %.ly
- $(PYTHON) $(script-dir)/ly2dvi.py -o $(outdir) $<
+ $(PYTHON) $(script-dir)/ly2dvi.py --outdir=$(outdir) --dependencies $<
-mv $(basename $<)*.midi $(outdir)
$(outdir)-$(PAPERSIZE)/%.dvi: %.ly
- $(PYTHON) $(script-dir)/ly2dvi.py -o $(outdir)-$(PAPERSIZE) -p $(PAPERSIZE) $<
+ $(PYTHON) $(script-dir)/ly2dvi.py --outdir=$(outdir)-$(PAPERSIZE) --dependencies --papersize=$(PAPERSIZE) $<
-mv $(basename $<)*.midi $(outdir)-$(PAPERSIZE)
$(outdir)/%.dvi: %.fly
(define (header creator generate)
(string-append
- "%created by: " creator generate "\n"))
+ "% Generated automatically by: " creator generate "\n"))
(define (invoke-char s i)
(string-append
optstring = string.join (opts, ' ')
optstring = re.sub ('\n', ' ', optstring)
body = r"""
-%% Generated by lilypond-book.py; options are %s %%ughUGH not original options
+%% Generated automatically by: lilypond-book.py
+%% options are %s %%ughUGH not original options
\include "paper%d.ly"
\paper { linewidth = %f \pt; }
""" % (optstring, music_size, l) + body
(type, body, opts) = chunk
assert type == 'lilypond'
file_body = compose_full_body (body, opts)
- basename = `abs(hash (file_body))`
+ basename = 'lily-' + `abs(hash (file_body))`
for o in opts:
m = re.search ('filename="(.*?)"', o)
if m:
incs = map (incl_opt, include_path)
lilyopts = string.join (incs, ' ' )
texfiles = string.join (tex, ' ')
+ if do_deps:
+ lilyopts = lilyopts + ' --dependencies '
+ #system ('touch %s' % texfiles)
system ('lilypond --header=texidoc %s %s' % (lilyopts, texfiles))
+
+ #
+ # Ugh, fixing up dependencies for outdir/ and .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)
+ open (i, 'w').write (text)
+
for e in eps:
system(r"tex '\nonstopmode \input %s'" % e)
system(r"dvips -E -o %s %s" % (e + '.eps', e))
sys.exit (0)
-def write_deps (fn, target):
+def write_deps (fn, target, chunks):
+ global read_files
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 __main__.read_files:
+ for d in read_files:
f.write ('%s ' % d)
+ basenames=[]
+ for c in chunks:
+ if c[0] == 'lilypond':
+ (type, body, opts, todo, basename) = c;
+ basenames.append (basename)
+ for d in basenames:
+ if g_outdir:
+ d=g_outdir + '/' + d
+ f.write ('%s.tex ' % d)
+ f.write ('\n')
+ #if len (basenames):
+ # for d in basenames:
+ # f.write ('%s.ly ' % d)
+ # f.write (' : %s' % target)
f.write ('\n')
f.close ()
- __main__.read_files = []
+ read_files = []
def identify():
sys.stdout.write ('lilypond-book (GNU LilyPond) %s\n' % program_version)
def do_file(input_filename):
+ global foutn
file_settings = {}
if outname:
my_outname = outname
# should chmod -w
if do_deps:
- write_deps (my_depname, foutn)
+ write_deps (my_depname, foutn, chunks)
outname = ''
top= r"""
%% Creator: %s
-%% Automatically generated from %s, %s
+%% Generated automatically by: %s, from %s, at %s
\documentclass[%s]{article}
\renewcommand{\@oddfoot}{\parbox{\textwidth}{\mbox{}\thefooter}}%%
%s
\begin{document}
-""" % ( program_id(), Props.get('filename'), now, Props.get('papersize'),
+""" % ( program_id(), program_id(), Props.get('filename'), now, Props.get('papersize'),
Props.get('language'), Props.get('linewidth'), textheightsetting,
Props.get('orientation'), Props.get('header'), Props.get('pagenumber'))
else:
if Props.get('dependencies'):
- dep=' -M'
+ dep=' --dependencies'
else:
dep=''
return inc + dep
else:
return texfiles
+def getDepFiles (log):
+ files=[]
+ for line in string.split (log,'\n'):
+ m = re.search ("dependencies output to (.+)\.\.\.", line)
+ if m:
+ files.append (m.group (1))
+ return files
+
def unc2dos(path):
"""
Convert a path of format //<drive>/this/that/the/other to
-h,--help this help text
-k,--keeply2dvi keep ly2dvi output files
-l,--language= give LaTeX language (babel)
- -o,--output= set output directory
+ -o,--outdir= set output directory
+ --output= set output directory
-p,--papersize= give LaTeX papersize (eg. a4)
-s,--separate run all files separately through LaTeX
'include=', 'keeplilypond', 'landscape',
'nonumber', 'Width=', 'dependencies',
'help', 'keeply2dvi', 'language=',
- 'output=', 'version', 'papersize=', 'separate',
- 'postscript'])
+ 'outdir=', 'output=', 'version',
+ 'papersize=', 'separate', 'postscript'])
for opt in options:
o = opt[0]
Props.setKeeply2dvi(1,'commandline')
elif o == '--language' or o == '-l':
Props.setLanguage(a,'commandline')
- elif o == '--output' or o == '-o':
+ elif o == '--outdir' or o == '-o' or o == '--output':
Props.setOutput(a,'commandline')
elif o == '--papersize' or o == '-p':
Props.setPaperZize(a,'commandline')
if stat:
sys.exit('ExitBadLily', cmd )
texFiles=getTeXFile(log)
+ depFiles=getDepFiles (log)
writeLilylog(file,log)
Props.addLilyOutputFiles(texFiles,'program')
texInputFiles = texInputFiles + texFiles
firstfile=0
if not Props.get('separate'):
outfile.end()
+
+ # --outdir mess
+ if Props.get ('output'):
+ outdir=Props.get ('output')
+ for i in depFiles:
+ text=open (i).read ()
+ # brr
+ # text=re.sub ('\n([^:]*:)', '\n' + outdir + '/\\1', text)
+ 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)
+ os.remove (i)
+
else:
help()
sys.exit('ExitBadArgs','No files specified')
ifeq ($(PACKAGE),STEPMAKE)
SUBDIRS = bin make stepmake
else
-SUBDIRS =
+SUBDIRS = stepmake
endif
#
include $(depth)/make/stepmake.make
#
+# 2nd: THIS IS NO MISTAKE
+# this makes lilypond's make dist descent into stepmake
+# should check if we can remove the above
# descent order into subdirectories:
#
ifeq ($(PACKAGE),STEPMAKE)
SUBDIRS = bin make stepmake
else
-SUBDIRS =
+SUBDIRS = stepmake
endif
#
ZIP="zip -r -9" #
program_suffix=.exe
# urg
+ # ROOTSEP=':'
# DIRSEP='\\'
# PATHSEP=';'
#
# this way, you may have buildscripts/out/lilypond-profile
# 'automatically' sourced from /usr/etc/profile.d/ too.
#
+ ROOTSEP=':'
DIRSEP='/'
PATHSEP=':'
INSTALL="\$(SHELL) \$(stepdir)/../bin/install-dot-exe.sh -c"
else
+ ROOTSEP='/'
DIRSEP='/'
PATHSEP=':'
LN=ln
#
-include $(depth)/make/stepmake.make
+ifeq ($(PACKAGE),STEPMAKE)
INSTALLATION_DIR=$(datadir)/stepmake
+else
+INSTALLATION_DIR=$(dir $(datadir))/$(package)/stepmake/stepmake
+endif
INSTALLATION_FILES=GNUmakefile $(MAKE_FILES)
# substitute $(STRIP) in Site.make if you want stripping
DO_STRIP=true
-LOOP=$(foreach i, $(SUBDIRS), $(MAKE) PACKAGE=$(PACKAGE) -C $(i) $@ &&) true
+LOOP=$(foreach i, $(SUBDIRS), $(MAKE) PACKAGE=$(PACKAGE) package=$(package) -C $(i) $@ &&) true
# different redhat releases need different flags for etags. Just use defaults.
ETAGS_FLAGS= # -CT
latex \\nonstopmode \\input $(<F) )
$(outdir)/%.ps: $(outdir)/%.dvi
- dvips -ta4 -o $@ $<
+ cd $(outdir) && dvips -ta4 -o $(@F) $(<F)
$(outdir)-$(PAPERSIZE)/%.ps: $(outdir)-$(PAPERSIZE)/%.dvi
- dvips -t$(PAPERSIZE) -o $@ $<
+ cd $(outdir) && dvips -t$(PAPERSIZE) -o $(@F) $(<F)