]> git.donarmstrong.com Git - lilypond.git/commitdiff
patch::: 1.5.10.jcn3
authorJan Nieuwenhuizen <janneke@gnu.org>
Thu, 20 Sep 2001 19:24:40 +0000 (21:24 +0200)
committerJan Nieuwenhuizen <janneke@gnu.org>
Thu, 20 Sep 2001 19:24:40 +0000 (21:24 +0200)
1.5.10.jcn3
===========

* include python midi parser.

* stepmake updates.

* add .cvsignore patterns for making patches the standard, manual way.

23 files changed:
CHANGES
GNUmakefile.in
VERSION
modules/GNUmakefile [new file with mode: 0644]
modules/midi.c [new file with mode: 0644]
stepmake/stepmake/c++-rules.make
stepmake/stepmake/c++-vars.make
stepmake/stepmake/c-rules.make
stepmake/stepmake/c-vars.make
stepmake/stepmake/compile-vars.make [new file with mode: 0644]
stepmake/stepmake/executable-rules.make
stepmake/stepmake/executable-targets.make
stepmake/stepmake/executable-vars.make
stepmake/stepmake/generic-vars.make
stepmake/stepmake/library-rules.make
stepmake/stepmake/library-targets.make
stepmake/stepmake/library-vars.make
stepmake/stepmake/python-module-rules.make [new file with mode: 0644]
stepmake/stepmake/python-module-targets.make [new file with mode: 0644]
stepmake/stepmake/python-module-vars.make [new file with mode: 0644]
stepmake/stepmake/shared-library-rules.make [new file with mode: 0644]
stepmake/stepmake/shared-library-targets.make [new file with mode: 0644]
stepmake/stepmake/shared-library-vars.make [new file with mode: 0644]

diff --git a/CHANGES b/CHANGES
index 224fb6764ef6d606621a80f21761f7c4658ce1d5..c1cc36046fa71d9109e1f2371f2a73bd3d872137 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,5 +1,11 @@
-1.5.10.jcn2
-==========
+1.5.10.jcn3
+===========
+
+* include python midi parser.
+
+* stepmake updates.
+
+* add .cvsignore patterns for making patches the standard, manual way.
 
 * midi2ly: support chords, duration conversion rewrite.
 
index e5db868e710c56b89667cfc8c8ca30d1504fa499..ef6ea571a0db23e2792bb55b9a3a3d6d992282df 100644 (file)
@@ -10,7 +10,7 @@ depth = .
 # 
 SUBDIRS = buildscripts scripts flower lily \
        mf ly tex ps scm \
-       midi2ly po make intl \
+       modules midi2ly po make intl \
        debian $(builddir)/stepmake \
        Documentation input \
        mutopia ports
diff --git a/VERSION b/VERSION
index 7a347816fa936e9c7b06ddc5bae572b26544fc5a..7eb914293c47e843f337459b6fa388281914a5f0 100644 (file)
--- a/VERSION
+++ b/VERSION
@@ -2,7 +2,7 @@ PACKAGE_NAME=LilyPond
 MAJOR_VERSION=1
 MINOR_VERSION=5
 PATCH_LEVEL=10
-MY_PATCH_LEVEL=jcn2
+MY_PATCH_LEVEL=jcn3
 
 # use the above to send patches: MY_PATCH_LEVEL is always empty for a
 # released version.
diff --git a/modules/GNUmakefile b/modules/GNUmakefile
new file mode 100644 (file)
index 0000000..5a023f1
--- /dev/null
@@ -0,0 +1,11 @@
+depth = ..
+
+# Hmm, name dir midi too, then?
+NAME=midi
+
+STEPMAKE_TEMPLATES=c install python-module
+
+INSTALLATION_FILES=$(outdir)/midi.so
+INSTALLATION_DIR=$(datadir)/python
+
+include $(depth)/make/stepmake.make
diff --git a/modules/midi.c b/modules/midi.c
new file mode 100644 (file)
index 0000000..11fdd25
--- /dev/null
@@ -0,0 +1,413 @@
+/*
+  midi.c -- implement Python midi parser module
+
+  source file of the GNU LilyPond music typesetter
+
+  (c)  2001 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+            Jan Nieuwenhuizen <janneke@gnu.org>
+
+*/
+
+/*
+
+python2
+import midi
+s = open ("s.midi").read ()
+midi.parse_track (s)
+midi.parse (s)
+
+*/
+
+#include <python2.0/Python.h>
+
+#if 0
+int x = 0;
+int *track = &x;
+#define debug_print(f, args...) fprintf (stderr, "%s:%d: track: %p :" f, __FUNCTION__, __LINE__, *track, ##args)
+#else
+#define debug_print(f, args...)
+#endif
+
+static PyObject *Midi_error;
+static PyObject *Midi_warning;
+
+static PyObject *
+midi_error (char *s)
+{
+  PyErr_SetString (Midi_error, s);
+  return 0;
+}
+
+static PyObject *
+midi_warning (char *s)
+{
+  PyErr_SetString (Midi_warning, s);
+  return 0;
+}
+
+
+typedef struct message {
+  unsigned char msg;
+  char * description;
+} message_t;
+
+message_t channelVoiceMessages[] = {
+  0x80, "NOTE_OFF",
+  0x90, "NOTE_ON",
+  0xA0, "POLYPHONIC_KEY_PRESSURE",
+  0xB0, "CONTROLLER_CHANGE",
+  0xC0, "PROGRAM_CHANGE",
+  0xD0, "CHANNEL_KEY_PRESSURE",
+  0xE0, "PITCH_BEND",
+  0,0
+};
+
+message_t channelModeMessages[] = {
+  0x78, "ALL_SOUND_OFF",
+  0x79, "RESET_ALL_CONTROLLERS",
+  0x7A, "LOCAL_CONTROL",
+  0x7B, "ALL_NOTES_OFF",
+  0x7C, "OMNI_MODE_OFF",
+  0x7D, "OMNI_MODE_ON",
+  0x7E, "MONO_MODE_ON",
+  0x7F, "POLY_MODE_ON",
+  0,0
+};
+
+message_t metaEvents[] = {
+  0x00, "SEQUENCE_NUMBER",
+  0x01, "TEXT_EVENT",
+  0x02, "COPYRIGHT_NOTICE",
+  0x03, "SEQUENCE_TRACK_NAME",
+  0x04, "INSTRUMENT_NAME",
+  0x05, "LYRIC",
+  0x06, "MARKER",
+  0x07, "CUE_POINT",
+  0x20, "MIDI_CHANNEL_PREFIX",
+  0x21, "MIDI_PORT",
+  0x2F, "END_OF_TRACK",
+  0x51, "SET_TEMPO",
+  0x54, "SMTPE_OFFSET",
+  0x58, "TIME_SIGNATURE",
+  0x59, "KEY_SIGNATURE",
+  0x7F, "SEQUENCER_SPECIFIC_META_EVENT",
+  0,0
+};
+
+unsigned long int
+get_number (char * str, char * end_str, int length)
+{
+  /* # MIDI uses big-endian for everything */
+  long sum = 0;
+  int i = 0;
+  
+  for (; i < length; i++)
+    sum = (sum << 8) + (unsigned char) str[i];
+
+  debug_print ("%d:\n", sum);
+  return sum;
+}
+
+unsigned long int
+get_variable_length_number (char **str, char * end_str)
+{
+  long sum = 0;
+  int i = 0;
+  while (*str < end_str)
+    {
+      unsigned char x = **str;
+      (*str) ++;
+      sum = (sum << 7) + (x & 0x7F);
+      if (!(x & 0x80))
+       break;
+    }
+  debug_print ("%d:\n", sum);
+  return sum;
+}
+
+static PyObject *
+read_unimplemented_event (char **track, char *end, unsigned long time,
+                         unsigned char x, unsigned char z)
+{
+  debug_print ("%x:%s", z, "unimplemented MIDI event\n");
+  *track += 2;
+  return Py_BuildValue ("(iii)", z, *((*track) -2), *((*track) -1));
+}
+
+PyObject *
+read_one_byte (char **track, char *end, unsigned long time,
+              unsigned char x, unsigned char z)
+{
+  debug_print ("%x:%s", z, "event\n");
+  *track += 1;
+  return Py_BuildValue ("(ii)", z, *((*track) -1));
+}
+
+PyObject *
+read_two_bytes (char **track, char *end, unsigned long time,
+               unsigned char x, unsigned char z)
+{
+  debug_print ("%x:%s", z, "event\n");
+  *track += 2;
+  return Py_BuildValue ("(iii)", z, *((*track) -2), *((*track) -1));
+}
+
+PyObject *
+read_three_bytes (char **track, char *end, unsigned long time,
+                 unsigned char x, unsigned char z)
+{
+  debug_print ("%x:%s", z, "event\n");
+  *track += 3;
+  return Py_BuildValue ("(iiii)", z, *((*track) -3), *((*track) -2), *((*track) -1));
+}
+
+PyObject *
+read_string (char **track, char *end, unsigned long time,
+            unsigned char x, unsigned char z)
+{
+  unsigned long length = get_variable_length_number (track, end);
+  if (length < *track - end)
+    debug_print ("%s", "zero length string\n");
+  *track += length;
+  debug_print ("%x:%s", length, "string\n");
+  return Py_BuildValue ("(is)", z, *((*track) -length));
+}
+
+typedef PyObject* (*Read_midi_event)
+     (char **track, char *end, unsigned long time,
+      unsigned char x, unsigned char z);
+
+Read_midi_event read_ff_byte [16] =
+{
+  read_three_bytes,  //  0
+  read_one_byte,     // 10
+  read_one_byte,  // 20
+  read_one_byte,  // 30
+  read_one_byte,  // 40
+  read_one_byte,  // 50
+  read_one_byte,  // 60
+  read_two_bytes, // 70
+  read_two_bytes, // 80
+  read_two_bytes, // 90
+  read_two_bytes, // a0
+  read_two_bytes, // b0
+  read_one_byte,  // c0
+  read_two_bytes, // d0
+  read_two_bytes, // e0
+  read_two_bytes, // e0
+};
+
+
+static PyObject *
+read_f0_byte (char **track, char *end, unsigned long time,
+             unsigned char x, unsigned char z)
+             
+{
+  debug_print ("%x:%s", z, "event\n");
+  if (z == 0xff)
+    {
+      unsigned char zz = *(*track)++;
+      debug_print ("%x:%s", zz, "f0-event\n");
+      if (zz == 0x01 && **track <= 0x07)
+       return read_string (track, end, time, x, zz);
+      else if (zz == 0x2f && **track == 0x00)
+       {
+         (*track)++;
+         debug_print ("%s", "done\n");
+         return 0;
+       }
+      else
+       return read_unimplemented_event (track, end, time, x, zz);
+      exit (0);
+    }
+  else
+    return read_string (track, end, time, x, z);
+}
+
+Read_midi_event read_midi_event [16] =
+{
+  read_one_byte,  //  0
+  read_one_byte,  // 10
+  read_one_byte,  // 20
+  read_one_byte,  // 30
+  read_one_byte,  // 40
+  read_one_byte,  // 50
+  read_one_byte,  // 60
+  read_two_bytes, // 70
+  read_two_bytes, // 80
+  read_two_bytes, // 90
+  read_two_bytes, // a0
+  read_two_bytes, // b0
+  read_one_byte,  // c0
+  read_two_bytes, // d0
+  read_two_bytes, // e0
+  read_f0_byte,   // f0
+};
+            
+static PyObject *
+read_event (char **track, char *end, unsigned long time,
+           unsigned char *running_status)
+{
+  int rsb_skip = ((**track & 0x80)) ? 1 :0;
+
+  unsigned char x = (rsb_skip) ? (*track)[0]: *running_status;
+  // unsigned char y = x & 0xf0;
+  unsigned char z = (*track)[1 + rsb_skip];
+  
+  debug_print ("%x:%s", z, "event\n");
+  *track += 2 + rsb_skip;
+
+  return (*read_midi_event[z >> 4]) (track, end, time, x, z);
+}
+
+static PyObject *
+midi_parse_track (char **track, char *track_end)
+{
+  unsigned int time = 0;
+  unsigned char running_status;
+  unsigned long track_len, track_size;
+  PyObject *pytrack = 0;
+
+  debug_print ("%s", "\n");
+  
+  track_size = track_end - *track;
+  /* need this for direct midi.parse_track (s) on midi file */
+  if (strcmp (*track, "MTrk"))
+    *track = memmem (*track, track_size - 1, "MTrk", 4);
+  debug_print ("%s", "\n");
+  assert (!strcmp (*track, "MTrk"));
+  *track += 4;
+
+  track_len = get_number (*track, *track + 4, 4);
+  *track += 4;
+
+  debug_print ("track_len: %u\n", track_len);
+  debug_print ("track_size: %u\n", track_size);
+  debug_print ("track begin: %p\n", track);
+  debug_print ("track end: %p\n", track + track_len);
+  
+  //assert (track_len <= track_size);
+
+  pytrack = PyList_New (0);
+
+  track_end = *track + track_len;
+
+  while (*track < track_end)
+    {
+      long dt = get_variable_length_number(track, track_end);
+      time += dt;
+      PyList_Append (pytrack, read_event (track, track_end, time,
+                                         &running_status));
+    }
+
+  *track = track_end;
+  return pytrack;
+}
+
+
+static PyObject *
+pymidi_parse_track (PyObject *self, PyObject *args)
+{
+  char *track, *track_end;
+  unsigned long track_size, track_len;
+
+  PyObject * sobj = PyTuple_GetItem (args, 0);
+
+  debug_print ("%s", "\n");
+  if (!PyArg_ParseTuple (args, "s#", &track, &track_size))
+    return 0;
+
+  if (track_size < 0)
+    return midi_error ("negative track size");
+
+  track_end = track + track_size;
+  
+  return midi_parse_track (&track, track_end);
+}
+
+static PyObject *
+midi_parse (char **midi, char *midi_end)
+{
+  PyObject *pymidi = 0;
+  unsigned long header_len;
+  unsigned format, tracks;
+  int division;
+  int i;
+  
+  debug_print ("%s", "\n");
+
+  /* Header */
+  header_len = get_number (*midi, *midi + 4, 4);
+  *midi += 4;
+  
+  if (header_len < 6)
+    return midi_error ("header too short");
+    
+  format = get_number (*midi, *midi + 2, 2);
+  *midi += 2;
+  
+  tracks = get_number (*midi, *midi + 2, 2);
+  *midi += 2;
+
+  if (tracks > 32)
+    return midi_error ("too many tracks");
+  
+  division = get_number (*midi, *midi + 2, 2) * 4;
+  *midi += 2;
+
+  if (division < 0)
+    /* return midi_error ("can't handle non-metrical time"); */
+    ;
+  *midi += header_len - 6;
+
+  pymidi = PyList_New (0);
+  PyList_Append (pymidi, Py_BuildValue ("(iii)", format, tracks, division));
+
+  /* Tracks */
+  for (i = 0; i < tracks; i++)
+    PyList_Append (pymidi, midi_parse_track (midi, midi_end));
+
+  return pymidi;
+}
+
+static PyObject *
+pymidi_parse (PyObject *self, PyObject *args)
+{
+  char *midi, *midi_end;
+  unsigned long midi_size, midi_len;
+  
+  PyObject *sobj = PyTuple_GetItem (args, 0);
+
+  debug_print ("%s", "\n");
+  if (!PyArg_ParseTuple (args, "s#", &midi, &midi_size))
+    return 0;
+
+  if (strcmp (midi, "MThd"))
+      return midi_error ("MThd expected");
+  
+  midi += 4;
+
+  midi_end = midi + midi_size;
+
+  return midi_parse (&midi, midi_end);
+}
+
+
+static PyMethodDef MidiMethods[] = 
+{
+  {"parse",  pymidi_parse, 1},
+  {"parse_track",  pymidi_parse_track, 1},
+  {0, 0}        /* Sentinel */
+};
+
+initmidi ()
+{
+  PyObject *m, *d;
+  m = Py_InitModule ("midi", MidiMethods);
+  d = PyModule_GetDict (m);
+  
+  Midi_error = PyString_FromString ("midi.error");
+  PyDict_SetItemString (d, "error", Midi_error);
+  Midi_warning = PyString_FromString ("midi.warning");
+  PyDict_SetItemString (d, "warning", Midi_warning);
+}
index 1c7a0cc0db3e7ac959aea503dd6982237ea79080..5b80d2447546517b9e0b975040341c7625e4d4a2 100644 (file)
@@ -1,12 +1,16 @@
-.SUFFIXES: .cc .o .hh .yy .ll  .dep
+.SUFFIXES: .cc .dep .hh .ll .o .so .yy
 
-# compile rules:
-#
 $(outdir)/%.o: %.cc
-       $(DO_CXX_COMPILE)
+       $(DO_O_DEP) $(CXX) -c $(CXXFLAGS) -o $@ $<
 
 $(outdir)/%.o: $(outdir)/%.cc
-       $(DO_CXX_COMPILE)
+       $(DO_O_DEP) $(CXX) -c $(CXXFLAGS) -o $@ $<
+
+$(outdir)/%.lo: %.cc
+       $(DO_LO_DEP) $(CXX) -c $(CXXFLAGS) $(PIC_FLAGS) -o $@ $<
+
+$(outdir)/%.lo: $(outdir)/%.cc
+       $(DO_LO_DEP) $(CXX) -c $(CXXFLAGS) $(PIC_FLAGS) -o $@ $<
 
 $(outdir)/%.cc: %.yy
        $(BISON) $<
index bf78e7d48a8cf232f27693e80893369fce298603..3dfe6819b1d0f591842be1222104ddaa17686bde 100644 (file)
@@ -1,4 +1,6 @@
 
+include $(stepdir)/compile-vars.make
+
 # added two warnings that are treated by cygwin32's gcc 2.7.2 as errors.
 # huh, but still, no warnings even provoced with linux's gcc 2.7.2.1?
 
@@ -7,8 +9,6 @@
 EXTRA_CXXFLAGS= -Wall  -W -Wmissing-prototypes -Wconversion
 
 CXXFLAGS = $(ICFLAGS) $(DEFINES) $(addprefix -I,$(INCLUDES)) $(USER_CFLAGS) $(EXTRA_CFLAGS) $(MODULE_CFLAGS) $($(PACKAGE)_CFLAGS) $($(PACKAGE)_CXXFLAGS) $(USER_CXXFLAGS) $(EXTRA_CXXFLAGS) $(MODULE_CXXFLAGS)
-CXX_OUTPUT_OPTION = $< -o $@
-DO_CXX_COMPILE=$(DODEP) $(CXX) -c $(CXXFLAGS) $(CXX_OUTPUT_OPTION)
 
 # template files:
 TCC_FILES := $(wildcard *.tcc)
index 90013ec551261c807d0fac5138a18f571ae72d18..ef44800783c973000b74b27b0419b5bb287aa62e 100644 (file)
@@ -1,10 +1,16 @@
-.SUFFIXES: .c .o .h .y .l .dep
+.SUFFIXES: .c .dep .h .l .lo .o .so .y
 
 $(outdir)/%.o: %.c
-       $(DO_C_COMPILE)
+       $(DO_O_DEP) $(CC) -c $(CFLAGS) -o $@ $<
 
 $(outdir)/%.o: $(outdir)/%.c
-       $(DO_C_COMPILE)
+       $(DO_O_DEP) $(CC) -c $(CFLAGS) -o $@ $<
+
+$(outdir)/%.lo: %.c
+       $(DO_LO_DEP) $(CC) -c $(CFLAGS) $(PIC_FLAGS) -o $@ $<
+
+$(outdir)/%.lo: %.c
+       $(DO_LO_DEP) $(CC) -c $(CFLAGS) $(PIC_FLAGS) -o $@ $<
 
 $(outdir)/%.c: %.y
        $(BISON) $<
index 7c5a9f0ef21dbb9f27a33d89678b61f835c7581b..2b25636bba6fdaa464317cf007ac0fbb8bc84364 100644 (file)
@@ -1,4 +1,5 @@
-# header files:
+include $(stepdir)/compile-vars.make
+
 H_FILES := $(wildcard *.h)
 C_FILES := $(wildcard *.c)
 Y_FILES := $(wildcard *.y)
@@ -9,15 +10,7 @@ SOURCE_FILES+=$(Y_FILES) $(C_FILES) $(L_FILES) $(H_FILES)
 O_FILES+=$(addprefix $(outdir)/, $(Y_FILES:.y=.o) $(C_FILES:.c=.o) $(L_FILES:.l=.o))
 
 TAGS_FILES += $(C_FILES) $(H_FILES)
-# C/C++
-# 
 
 ALL_C_SOURCES += $(H_FILES) $(C_FILES) $(Y_FILES) $(L_FILES)
 
-# compiler:
-#
-DO_C_COMPILE = $(DODEP) $(CC) -c   $(CFLAGS)  $(C_OUTPUT_OPTION)
-C_OUTPUT_OPTION =  -o $@ $<
-
 CFLAGS = $(ICFLAGS) $(DEFINES) $(addprefix -I,$(INCLUDES)) $(USER_CFLAGS) $(EXTRA_CFLAGS) $(MODULE_CFLAGS)
-
diff --git a/stepmake/stepmake/compile-vars.make b/stepmake/stepmake/compile-vars.make
new file mode 100644 (file)
index 0000000..0472554
--- /dev/null
@@ -0,0 +1,13 @@
+ARFLAGS = ru
+
+LDFLAGS = $(ILDFLAGS) $(EXTRA_LDFLAGS) $($(PACKAGE)_LDFLAGS) $(MODULE_LDFLAGS) $(USER_LDFLAGS)
+
+PIC_FLAGS = -fpic -fPIC
+SHARED_FLAGS = -shared
+
+o-dep-out = $(outdir)/$(subst .o,.dep,$(notdir $@))#
+DO_O_DEP = rm -f $(o-dep-out); DEPENDENCIES_OUTPUT="$(o-dep-out) $(outdir)/$(notdir $@)"
+
+lo-dep-out = $(outdir)/$(subst .lo,.dep,$(notdir $@))#
+DO_LO_DEP = rm -f $(lo-dep-out); DEPENDENCIES_OUTPUT="$(lo-dep-out) $(outdir)/$(notdir $@)"
+
index e032d7ee59da0ee580e7967954f6938b5163084d..7f0b076dc83f5976a35bf217ac5db3b3d7b8f0c0 100644 (file)
@@ -1,2 +1,4 @@
-# empty
 
+$(EXECUTABLE): $(outdir)/config.h $(O_FILES) $(outdir)/version.hh
+       $(foreach a, $(MODULE_LIBS), $(MAKE) -C $(a) && ) true
+       $(LD) -o $@ $(O_FILES) $(LOADLIBES) $(LDFLAGS)
index 89b06d48a8f6454d65dc748f56f1c48aead545cf..b16bf89807a7ba77da55297235a21d9ee83b8d6d 100644 (file)
@@ -1,13 +1,7 @@
 default: $(EXECUTABLE)
 
-$(EXECUTABLE): $(outdir)/config.h $(O_FILES) $(outdir)/version.hh
-       $(foreach a, $(MODULE_LIBS), $(MAKE) -C $(a) && ) true
-       $(LD_COMMAND) $(O_FILES) $(LOADLIBES) $(USER_LDFLAGS)
-
 exe: $(EXECUTABLE)
 
-
-
 local-install: installexe
 
 local-uninstall: uninstallexe
index c94aeff482cafcfedb7d5e111950a22c38489120..5ac8fcd982763860b11ca039f790362013cfcf39 100644 (file)
@@ -1,6 +1,3 @@
-LDFLAGS = $(ILDFLAGS) $(EXTRA_LDFLAGS) $(MODULE_LDFLAGS) $($(PACKAGE)_LDFLAGS)
-
-## urg, silly name: library.a
 MODULE_LIBES =$(addprefix $(outdir)/../, $(addsuffix /$(outbase)/library.a, $(MODULE_LIBS)))
 LOADLIBES = $(MODULE_LIBES) $($(PACKAGE)_LIBES) $(EXTRA_LIBES)
 
index 8ee0efd874c063bcd8d7a13429c436b150d653e6..1679e6b90d1da89b84c8e25627c742a2261ee717 100644 (file)
@@ -77,33 +77,9 @@ ERROR_LOG = 2> /dev/null
 SILENT_LOG = 2>&1 >  /dev/null
 date := $(shell date +%x)      #duplicated?
 
-# compile and link options:
-#
-ARFLAGS = ru
-
-#INCLUDES =  $(depth)/$(builddir) include $(outdir) $($(PACKAGE)_INCLUDES) $(MODULE_INCLUDES)
 INCLUDES = include $(outdir) $($(PACKAGE)_INCLUDES) $(MODULE_INCLUDES)
 
-# urg: for windows ?
-# LOADLIBES = $(MODULE_LIBES) $($(PACKAGE)_LIBES) $(EXTRA_LIBES) -lstdc++
-#
-
-# macro compiler:
-#
 M4 = m4
-# 
-
-#
-LD_COMMAND = $(LD) $(LDFLAGS) -o $@
-#
-
-# dependencies:
-#
-depfile = $(outdir)/$(subst .o,.dep,$(notdir $@))#
-DODEP=rm -f $(depfile); DEPENDENCIES_OUTPUT="$(depfile) $(outdir)/$(notdir $@)"
-#
-
-#
 
 #replace to do stripping of certain objects
 STRIPDEBUG=true 
@@ -111,11 +87,7 @@ STRIPDEBUG=true
 DIST_FILES=$(EXTRA_DIST_FILES) GNUmakefile $(ALL_SOURCES)
 DOCDIR=$(depth)/$(outdir)
 
-
 STRIP=strip --strip-debug
-ifdef stablecc
- STABLEOBS=$(addprefix $(outdir)/,$(stablecc:.cc=.o))
-endif
 
 # substitute $(STRIP) in Site.make if you want stripping
 DO_STRIP=true
index 1bb8bf6d7fd4c8d09aea89b47de20fb8bbb61626..64d49bc098a65609c18875ae40ff813cc3f30072 100644 (file)
@@ -1 +1,8 @@
-# empty
+
+$(LIBRARY): $(outdir)/config.h $(O_FILES)
+       $(AR) $(ARFLAGS) $@ $(O_FILES)
+       # thanks to Nelson Beebe for this trick.
+       $(RANLIB) $@ || $(AR) ts $@ || true
+
+
+
index 7cb7ea5bfecac1242ec7e09c427fe57d1f3feaf8..61bd8f28c010cb5840c4e2b4ba421caf8fad5675 100644 (file)
@@ -1,14 +1,3 @@
-
 default: $(LIBRARY)
 
-$(outdir)/library.a: $(outdir)/config.h $(O_FILES) $(MODULE_LIBES)
-       $(AR_COMMAND) $(O_FILES)
-       $(RANLIB_COMMAND)
-
-$(SHAREDLIBRARY):  $(outdir)/config.h $(O_FILES) $(MODULE_LIBES)
-       $(LD_COMMAND) $(O_FILES) -o $@.$(VERSION)
-       rm -f $@
-       ln -sf $(outdir)/$(LIB_PREFIX)$(NAME).so.$(VERSION) $@.$(MAJOR_VERSION)
-       ln -sf $(LIB_PREFIX)$(NAME).so.$(VERSION) $@
-
-
+lib: $(LIBRARY)
index b2555a9c84588c96f9a8eea8ff08dbb4233d6cd0..7c01002d530a4db8a44313e91f4c30f217542757 100644 (file)
@@ -1,22 +1,8 @@
-
-#ugh ugh .
-ifndef LIB_SUFFIX
-LIB_SUFFIX = .a
-endif
-
 LIB_PREFIX = lib
+LIB_SUFFIX = .a
 
-# librarian:
-#
-AR = ar
-AR_COMMAND = $(AR) $(ARFLAGS) $@
-
-# thanks to Nelson Beebe for this trick.
-RANLIB_COMMAND=$(RANLIB) $@ || $(AR) ts $@ || true
-
-# linker:
-# urg, i don't like this name, it's not what you'd expect
-LIBRARY = $(outdir)/library.a
+AR=ar
 
+# LIBRARY = $(outdir)/$(LIB_PREFIX)$(NAME)$(LIB_SUFFIX)
+LIBRARY = $(outdir)/$(LIB_PREFIX)rary$(LIB_SUFFIX)
 INSTALL_LIBRARY = $(LIB_PREFIX)$(NAME)$(LIB_SUFFIX)
-SHARED_LIBRARY=$(outdir)/$(LIB_PREFIX)$(NAME).so
diff --git a/stepmake/stepmake/python-module-rules.make b/stepmake/stepmake/python-module-rules.make
new file mode 100644 (file)
index 0000000..b37eb61
--- /dev/null
@@ -0,0 +1,3 @@
+
+$(PYTHON_MODULE): $(outdir)/config.h $(LO_FILES)
+       $(LD) $(SHARED_FLAGS) -o $@ $(LO_FILES) $(LDFLAGS)
diff --git a/stepmake/stepmake/python-module-targets.make b/stepmake/stepmake/python-module-targets.make
new file mode 100644 (file)
index 0000000..6d4f607
--- /dev/null
@@ -0,0 +1 @@
+default: $(PYTHON_MODULE)
\ No newline at end of file
diff --git a/stepmake/stepmake/python-module-vars.make b/stepmake/stepmake/python-module-vars.make
new file mode 100644 (file)
index 0000000..3722640
--- /dev/null
@@ -0,0 +1,7 @@
+SHARED_LIB_SUFFIX = .so
+
+PYTHON_MODULE = $(outdir)/$(NAME)$(SHARED_LIB_SUFFIX)
+INSTALL_SHARED_LIBRARY = $(SHARED_LIB_PREFIX)$(NAME)$(SHARED_LIB_SUFFIX)
+
+LO_FILES += $(addprefix $(outdir)/, $(Y_FILES:.y=.lo) $(C_FILES:.c=.lo) $(L_FILES:.l=.lo))
+
diff --git a/stepmake/stepmake/shared-library-rules.make b/stepmake/stepmake/shared-library-rules.make
new file mode 100644 (file)
index 0000000..d4256de
--- /dev/null
@@ -0,0 +1,8 @@
+
+$(SHARED_LIBRARY): $(outdir)/config.h $(LO_FILES)
+       $(LD) $(SHARED_FLAGS) -o $@.$(VERSION) $(LO_FILES) $(LDFLAGS)
+       rm -f $@.$(MAJOR_VERSION)
+       ln -sf $(outdir)/$(LIB_PREFIX)$(NAME).so.$(VERSION) $@.$(MAJOR_VERSION)
+       rm -f $@
+       ln -sf $(LIB_PREFIX)$(NAME).so.$(VERSION) $@
+
diff --git a/stepmake/stepmake/shared-library-targets.make b/stepmake/stepmake/shared-library-targets.make
new file mode 100644 (file)
index 0000000..8760232
--- /dev/null
@@ -0,0 +1,3 @@
+
+default: $(SHARED_LIBRARY)
+
diff --git a/stepmake/stepmake/shared-library-vars.make b/stepmake/stepmake/shared-library-vars.make
new file mode 100644 (file)
index 0000000..b4650f5
--- /dev/null
@@ -0,0 +1,11 @@
+SHARED_LIB_PREFIX = lib
+SHARED_LIB_SUFFIX = .so
+
+SHARED_LIBRARY = $(outdir)/$(SHARED_LIB_PREFIX)$(NAME)$(SHARED_LIB_SUFFIX)
+INSTALL_SHARED_LIBRARY = $(SHARED_LIB_PREFIX)$(NAME)$(SHARED_LIB_SUFFIX)
+
+lo-dep-out = $(outdir)/$(subst .lo,.dep,$(notdir $@))#
+DO_LO_DEP = rm -f $(lo-dep-out); DEPENDENCIES_OUTPUT="$(lo-dep-out) $(outdir)/$(notdir $@)"
+
+LO_FILES += $(addprefix $(outdir)/, $(Y_FILES:.y=.lo) $(C_FILES:.c=.lo) $(L_FILES:.l=.lo))
+