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

MYOBJS = InitMessageList.o\
	 MIDIDevice.o\
	 MIDISoundDevice.o\
	 TG33SoundDevice.o\
	 Message.o\
	 MessageList.o\
	 HardwareServer.o 

include ../Makefile.defines
include ../Makefile.common

LIBS =


DEVICEDEFAULTS = TG33DeviceDefaults.config
DEVICEPARAMS =  TG33DeviceParams.tab
MESSAGECONFIG = TG33MessageConfiguration.config
SERVERDEVICECLASS = TG33SoundDevice

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

DEPEND_OBJS = $(MYOBJS)

SRCDIRS = .:../../MIDIServer.TG33:$(COMMON_SUBDIRS)
vpath %.cc  $(SRCDIRS)
vpath %.c  $(SRCDIRS)
vpath %.h  .:../Includes:$(SRCDIRS)
vpath %.o  ../CommonObjs

C++FLAGS = -O -I. -I../../Includes -I../../MIDIServer.TG33 $(DEFINES)
CFLAGS   = -O -I. -I../../Includes -I../../MIDIServer.TG33 $(DEFINES)
C++ = g++
CC = cc

default: makedepend tg33midid

tg33midid: $(OBJS)
	$(C++) $(C++FLAGS) -o $@ $(OBJFILES) $(LIBS)

install:  tg33midid
	install -d $(SOUNDLIBDIR)
	install -s tg33midid $(SOUNDLIBDIR)
	install -d $(SOUNDLIBDIR)
	install -m 0644 $(DEVICEPARAMS) $(DEVICEDEFAULTS).tab $(MESSAGECONFIG) $(SOUNDLIBDIR)
	install -m 0644 YamahaTG33Instruments $(SOUNDLIBDIR)
	install -m 0644 YamahaTG33VoiceBanks $(SOUNDLIBDIR)


InitMessageList.cc: $(DEVICEPARAMS) $(DEVICEDEFAULTS) $(MESSAGECONFIG) 
	$(TOP)/ConfigureDeviceServer $(DEVICEPARAMS) $(DEVICEDEFAULTS)\
	$(MESSAGECONFIG) $(SERVERDEVICECLASS)

clean:
	rm -f *.o *.BAK *.CKP *~ core *.dep		
	rm -f tg33midid InitMessageList.cc

%.dep: %.cc
	$(C++) $(C++FLAGS) -M $< > $@

%.dep: %.c
	$(CC) $(CFLAGS) -M $< > $@

%.o: %.cc
	DEPENDENCIES_OUTPUT="$*.dep"; export DEPENDENCIES_OUTPUT; \
	$(C++) $(C++FLAGS) -c $<

%.i: %.cc force
	$(C++) $(C++FLAGS) -E $< | sed '/^[ 	]*$$/d' > $@

makedepend:  $(DEPEND_OBJS:.o=.dep)
	cat *.dep > Makefile.depend

include Makefile.depend

force:
