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 = bach
40
41SAOLFILE = $(FILENAME).saol
42SASLFILE = $(FILENAME).sasl
43MIDIFILE = $(FILENAME).mid
44MP4FILE  = $(FILENAME).mp4
45
46INFILE =
47OUTFILE = output.wav
48
49##
50## Compiler optimization and debug options. Mac OS X users
51## should replace "gcc" with "cc".
52##
53
54CC = gcc
55OPT = -O3
56CFLAGS = $(OPT)
57
58
59SFRONT = sfront
60PLAYER = play
61CMP = cmp
62
63OUTMODE = -aout $(OUTFILE)
64INMODE =
65
66## for INFILE/OUTFILE selections that need libraries
67
68IOLINK =
69
70## for INFILE/OUTFILE std selection:  > foo < bar
71
72REDIRECT =
73
74##
75## makes a raw 16-bit signed integer audio file
76##
77
78$(OUTFILE): $(SAOLFILE) $(MIDIFILE)
79	$(SFRONT) $(OUTMODE) $(INMODE) -orc $(SAOLFILE) -sco $(SASLFILE) -midi $(MIDIFILE)
80	$(CC) $(CFLAGS) sa.c -lm $(IOLINK) -o sa
81	./sa $(REDIRECT)
82
83## tests bitstream creation code, by creating an MP4 file, decoding
84## it, and comparing audio out with audio created by original ASCII
85## files. doesn't work with stdin/stdout.
86
87mp4test	: $(OUTFILE)
88	rm -rf $(MP4FILE) sa.c
89	mv $(OUTFILE) safe
90	$(SFRONT)  -orc $(SAOLFILE) -midi $(MIDIFILE) -sco $(SASLFILE) -bitout $(MP4FILE)
91	$(SFRONT) $(OUTMODE) $(INMODE) -bit $(MP4FILE)
92	$(CC) $(CFLAGS) sa.c -lm $(IOLINK) -o sa
93	./sa $(REDIRECT)
94	$(CMP) $(OUTFILE) safe
95
96## tests a new sfront against an old one. assume safe is the audio
97## created by old sfront.
98
99compare	: $(OUTFILE)
100	$(CMP) $(OUTFILE) safe
101
102safe	: $(OUTFILE)
103	cp $(OUTFILE) safe
104
105## for performance testing
106##
107
108timing	:
109	/usr/bin/time -p ./sa
110
111##
112##
113##
114
115play  : $(OUTFILE)
116	$(PLAYER) $(OUTFILE)
117
118clean:
119	rm -rf sa.c sa audio a*.wav $(MP4FILE) $(OUTFILE) *.info *~ safe
120
121
122
123