include $(MAKE_HOME)/defaults.win.mk

CONFIG ?= release
TARGET ?= JaySynth.dll

LIBSRC_PATH ?= $(realpath ../../libsrc)
JUCE_PATH :=  $(realpath ./sdk/juce/JUCE-3.1.1)
VST2_SDK_PATH ?= $(realpath ./sdk/vst/vstsdk2.4)

NAME =: JaySynth

DEFINES := -Dradio_float_t=float -Dfir_float_t=float -Dsynth_float_t=float
DEFINES += -DHAVE_LROUND
CFLAGS += -fPIC
CXXFLAGS += -fPIC
CXXFLAGS += -std=c++11

LIBS := -lwininet -lwinmm -limm32 -lshlwapi -lcomdlg32 -lgdi32 -lole32 -loleaut32 -lversion -lwsock32 -liphlpapi -luuid -lws2_32 -lm -lksuser
LDFLAGS += $(TARGET_ARCH) $(LIBDIR) -L/usr/X11R6/lib/ -shared -static-libstdc++ -static-libgcc -mwindows -s 

DEFINES += -DPROCESSOR_BUFFER_USE_EXCEPTIONS -DDISABLE_UNUSED_STATISTICS
DEFINES_debug += -DDEBUG=1 -D_DEBUG=1
DEFINES_release += -DNDEBUG

INCLUDES += -I $(JUCE_PATH) -I $(JUCE_PATH)/modules -I $(VST2_SDK_PATH) -I $(LIBSRC_PATH)

PACKAGES := JuceLibraryCode Source Synth Fir

export 

all: app
app: objects link

.PHONY: ${PACKAGES}

objects: ${PACKAGES}

Synth:
	@$(MAKE) -C Source/synth -f Makefile.win

Source:
	@$(MAKE) -C $@ -f Makefile.win

JuceLibraryCode:
	@$(MAKE) -C $@ -f Makefile.win

Fir:
	@$(MAKE) -C $(LIBSRC_PATH)/fir -f Makefile.win

include $(MAKE_HOME)/link.mk
