1 2# Sfront, a SAOL to C translator 3# This file: Makefile for an sfront example 4# 5# License also applies to SAOL and SASL files. MIDI file is public 6# domain, courtesy of the http://www.mutopiaproject.org project 7# 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 = aatest 40 41SAOLFILE = $(FILENAME).saol 42SASLFILE = $(FILENAME).sasl 43MIDIFILE = $(FILENAME).mid 44MP4FILE = $(FILENAME).mp4 45 46INFILE = 47 48## 49## By default, this is set up to work for Linux. To run one 50## of the other UNIX platform tests, change OUTFILE to be 51## the correct driver name, and see "IOLINK" comment below. 52## 53## OUTFILE = irix ## For SGI IRIX 54## OUTFILE = hpux ## For HPUX 55## OUTFILE = freebsd ## For FreeBSD 56## 57## See the README file in this directory for Microsoft Windows 58## and Macintosh OS X compilation instructions. 59## 60 61OUTFILE = linux 62 63CC = gcc 64OPT = -O3 65CFLAGS = $(OPT) 66SFRONT = sfront 67PLAYER = play 68CMP = cmp 69 70OUTMODE = -aout $(OUTFILE) 71INMODE = 72 73## IOLINK adds linking options for soundcard drivers. The 74## default linux option uses no linking options. 75## 76## 77## IOLINK = -laudio ## For SGI IRIX 78## IOLINK = -lAlib ## For HPUX 79## IOLINK = ## FreeBSD needs no linking options. 80## 81 82IOLINK = 83 84## for INFILE/OUTFILE std selection: > foo < bar 85 86REDIRECT = 87 88## 89## makes a raw 16-bit signed integer audio file 90## 91 92$(OUTFILE): $(SAOLFILE) $(MIDIFILE) 93 $(SFRONT) $(OUTMODE) $(INMODE) -orc $(SAOLFILE) -sco $(SASLFILE) -midi $(MIDIFILE) 94 $(CC) $(CFLAGS) sa.c -lm $(IOLINK) -o sa 95 ./sa $(REDIRECT) 96 97## tests bitstream creation code, by creating an MP4 file, decoding 98## it, and comparing audio out with audio created by original ASCII 99## files. doesn't work with stdin/stdout. 100 101mp4test : $(OUTFILE) 102 rm -rf $(MP4FILE) sa.c 103 mv $(OUTFILE) safe 104 $(SFRONT) -orc $(SAOLFILE) -midi $(MIDIFILE) -sco $(SASLFILE) -bitout $(MP4FILE) 105 $(SFRONT) $(OUTMODE) $(INMODE) -bit $(MP4FILE) 106 $(CC) $(CFLAGS) sa.c -lm $(IOLINK) -o sa 107 ./sa $(REDIRECT) 108 $(CMP) $(OUTFILE) safe 109 110## tests a new sfront against an old one. assume safe is the audio 111## created by old sfront. 112 113compare : $(OUTFILE) 114 $(CMP) $(OUTFILE) safe 115 116safe : $(OUTFILE) 117 cp $(OUTFILE) safe 118 119## for performance testing 120## 121 122timing : 123 /usr/bin/time -p ./sa 124 125## 126## 127## 128 129play : $(OUTFILE) 130 $(PLAYER) $(OUTFILE) 131 132clean: 133 rm -rf sa.c sa audio a*.wav $(MP4FILE) $(OUTFILE) *.info *~ safe 134 135 136 137