BINDIR=/usr/local/bin

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

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

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

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

all:		FSK441 JT44

FSK441:		fsk441gui/fsk441gui.a commongui/commongui.a common/common.a fsk441/fsk441.a
		$(CC) $(LDFLAGS) -o FSK441 fsk441gui/fsk441gui.a commongui/commongui.a fsk441/fsk441.a common/common.a $(LIBS)

JT44:		jt44gui/jt44gui.a commongui/commongui.a common/common.a jt44/jt44.a
		$(CC) $(LDFLAGS) -o JT44 jt44gui/jt44gui.a commongui/commongui.a jt44/jt44.a common/common.a $(LIBS)

JT6M:		jt6mgui/jt6mgui.a commongui/commongui.a common/common.a jt6m/jt6m.a
		$(CC) $(LDFLAGS) -o JT6M jt6mgui/jt6mgui.a commongui/commongui.a jt6m/jt6m.a common/common.a $(LIBS)

fsk441gui/fsk441gui.a:
		make -C fsk441gui

jt44gui/jt44gui.a:
		make -C jt44gui

jt6mgui/jt6mgui.a:
		make -C jt6mgui

commongui/commongui.a:
		make -C commongui

common/common.a:
		make -C common

fsk441/fsk441.a:
		make -C fsk441

jt44/jt44.a:
		make -C jt44

jt6m/jt6m.a:
		make -C jt6m

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

clean:
		rm -f core FSK441 JT44 JT6M *.o *~ *.bak
		make -C common clean
		make -C fsk441 clean
		make -C fsk441gui clean
		make -C jt44 clean
		make -C jt44gui clean
		make -C jt6m clean
		make -C jt6mgui clean
		make -C commongui clean
