1
2
3#    Sfront, a SAOL to C translator
4#    This file: Makefile for an sfront example
5#
6# Copyright (c) 2000-2006, Regents of the University of California
7# All rights reserved.
8#
9# Redistribution and use in source and binary forms, with or without
10# modification, are permitted provided that the following conditions are
11# met:
12#
13#  Redistributions of source code must retain the above copyright
14#  notice, this list of conditions and the following disclaimer.
15#
16#  Redistributions in binary form must reproduce the above copyright
17#  notice, this list of conditions and the following disclaimer in the
18#  documentation and/or other materials provided with the distribution.
19#
20#  Neither the name of the University of California, Berkeley nor the
21#  names of its contributors may be used to endorse or promote products
22#  derived from this software without specific prior written permission.
23#
24# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
25# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
26# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
27# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
28# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
29# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
30# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
31# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
32# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
33# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
34# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
35#
36#    Maintainer: John Lazzaro, lazzaro@cs.berkeley.edu
37
38
39FILENAME = linmidi
40
41SAOLFILE = $(FILENAME).saol
42SASLFILE = $(FILENAME).sasl
43MP4FILE  = $(FILENAME).mp4
44
45INFILE =
46OUTFILE = all
47
48CC = gcc
49OPT = -O3
50CFLAGS = $(OPT)
51SFRONT = sfront
52
53# if artifacts occur try 0.004; for lower latency, try 0.001
54
55OUTMODE = -latency 0.002 -aout linux
56INMODE =
57CNMODE = -cin linmidi
58
59## for INFILE/OUTFILE selections that need libraries
60
61IOLINK =
62
63## for INFILE/OUTFILE std selection:  > foo < bar
64
65REDIRECT =
66
67##
68## makes a raw 16-bit signed integer audio file
69##
70
71$(OUTFILE): $(SAOLFILE)
72	$(SFRONT) $(OUTMODE) $(CNMODE) -orc $(SAOLFILE) -sco $(SASLFILE)
73	$(CC) $(CFLAGS) sa.c -lm $(IOLINK) -o sa
74	./sa $(REDIRECT)
75
76## tests bitstream creation code, by creating an MP4 file, decoding
77## it, and comparing audio out with audio created by original ASCII
78## files. doesn't work with stdin/stdout.
79
80mp4test	: $(OUTFILE)
81	rm -rf $(MP4FILE) sa.c
82	mv $(OUTFILE) safe
83	$(SFRONT) -symtab -orc $(SAOLFILE) -bitout $(MP4FILE)
84	$(SFRONT) $(OUTMODE) $(INMODE) -bit $(MP4FILE)
85	$(CC) $(CFLAGS) sa.c -lm $(IOLINK) -o sa
86	./sa $(REDIRECT)
87	cmp $(OUTFILE) safe
88
89## tests a new sfront against an old one. assume safe is the audio
90## created by old sfront.
91
92compare	: $(OUTFILE)
93	cmp $(OUTFILE) safe
94
95safe	: $(OUTFILE)
96	cp $(OUTFILE) safe
97
98## for performance testing
99##
100
101timing	:
102	./sa $(REDIRECT)
103
104##
105##
106##
107
108## only works on HPUX, for WAV files
109
110play  : $(OUTFILE)
111	splayer $(OUTFILE)
112
113clean:
114	rm -rf sa.c sa audio a*.wav $(MP4FILE) $(OUTFILE) *.info *~ safe
115
116
117
118