# 
# 	Makefile for SVGAFFT Signal Analyzer for Linux
#
# 	Requires SVGAlib 1.2.x or later 
#
#    	Copyright (C) 1995 Andrew Veliath
#
#    	This program 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.
#
#    	This program 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 this program; if not, write to the Free Software
#    	Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#
# 	$Id: Makefile,v 0.30 1995/05/02 16:04:09 drewvel Exp $ 

# installation options
DESTDIR=/usr/local
BINDIR=$(DESTDIR)/bin
MANDIR=$(DESTDIR)/man

#DEBUG=-ggdb
#PROF=-pg -static
PROC=-m486
OPT=-O6 $(PROC)
FLAGS=-Wall

# if your libraries do not include a built-in boolean (bool) type
# (eg. < libg++ 2.6.2, but untested) then uncomment the next line
#NEEDBOOLS=-DNEEDBOOLS

INSTALL=install

#INCLUDE=-I/usr/g++-include
INCLUDE=

FFTLANG=Fortran

# Fortran FFT routine info
ifeq ($(FFTLANG), Fortran)
FFTDIR=fft
FFT=ffts.o
USEFORTRANFFT=-DUSEFORTRANFFT
# if using f2c uncomment the following
USE_F2C_LIB=-lf2c
endif

DEFINES=$(NEEDBOOLS) $(USEFORTRANFFT)

# c++ compiler settings
CXX=g++
CXXFLAGS=$(DEBUG) $(OPT) $(PROF) $(DEFINES) $(INCLUDE) $(FLAGS) 

# order is important
LIBS=-lvgagl -lvga $(USE_F2C_LIB) -lm 

SVGAOBJS= \
	svgafft.o \
	signal.o \
	display.o \
	svga_display.o \
	s_line_display.o \
	s_bar_display.o \
	s_3d_display.o \
	analyzer.o \
	bars.o \
	screen.o \
	controls.o \
	colors.o \
	helptxt.o

SVGASRCS=$(SVGAOBJS:.o=.cc)

first:
	@echo 
	@echo "Type 'make clean ; make dep ; make all'"
	@echo to build svgafft and install.
	@echo

all: svgafft install

svgafft: $(SVGAOBJS) $(FFTDIR)/$(FFT)
	$(CXX) -o $@ $(SVGAOBJS) $(FFTDIR)/$(FFT) $(LIBS)
ifeq ($(DEBUG),)
	strip $@
endif

$(FFTDIR)/$(FFT):
	cd $(FFTDIR); $(MAKE)

depend dep:
	$(CXX) -M $(SVGASRCS) > .depend

install:
	$(INSTALL) svgafft.1 $(MANDIR)/man1
	$(INSTALL) -m 4755 svgafft $(BINDIR)
	@(cd examples; $(MAKE) install)

cleanall: clean
	cd fft; $(MAKE) clean

clean clobber:
	@echo Initializing nuclear vacuum cleaner...
	-rm -f svgafft *.o *~ .depend
	@echo Cleaned house.

ifeq (.depend,$(wildcard .depend))
include .depend
endif
