# Generated automatically from Makefile.in by configure.
#
#  Copyright (c) 1991-1993 Regents of the University of California.
#  All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
#    notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
#    notice, this list of conditions and the following disclaimer in the
#    documentation and/or other materials provided with the distribution.
# 3. All advertising materials mentioning features or use of this software
#    must display the following acknowledgement:
#	This product includes software developed by the Computer Systems
#	Engineering Group at Lawrence Berkeley Laboratory.
# 4. Neither the name of the University nor of the Laboratory may be used
#    to endorse or promote products derived from this software without
#    specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
#
# @(#) $Header: /work/projects/tove/cvs/src/testing/vat/Makefile,v 1.2 1998/12/01 15:38:37 uimonen Exp $ (LBL)
#

.SUFFIXES: .cc $(.SUFFIXES)

ALL = vat
all:	$(ALL)

.cc.o:
	rm -f $@; $(C++) -c $(CFLAGS) $*.cc

.c.o:
	rm -f $@; $(CC) -o $@ -c $(CFLAGS) $*.c

CC = gcc
C++ = c++
TABCC = $(CC) -O0
CCOPT = -O2 -m486

INCLUDE_TK = -I/usr/home/uimonen/lib/tk4.2/unix/include
INCLUDE_TCL = -I/usr/home/uimonen/lib/tcl7.6/unix/include
INCLUDE_GSM = -I/usr/home/uimonen/gsm-1.0-pl9/inc
INCLUDE_X11 = 
INCLUDE_MISC = 

STATIC = 
MKDEP = ./mkdep



LIBRARY_TK = /usr/home/uimonen/lib/tk4.2/unix/lib/tk
LIBRARY_TCL = /usr/home/uimonen/lib/tcl7.6/unix/lib/tcl
TK_LIBRARY_FILES = \
		$(LIBRARY_TCL)/init.tcl \
		$(LIBRARY_TK)/tk.tcl \
		$(LIBRARY_TK)/button.tcl \
		$(LIBRARY_TK)/dialog.tcl \
		$(LIBRARY_TK)/entry.tcl \
		$(LIBRARY_TK)/focus.tcl \
		$(LIBRARY_TK)/listbox.tcl \
		$(LIBRARY_TK)/menu.tcl \
		$(LIBRARY_TK)/palette.tcl \
		$(LIBRARY_TK)/scale.tcl \
		$(LIBRARY_TK)/tearoff.tcl \
		$(LIBRARY_TK)/text.tcl \
		$(LIBRARY_TK)/optMenu.tcl $(LIBRARY_TK)/scrlbar.tcl

LIB_AUDIO = 
INCLUDE_AUDIO = 
OBJ_AUDIO =    audio-voxware.o
OBJ_CRYPT = 
SRC_AUDIO = $(OBJ_AUDIO:.o=.cc) 
LIB = $(LIB_AUDIO) /usr/home/uimonen/lib/tk4.2/unix/lib/libtk.a /usr/home/uimonen/lib/tcl7.6/unix/lib/libtcl.a /usr/home/uimonen/gsm-1.0-pl9/lib/libgsm.a -L/usr/X11R6/lib -lX11  -lnsl -ldl -lm
INCLUDE = $(INCLUDE_MISC) $(INCLUDE_AUDIO) $(INCLUDE_TK) $(INCLUDE_TCL) \
	$(INCLUDE_X11) $(MD_INC)
DEFINE =  -DSIGRET=void -DFRAMESIZE=160
BFLAGS = $(DEFINE) $(INCLUDE)
CFLAGS = $(CCOPT) $(BFLAGS)

#
# Remember to add a dependency if you add any tcl sources here.
#
TCL_VAT = tkerror.tcl entry.tcl ui-main.tcl ui-resource.tcl ui-util.tcl \
	ui-stats.tcl ui-audio.tcl ui-unix.tcl \
	cf-main.tcl cf-network.tcl cf-util.tcl cf-confbus.tcl 
TCL_VAT_C = $(TCL_VAT:.tcl=.cc)

#
# These modules are broken in libg++.  Rather than fix libg++
# every time I install it on a given system, just make them
# here (these sources came from tcl's compat directory)
#
BROKEN_OBJ = 

OBJ1 =	inet.o tonetab.o adpcm.o lpc.o tkStripchart.o md5c.o random.o vat-gsm.o
OBJ2 =	session.o session-vat.o source.o audio.o controller.o \
	crypt.o crypt-dull.o filter.o group-ipc.o iohandler.o main.o \
	net.o net-atm.o text2atm.o net-ip.o observe.o sitebox.o confbus.o \
	audio-sock.o ss.o timer.o idlecallback.o Tcl.o Tcl2.o tkwidget.o \
	vu.o wiener.o media-timer.o transmitter.o rate-variable.o \
	encoder.o encoder-lpc.o encoder-adpcm.o encoder-gsm.o \
	decoder.o decoder-lpc.o decoder-adpcm.o decoder-gsm.o
OBJ3 =	tabmulaw.o tabmix.o tabsmix.o tabmulawx.o
OBJ4 =	$(TCL_VAT:.tcl=.o) tk.o version.o
SRC =	$(OBJ1:.o=.c) $(OBJ2:.o=.cc) $(OBJ_ARCH:.o=.cc) $(OBJ_AUDIO:.o=.cc) \
	$(OBJ_CRYPT:.o=.cc)
OBJ =	$(OBJ1) $(OBJ2) $(OBJ3) $(OBJ4) $(OBJ_ARCH) $(BROKEN_OBJ) \
	$(OBJ_AUDIO) $(OBJ_CRYPT)
SRC3 =	$(OBJ3:.o=.c)

vat:	$(OBJ)
	$(C++) $(CFLAGS) $(LDFLAGS) -o $@ $(OBJ) $(LIB) $(STATIC)

#
# Compile without optimzation to work around an OSF compiler bug.
#
Tcl2.o: Tcl.h
	rm -f $@
	$(C++) -c $(BFLAGS) Tcl2.cc

#
# Compile without optimzation to work around an SCO compiler bug.
#
main.o: main.cc
	rm -f $@
	$(C++) -c $(BFLAGS) main.cc

#
# pass-1 embedded tcl files
#
tk.o: $(TK_LIBRARY_FILES) tcl2c++
	base=tk; rm -f $@ $$base.cc ; \
		./tcl2c++ 1 $(TK_LIBRARY_FILES) > $$base.cc ; \
		$(C++) -o $@ -c $(CFLAGS) $$base.cc ; rm -f $$base.cc

#
# pass-2 embedded tcl files
#
TCL_VAT_OBJS=$(TCL_VAT:.tcl=.o)
$(TCL_VAT_OBJS): tcl2c++
	base=$(@:.o=); rm -f $@ $$base.cc ; \
		./tcl2c++ 2 $$base.tcl > $$base.cc ; \
		$(C++) -o $@ -c $(CFLAGS) $$base.cc ; rm -f $$base.cc

tkerror.o: tkerror.tcl
entry.o: entry.tcl
ui-main.o: ui-main.tcl
ui-audio.o: ui-audio.tcl
ui-util.o: ui-util.tcl
ui-stats.o: ui-stats.tcl
ui-resource.o: ui-resource.tcl
ui-unix.o: ui-unix.tcl
cf-main.o: cf-main.tcl
cf-network.o: cf-network.tcl
cf-util.o: cf-util.tcl
cf-confbus.o: cf-confbus.tcl

version.c: VERSION
	rm -f version.c
	cat VERSION | sed 's/.*/char version[] = "&";/' > version.c

$(OBJ3): $(SRC3)
	$(TABCC) $(RFLAG) -c $*.c

$(SRC3): mktab.c
	$(CC) $(CFLAGS) -o mktab mktab.c $(LIB) $(STATIC)
	rm -f $(SRC3)
	./mktab -mulaw > tabmulaw.c
	./mktab -sum > tabmix.c
	./mktab -scale > tabsmix.c
	./mktab -muX > tabmulawx.c
	rm -f mktab

vat-gsm.o: vat-gsm.c
	rm -f $@; $(CC) -o $@ -c $(INCLUDE_GSM) $(CFLAGS) $*.c

tar: force
	tar=vatbin-`cat VERSION`-linux.tar.gz ; \
	rm -f $$tar ; \
	tar cfh - README CHANGES.html vat.1  $(ALL) | \
		gzip -c > $$tar

srctar: force
	@cwd=`pwd` ; dir=`basename $$cwd` ; \
	    name=vat-`cat VERSION | tr A-Z a-z` ; \
	    tar=vatsrc-`cat VERSION`.tar.gz ; \
	    list="" ; \
	    for i in `cat FILES` ; do list="$$list $$name/$$i" ; done; \
	    echo \
	    "(rm -f $$tar; cd .. ; ln -s $$dir $$name)" ; \
	     (rm -f $$tar; cd .. ; ln -s $$dir $$name) ; \
	    echo \
	    "(cd .. ; tar cfh $$tar [lots of files])" ; \
	     (cd .. ; tar cfh - $$list) | gzip -c > $$tar ; \
	    echo \
	    "rm ../$$name; chmod 444 $$tar" ;  \
	     rm ../$$name; chmod 444 $$tar

install: force
	 cp vat /usr/local/bin/vat; \
	 chown bin /usr/local/bin/vat; \
	 chgrp bin /usr/local/bin/vat; \
	 chmod 555 /usr/local/bin/vat

install-man: force
	cp vat.1 /usr/local/man/man1/vat.1
	chown bin /usr/local/man/man1/vat.1
	chgrp bin /usr/local/man/man1/vat.1
	chmod 444 /usr/local/man/man1/vat.1

CLEAN = vat core core.vat tcl2c++ config.log config.cache
clean:
	rm -f $(CLEAN) $(OBJ1) $(OBJ2) $(OBJ4) $(OBJ_AUDIO) $(OBJ_CRYPT) \
	      $(TCL_VAT_C)

c++-clean:
	rm -f $(OBJ2) $(OBJ_AUDIO)

realclean:
	rm -f $(CLEAN) $(OBJ) tags \
		mktab tabmix.c tabmulaw.c tabsmix.c tabmulawx.c

force:

tags:	$(SRC)
	./systags.sh

depend:
	./mkdep $(INCLUDE) $(DEFINE) $(INCLUDE_GSM) $(SRC)
