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

# my_port is the unique port name which identifies this particular server
MY_PORT := \"pssmidi\"

EXECUTABLE := pssmidid

DEVICEDEFAULTS := PSSDeviceDefaults.config
DEVICEPARAMS   := PSSDeviceParameters.tab
MESSAGECONFIG  := PSSMessageConfiguration.config
SERVERDEVICECLASS := MIDISoundDevice

AUDIO_TOP := ../..
#
# 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).
#

INCLUDES    := -I. \
	       -I$(AUDIO_TOP)/Includes 

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

LOCAL_FLAGS  = -DMY_PORT=$(MY_PORT) \
	       -DROOT=\"$(SOUNDLIBDIR)\"

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

OBJECTS     := MIDIDevice.o \
	       MIDISoundDevice.o \
	       Message.o \
	       MessageList.o \
	       HardwareServer.o \
	       InitMessageList.o	

TARGET	    := $(EXECUTABLE)

include ../Makefile.common

#
# Targets
#
.PHONY : install

$(EXECUTABLE): $(OBJECTS) $(COMMON_OBJS)
	$(C++) $(C++FLAGS) $(CNFG_C++LDFLAGS) -o $@ $(OBJECTS) $(COMMON_OBJS)

$(COMMON_OBJS):
	$(MAKE) -C ../CommonObjs

install:  $(EXECUTABLE)
	$(MAKEDIRHIER) $(SOUNDLIBDIR)
	install -s -m 0755 $(EXECUTABLE) $(SOUNDLIBDIR)
	install -m 0644 $(DEVICEPARAMS) $(SOUNDLIBDIR)
	install -m 0644 $(DEVICEDEFAULTS) $(SOUNDLIBDIR)
	install -m 0644 $(MESSAGECONFIG) $(SOUNDLIBDIR)
	install -m 0644 YamahaInstruments $(SOUNDLIBDIR)

InitMessageList.C: $(DEVICEPARAMS) $(DEVICEDEFAULTS) $(MESSAGECONFIG) 
	rm -f DeviceSpecificDefs.h
	$(PERL) $(AUDIO_TOP)/ConfigureDeviceServer.perl \
	   	$(DEVICEPARAMS) $(DEVICEDEFAULTS) \
		$(MESSAGECONFIG) $(SERVERDEVICECLASS)
