BINDIR=/usr/local/bin

export CC := $(shell wx-config --cxx)

#
# Set the version of FFTW that you have, here.
#
export FFT_VERS := 3
# export FFT_VERS := 2

ifeq ($(FFT_VERS),3)
    FFT_CFLAGS := -DHAVE_FFTW3=1
    FFT_LIB := -lfftw3
endif

ifeq ($(FFT_VERS),2)
    FFT_CFLAGS := -DHAVE_FFTW2=1
    FFT_LIB := -lfftw
endif

export LDFLAGS := $(shell wx-config --ldflags)

export LIBS := -lsndfile $(FFT_LIB) $(shell wx-config --libs)

export CFLAGS := -O2 -Wall -march=pentium -I.. $(FFT_CFLAGS) $(shell wx-config --cxxflags) -fexceptions

all:		fsk441/FSK441 jt44/JT44

fsk441/FSK441:	common/common.a
		make -C fsk441

jt44/JT44:	common/common.a
		make -C jt44

jt6m/JT6M:	common/common.a
		make -C jt6m

common/common.a:
		make -C common

install:	fsk441/FSK441 jt44/JT44
		install -g bin -o root -m 0775 fsk441/FSK441 $(BINDIR)
		install -g bin -o root -m 0775 jt44/JT44 $(BINDIR)

clean:
		rm -f core *~ *.bak
		make -C common clean
		make -C fsk441 clean
		make -C jt44 clean
		make -C jt6m clean
