Construct text `samples' automatically.
[jog] / sounds / Makefile.m4
diff --git a/sounds/Makefile.m4 b/sounds/Makefile.m4
new file mode 100644 (file)
index 0000000..906a41e
--- /dev/null
@@ -0,0 +1,67 @@
+## -*-makefile-*-
+##
+## $Id: Makefile.m4,v 1.1 2002/02/02 19:18:01 mdw Exp $
+##
+## Makefile for sounds subdirectory
+##
+## (c) 2002 Mark Wooding
+##
+
+##----- Licensing notice ----------------------------------------------------
+##
+## This file is part of Jog: Programming for a jogging machine.
+##
+## Jog is free software; you can redistribute it and/or modify
+## it under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 2 of the License, or
+## (at your option) any later version.
+## 
+## Jog is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+## GNU General Public License for more details.
+## 
+## You should have received a copy of the GNU General Public License
+## along with Jog; if not, write to the Free Software Foundation,
+## Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+##----- Revision history ----------------------------------------------------
+##
+## $Log: Makefile.m4,v $
+## Revision 1.1  2002/02/02 19:18:01  mdw
+## Construct text `samples' automatically.
+##
+
+AUTOMAKE_OPTIONS = foreign
+
+changecom
+changequote([[, ]])
+define([[getsamples]], [[dnl
+sed '/^[       ]*\($$2\|#\)/d' <$3SAMPLES | dnl
+  while read tag msg; do $1; done]])
+
+audiodir = @audiodir@
+
+## SAMPLES = syscmd(getsamples([[echo -n " \\
+       $tag.wav"]]))
+SAMPLES = 
+TXTSAMPLES = syscmd(getsamples([[echo -n " \\
+       $tag.txt"]]))
+
+audio_DATA = $(SAMPLES) $(TXTSAMPLES)
+
+EXTRA_DIST = \
+       $(audio_DATA) SAMPLES Makefile.m4
+
+$(TXTSAMPLES): txtsamples.stamp
+
+txtsamples.stamp: SAMPLES
+       getsamples([[echo "$$msg" >$$tag.txt]], [[$]], [[$(srcdir)/]])
+       echo timestamp >txtsamples.stamp
+
+Makefile.am: Makefile.m4 SAMPLES
+       cd $(srcdir) && m4 Makefile.m4 >Makefile.am
+
+CLEANFILES = $(TXTSAMPLES) txtsamples.stamp
+
+##----- That's all, folks ---------------------------------------------------