# -*- Makefile -*-

VST_BASE=@VST_SOURCE_PATH@
VST_SRC_BASE = ${VST_BASE}/public.sdk/source/vst2.x/
VST_SRC = \
	${VST_SRC_BASE}/audioeffectx.cpp \
	${VST_SRC_BASE}/audioeffect.cpp \
	${VST_SRC_BASE}/vstplugmain.cpp
VST_CFLAGS=-I$(VST_BASE)

DG_SRC = \
	@top_srcdir@/src/audiocachefile.cc \
	@top_srcdir@/src/audiocache.cc \
	@top_srcdir@/src/audiocacheeventhandler.cc \
	@top_srcdir@/src/audiocacheidmanager.cc \
	@top_srcdir@/src/audioinputenginemidi.cc \
	@top_srcdir@/src/audiofile.cc \
	@top_srcdir@/src/channel.cc \
	@top_srcdir@/src/channelmixer.cc \
	@top_srcdir@/src/chresampler.cc \
	@top_srcdir@/src/configfile.cc \
	@top_srcdir@/src/configparser.cc \
	@top_srcdir@/src/drumgizmo.cc \
	@top_srcdir@/src/drumkit.cc \
	@top_srcdir@/src/drumkitloader.cc \
	@top_srcdir@/src/drumkitparser.cc \
	@top_srcdir@/src/events.cc \
	@top_srcdir@/src/inputprocessor.cc \
	@top_srcdir@/src/instrument.cc \
	@top_srcdir@/src/instrumentparser.cc \
	@top_srcdir@/src/latencyfilter.cc \
	@top_srcdir@/src/midimapparser.cc \
	@top_srcdir@/src/midimapper.cc \
	@top_srcdir@/src/path.cc \
	@top_srcdir@/src/powerlist.cc \
	@top_srcdir@/src/random.cc \
	@top_srcdir@/src/sample.cc \
	@top_srcdir@/src/semaphore.cc \
	@top_srcdir@/src/saxparser.cc \
	@top_srcdir@/src/staminafilter.cc \
	@top_srcdir@/src/thread.cc \
	@top_srcdir@/src/versionstr.cc
DG_CFLAGS = -I@top_srcdir@ -I@top_srcdir@/include -I@top_srcdir@/src \
	-I@top_srcdir@/plugin/plugingizmo -DVST -DSSE -msse -msse2
# -DDISABLE_HUGIN

GUI_SRC = \
	@top_srcdir@/plugingui/abouttab.cc \
	@top_srcdir@/plugingui/bleedcontrolframecontent.cc \
	@top_srcdir@/plugingui/button.cc \
	@top_srcdir@/plugingui/button_base.cc \
	@top_srcdir@/plugingui/checkbox.cc \
	@top_srcdir@/plugingui/colour.cc \
	@top_srcdir@/plugingui/combobox.cc \
	@top_srcdir@/plugingui/dialog.cc \
	@top_srcdir@/plugingui/directory.cc \
	@top_srcdir@/plugingui/diskstreamingframecontent.cc \
	@top_srcdir@/plugingui/drumkitframecontent.cc \
	@top_srcdir@/plugingui/eventhandler.cc \
	@top_srcdir@/plugingui/filebrowser.cc \
	@top_srcdir@/plugingui/font.cc \
	@top_srcdir@/plugingui/frame.cc \
	@top_srcdir@/plugingui/humanizerframecontent.cc \
	@top_srcdir@/plugingui/humaniservisualiser.cc \
	@top_srcdir@/plugingui/image.cc \
	@top_srcdir@/plugingui/imagecache.cc \
	@top_srcdir@/plugingui/knob.cc \
	@top_srcdir@/plugingui/label.cc \
	@top_srcdir@/plugingui/layout.cc \
	@top_srcdir@/plugingui/led.cc \
	@top_srcdir@/plugingui/lineedit.cc \
	@top_srcdir@/plugingui/listbox.cc \
	@top_srcdir@/plugingui/listboxbasic.cc \
	@top_srcdir@/plugingui/listboxthin.cc \
	@top_srcdir@/plugingui/maintab.cc \
	@top_srcdir@/plugingui/mainwindow.cc \
	@top_srcdir@/plugingui/nativewindow_win32.cc \
	@top_srcdir@/plugingui/painter.cc \
	@top_srcdir@/plugingui/pixelbuffer.cc \
	@top_srcdir@/plugingui/pluginconfig.cc \
	@top_srcdir@/plugingui/powerbutton.cc \
	@top_srcdir@/plugingui/progressbar.cc \
	@top_srcdir@/plugingui/resamplingframecontent.cc \
	@top_srcdir@/plugingui/resource.cc \
	@top_srcdir@/plugingui/scrollbar.cc \
	@top_srcdir@/plugingui/slider.cc \
	@top_srcdir@/plugingui/stackedwidget.cc \
	@top_srcdir@/plugingui/statusframecontent.cc \
	@top_srcdir@/plugingui/tabbutton.cc \
	@top_srcdir@/plugingui/tabwidget.cc \
	@top_srcdir@/plugingui/textedit.cc \
	@top_srcdir@/plugingui/texture.cc \
	@top_srcdir@/plugingui/texturedbox.cc \
	@top_srcdir@/plugingui/timingframecontent.cc \
	@top_srcdir@/plugingui/toggle.cc \
	@top_srcdir@/plugingui/utf8.cc \
	@top_srcdir@/plugingui/verticalline.cc \
	@top_srcdir@/plugingui/visualizerframecontent.cc \
	@top_srcdir@/plugingui/widget.cc \
	@top_srcdir@/plugingui/window.cc \
	@top_srcdir@/plugingui/lodepng/lodepng.cpp

GUI_CPPFLAGS=-I@top_srcdir@/plugingui/ -DUSE_THREAD @GUI_CPPFLAGS@
GUI_LIBS=@GUI_LIBS@

DBG_SRC = \
	@top_srcdir@/hugin/hugin.c \
	@top_srcdir@/hugin/hugin_syslog.c

DBG_CFLAGS=-I../hugin -DWITH_HUG_SYSLOG -DWITH_HUG_MUTEX
# -DDISABLE_HUGIN

#
# http://old.nabble.com/using-VC%2B%2B-.lib-with-mingw-td23151303.html
# Given `-lfoo', the win32 build of GNU ld will search for libfoo.a and foo.lib
#

EXPAT_CFLAGS=@EXPAT_CFLAGS@
EXPAT_LIBS=@EXPAT_LIBS@

SNDFILE_CFLAGS=@SNDFILE_CFLAGS@
SNDFILE_LIBS=@SNDFILE_LIBS@

SRC_CFLAGS=@SAMPLERATE_CFLAGS@
SRC_LIBS=@SAMPLERATE_LIBS@

ZITA_CXXFLAGS=@ZITA_CPPFLAGS@
ZITA_LIBS=@ZITA_LIBS@

CXXFLAGS += -fvisibility=hidden
CFLAGS += -fvisibility=hidden

SRC = \
	@top_srcdir@/plugin/plugingizmo/midievent.cc \
	@top_srcdir@/plugin/plugingizmo/pluginvst.cc \
	drumgizmo_plugin.cc

RES = \
	resources/bg.png \
	resources/bypass_button.png \
	resources/font.png \
	resources/fontemboss.png \
	resources/knob.png \
	resources/logo.png \
	resources/png_error \
	resources/progress.png \
	resources/pushbutton.png \
	resources/sidebar.png \
	resources/slider.png \
	resources/stddev_horizontal.png \
	resources/stddev_horizontal_disabled.png \
	resources/stddev_vertical.png \
	resources/stddev_vertical_disabled.png \
	resources/switch_back_off.png \
	resources/switch_back_on.png \
	resources/switch_front.png \
	resources/tab.png \
	resources/thinlistbox.png \
	resources/topbar.png \
	resources/toplogo.png \
	resources/vertline.png \
	resources/widget.png \
	../ABOUT \
	../AUTHORS \
	../BUGS \
	../COPYING

all:
	g++ @top_srcdir@/plugingui/rcgen.cc -o @top_srcdir@/plugingui/rcgen
	(cd @top_srcdir@/plugingui; ./rcgen $(RES) > resource_data.cc)
	g++ $(CXXFLAGS) @top_srcdir@/plugingui/resource_data.cc -c
	gcc $(CFLAGS) $(DBG_CFLAGS) @top_srcdir@/hugin/hugin.c -c
	gcc $(CFLAGS) $(DBG_CFLAGS) @top_srcdir@/hugin/hugin_syslog.c -c
	g++ $(CXXFLAGS) -std=c++11 -static -static-libgcc -O2 -g -Wall $(DBG_CFLAGS) $(DG_CFLAGS) $(DG_LIBS) $(VST_CFLAGS) hugin.o hugin_syslog.o resource_data.o $(DG_SRC) $(VST_SRC) ${SRC} ${GUI_SRC} ${GUI_CPPFLAGS} $(GUI_LIBS) $(EXPAT_CFLAGS) $(SRC_CFLAGS) $(ZITA_CXXFLAGS) $(EXPAT_LIBS) $(SNDFILE_CFLAGS) $(SNDFILE_LIBS) $(SRC_LIBS) $(ZITA_LIBS) -latomic -shared -Wl,-retain-symbols-file -Wl,drumgizmo_vst.sym -o drumgizmo_vst.dll -Wl,--out-implib,libdrumgizmo_vst.a

clean:
	del -f drumgizmo_vst.dll libdrumgizmo_vst.a