]> git.donarmstrong.com Git - lilypond.git/commitdiff
patch::: 1.3.130.jcn2
authorJan Nieuwenhuizen <janneke@gnu.org>
Thu, 22 Feb 2001 22:28:37 +0000 (23:28 +0100)
committerJan Nieuwenhuizen <janneke@gnu.org>
Thu, 22 Feb 2001 22:28:37 +0000 (23:28 +0100)
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.

28 files changed:
CHANGES
GNUmakefile.in
VERSION
aclocal.m4
config.make.in
flower/file-path.cc
flower/include/file-path.hh
lily/include/main.hh
lily/include/music-output-def.hh
lily/main.cc
lily/music-output-def.cc
lily/paper-def.cc
lily/paper-outputter.cc
lily/paper-stream.cc
lily/performance.cc
lily/scores.cc
make/GNUmakefile
make/ly-rules.make
make/ly.make [new file with mode: 0644]
make/mutopia-rules.make
scm/tex.scm
scripts/lilypond-book.py
scripts/ly2dvi.py
stepmake/GNUmakefile.in
stepmake/aclocal.m4
stepmake/stepmake/GNUmakefile
stepmake/stepmake/generic-vars.make
stepmake/stepmake/tex-rules.make

diff --git a/CHANGES b/CHANGES
index 45130da12668c3f4c5b112608d2ce78038793721..d58fe10b43fcb0fdf3cbfe0f70dca62a046698a1 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,25 @@
+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
 ============
 
index 37ac56142a4ea32bcd71b5b843db3594a1aa473b..dc4b58369b1d85fe225096cf8b870aa0955f506b 100644 (file)
@@ -19,10 +19,12 @@ README_TXT_FILES = AUTHORS.txt README.txt INSTALL.txt FAQ.txt
 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 
 #
 
diff --git a/VERSION b/VERSION
index dd6bf674402098daf0ce22f5910942661386393c..a6392e0bc90afe4fff4bb7f45d74638fd966a4b3 100644 (file)
--- a/VERSION
+++ b/VERSION
@@ -2,7 +2,7 @@ PACKAGE_NAME=LilyPond
 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.
index 1a095357e64a53fd58aef1b4fc1b3fe4ca16f08d..377a145e20eb8f2cfa15217ff1b7608a160aee80 100644 (file)
@@ -1,3 +1,5 @@
+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
 
@@ -373,6 +375,7 @@ dnl    fi
        ZIP="zip -r -9" #
        program_suffix=.exe
        # urg
+       # ROOTSEP=':'
         # DIRSEP='\\'
        # PATHSEP=';'
        #
@@ -395,10 +398,12 @@ dnl    fi
        # 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
index 3f2ec353a2deb1c08ca9d2f795da2c5cdce37fcb..fe73a6aa4a22e75af7db90ffa961711c4b3c7342 100644 (file)
@@ -63,6 +63,7 @@ MFMODE = @MFMODE@
 METAPOST = @METAPOST@
 MFPLAIN_MP = @MFPLAIN_MP@
 MSGFMT = @MSGFMT@
+ROOTSEP = @ROOTSEP@
 PATHSEP = @PATHSEP@
 PERL = @PERL@
 PYTHON = @PYTHON@
index 80c34db4c1701eb9e7dec6dbe065cdece72e9688..a17f47c43ae2e9a1f63b05e30d522a38a73b19ec 100644 (file)
 #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
index fdaf3e254a8dbf518156418626651cb3b0f0e0dc..898bb3939fb2291c4c17cd463717e8f92bcfd6df 100644 (file)
    
 */
 
+class Path
+{
+public:
+  String root;
+  String dir;
+  String base;
+  String ext;
+
+  String path () const;
+};
+
 class File_path : private Array<String>
 {
 public:
@@ -42,6 +53,6 @@ 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
index 401a896ad59f6ddf7c8ed8bf94f3c4b4bf721d2b..3d543bb01ad69899942f1644a22bd5eec9e80b0f 100644 (file)
@@ -27,7 +27,6 @@ extern bool find_old_relative_b;
 
 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;
 
@@ -42,8 +41,8 @@ extern File_path global_path;
 */
 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;
 
index 503a1c8105f57c15b5be3c53466f7b517ad04500..7d5872de6dd36e5dbbaa9a1325e91c4d30c7ecb2 100644 (file)
@@ -39,10 +39,9 @@ public:
 
   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,);
 };
index 82f0e60a153bfd777ac1d1da52b3c654b3ee4ad7..9db178b17d46282b84ea6669e7029092b8fa0e30 100644 (file)
@@ -41,13 +41,17 @@ bool no_paper_global_b = false;
 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;
 
@@ -61,7 +65,7 @@ int exit_status_i_;
 
 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:
@@ -79,7 +83,7 @@ Long_option_init theopts[] = {
   {_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")},
@@ -258,53 +262,49 @@ main_prog (int, char**)
   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;
-  exitexit_status_i_);
+  exit (exit_status_i_);
 }
 
 
@@ -330,7 +330,7 @@ main (int argc, char **argv)
       switch (opt->shortname_ch_)
        {
        case 'v':
-         version();
+         version ();
          exit (0);             // we print a version anyway.
          break;
        case 't':
@@ -338,14 +338,20 @@ main (int argc, char **argv)
          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;
@@ -357,7 +363,7 @@ main (int argc, char **argv)
          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 ();
@@ -395,46 +401,33 @@ main (int argc, char **argv)
 }
 
 /**
-  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;
 }
 
index fbb2e12ba8168304dafdc179625fbb30a640ac32..bf46b4645cbed94e3fa1f305189ff2f8d3418262 100644 (file)
@@ -15,6 +15,7 @@
 #include "global-translator.hh"
 #include "translator-def.hh"
 #include "main.hh"
+#include "file-path.hh"
 #include "lily-guile.hh"
 
 #include "ly-smobs.icc"
@@ -120,20 +121,6 @@ Music_output_def::get_global_translator_p ()
   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 *)
 {
@@ -145,17 +132,15 @@ 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;
 }
index 12f787a63315b434cac42859e77e4edd3699def4..063051f5956afefdd9afcd99b23720b80bf5129a 100644 (file)
@@ -105,16 +105,15 @@ Paper_def::reset_default_count()
 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;
 }
 
index 1c55022e84f073e3aac2312b542050361da69c66..7afa06e812767ccff120cb73290bdaeae9ddfa66 100644 (file)
@@ -41,7 +41,7 @@ Paper_outputter::Paper_outputter (String name)
    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_)
     {
@@ -74,7 +74,7 @@ Paper_outputter::output_header ()
       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);
index 86f2ee5de8adef3145a3179a3faf91f3b5b73c02..b15e2628928f1673fbeb91134448897dfac6ba1a 100644 (file)
@@ -6,10 +6,14 @@
   (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;
@@ -18,8 +22,14 @@ ostream *
 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)
index 9da4c7dc38caaae621456bcc1594cb0d54d015cc..53d223c7d20dfdb51d0da3a0ac0972eefceec4ec 100644 (file)
@@ -20,6 +20,7 @@
 #include "performance.hh"
 #include "score.hh"
 #include "file-results.hh"
+#include "file-path.hh"
 #include "lily-version.hh"
 
 #include "killing-cons.tcc"
@@ -74,11 +75,13 @@ Performance::output_header_track (Midi_stream& midi_stream)
   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";
 
   /*
@@ -89,7 +92,8 @@ Performance::output_header_track (Midi_stream& midi_stream)
   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
@@ -141,20 +145,15 @@ Performance::add_element (Audio_element *p)
 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);
index 84e9891994011909fb0a160d85d2236b36b949c3..894a6a46c3d8383bcdc30bc5df32037b86fcccd4 100644 (file)
@@ -32,13 +32,13 @@ void write_dependency_file (String fn, Array<String> targets,
 {
   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] + " ";
@@ -60,7 +60,10 @@ do_deps()
 {
   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);
     }
 }
index b4e188d32807824cb609593ec97b25b3e43a5264..e62590a7c866e65ac05d0351f2869c3707406b8c 100644 (file)
@@ -1,8 +1,11 @@
 # 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 
 
index 49a0f6dd129dbec51bae32312951f13ec8592417..ea199bca79fa52557da1106e2cdbaa2508f123d6 100644 (file)
@@ -5,7 +5,7 @@
 
 $(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.
@@ -19,7 +19,7 @@ $(outdir)/%.texi: %.tely
 # 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 $@
 
diff --git a/make/ly.make b/make/ly.make
new file mode 100644 (file)
index 0000000..0a0d8a6
--- /dev/null
@@ -0,0 +1,126 @@
+#!/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)
+
index 2c82d19e3a92ddc77c1bab3ad98993429fd65501..39a12f41046bc6c58bdfc53121077f73834bbfed 100644 (file)
@@ -21,19 +21,19 @@ $(outdir)/%.ly: %.abc
        $(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
index 0cf48cd80d714e5bf048ab29693a6fe9f51b8858..190a36e7acc154b40fb8d648061a8051a2353763 100644 (file)
 
   (define (header creator generate) 
     (string-append
-     "%created by: " creator generate "\n"))
+     "% Generated automatically by: " creator generate "\n"))
 
   (define (invoke-char s i)
     (string-append 
index ea8f9ce871a8d7240a75be47dd9ff4f50bcbb505..b6a957b27c1b539fec4379e38aa719434841678f 100644 (file)
@@ -520,7 +520,8 @@ def compose_full_body (body, opts):
        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
@@ -802,7 +803,7 @@ def schedule_lilypond_block (chunk):
        (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:
@@ -926,7 +927,22 @@ def compile_all_files (chunks):
                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))
@@ -1032,15 +1048,30 @@ Han-Wen Nienhuys <hanwen@cs.uu.nl>
        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)
@@ -1077,6 +1108,7 @@ def fix_epswidth (chunks):
 
 
 def do_file(input_filename):
+       global foutn
        file_settings = {}
        if outname:
                my_outname = outname
@@ -1116,7 +1148,7 @@ def do_file(input_filename):
        # should chmod -w
 
        if do_deps:
-               write_deps (my_depname, foutn)
+               write_deps (my_depname, foutn, chunks)
 
 
 outname = ''
index 165e63b142e259a57ac12b356f25dacaea46d8d4..3075a506fb120338638ae87653a28e2fdcce5e04 100644 (file)
@@ -251,7 +251,7 @@ class TeXOutput:
 
         top= r"""
 %% Creator: %s
-%% Automatically generated from  %s, %s
+%% Generated automatically by: %s, from %s, at %s
 
 \documentclass[%s]{article}
 
@@ -276,7 +276,7 @@ class TeXOutput:
 \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'))
         
@@ -926,7 +926,7 @@ def getLilyopts():
     else:
 
         if Props.get('dependencies'):
-            dep=' -M'
+            dep=' --dependencies'
         else:
             dep=''
        return inc + dep
@@ -959,6 +959,14 @@ def getTeXFile(contents):
     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
@@ -1008,7 +1016,8 @@ Options:
   -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
 
@@ -1035,8 +1044,8 @@ def main():
                                        '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]
@@ -1066,7 +1075,7 @@ def main():
            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')
@@ -1117,6 +1126,7 @@ def main():
                 if stat:
                     sys.exit('ExitBadLily', cmd )
                 texFiles=getTeXFile(log)
+                depFiles=getDepFiles (log)
                 writeLilylog(file,log)
                 Props.addLilyOutputFiles(texFiles,'program')
                 texInputFiles = texInputFiles + texFiles
@@ -1143,6 +1153,19 @@ def main():
                 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')
index 349ff922af839da542c1abccce16b2404aeb1abc..a50edb862e2167e7f34200b51a16056bf3e2892d 100644 (file)
@@ -11,7 +11,7 @@ depth = .
 ifeq ($(PACKAGE),STEPMAKE)
 SUBDIRS = bin make stepmake 
 else
-SUBDIRS =
+SUBDIRS = stepmake
 endif
 #
 
@@ -30,12 +30,15 @@ STEPMAKE_TEMPLATES=toplevel texinfo
 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
 #
 
index 1a095357e64a53fd58aef1b4fc1b3fe4ca16f08d..f5ba556edd1f188f004b2a91f6ad29f39a94ad54 100644 (file)
@@ -373,6 +373,7 @@ dnl    fi
        ZIP="zip -r -9" #
        program_suffix=.exe
        # urg
+       # ROOTSEP=':'
         # DIRSEP='\\'
        # PATHSEP=';'
        #
@@ -395,10 +396,12 @@ dnl    fi
        # 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
index 7bdbd3c278e1aea02a5521a4d4bd7f7f590b8892..bb2a1c72c4d155868381adf40bb806c3da335e35 100644 (file)
@@ -16,6 +16,10 @@ STEPMAKE_TEMPLATES=makedir install
 #
 -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)
 
index e8e6cc6162694155764083fa63b5645b4d55a7da..37f75620bfd42a8ee71aef0c0a3860460e4a5c74 100644 (file)
@@ -137,7 +137,7 @@ endif
 
 # 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
index ffbaf5ba248eb2d8950ca62315b6a2ef1abcc4eb..c5da9738cd6540fb758ba955ee5c7389c1132d93 100644 (file)
@@ -14,8 +14,8 @@ $(outdir)/%.dvi: $(outdir)/%.latex
          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)