#
# Pablo System: Visual/Src/Audio/Build/Clients/Makefile
#
.PHONY : Makefile ../Makefile.common

# the network audio access daemon runs on this port
NAAD_PORT   := \"naad\"

# this is the name of the sound library
TARGETLIB   := libSonify.a

# you probably won't need to edit anything below this line.

#
# In setting the local definitions, be careful to use the recursive form
# (VAR = VALUE) for all variables that depend on information from the 
# confguration file Makefile.defines in their definition because that isn't
# include until later (by ../Makefile.common).
#

AUDIO_TOP   := ../..

INCLUDES     = -I. \
	       -I$(AUDIO_TOP)/Includes \
	       -I$(AUDIO_TOP)/Clients \
	       -I$(AUDIO_TOP)/../System/Includes \
	       $(X11_INCDIR) \
               $(MOTIF_INCDIR) \
	       $(WCL_INCDIR) 

SRCDIRS     := . \
	       $(AUDIO_TOP)/Clients \
	       $(AUDIO_TOP)/Shared \
	       $(AUDIO_TOP)/CommonClasses \
	       $(AUDIO_TOP)/Transform

LOCAL_FLAGS  = -DNAAD_PORT=$(NAAD_PORT) \
	       -DDEFAULTXAPPLRESDIR=\"$(SOUNDDIR)/app-defaults\"

XSWOBJS     := XSonicWidgetInterface.o \
	       FileReader.o

SYNTHOBJS   := SynthSynth.o \
	       Message.o \
	       MessageList.o \
	       SoundDevice.o \
	       WclInterface.o

COMMONOBJS  := $(addprefix ../CommonObjs/,$(shell cat ../CommonObjs/CommonObjs))

OBJECTS     := $(shell cat ./LibObjs) \
	       $(shell cat $(AUDIO_TOP)/Transform/TransformObjs) \
	       $(COMMONOBJS)

XLIBS        = $(WCL_LIBDIR) $(MOTIF_LIBDIR) $(X11_LIBDIR) \
	       -lXmp -lXm -lWc  -lXmu -lXext -lXt -lX11

TARGET      := all

include ../Makefile.common

#
# Targets
#
.PHONY : all install

all: $(TARGETLIB) sdinterface porsonify demo

sdinterface:   $(SYNTHOBJS) $(COMMONOBJS) 
	$(C++) $(C++FLAGS) $(CNFG_C++LDFLAGS) -o $@ $^  $(XLIBS)  

porsonify:  porsonify.o $(XSWOBJS) $(TARGETLIB)
	$(C++) $(C++FLAGS) $(CNFG_C++LDFLAGS) -o $@ $^  $(XLIBS)  

demo:  demo.o DemoInterface.o FileReader.o $(TARGETLIB)
	$(C++) $(C++FLAGS) $(CNFG_C++LDFLAGS) -o $@ $^  $(XLIBS)  

install:  sdinterface porsonify $(TARGETLIB)
	$(MAKEDIRHIER) $(SOUNDBINDIR)
	$(MAKEDIRHIER) $(SOUNDLIBDIR)
	$(MAKEDIRHIER) $(SOUNDDIR)/app-defaults
	cp -r $(AUDIO_TOP)/app-defaults $(SOUNDDIR)
	install -m 0644 $(TARGETLIB) $(SOUNDLIBDIR)
	install -s -m 0755 sdinterface $(SOUNDBINDIR)
	install -s -m 0755 porsonify $(SOUNDBINDIR)

