PROG_SOURCE = yktrl.cpp
SOURCE += commandParser.cpp
SOURCE += ykushxs/ykushxs.cpp
SOURCE += ykush/ykush.cpp
SOURCE += ykush2/ykush2.cpp
SOURCE += ykush3/ykush3.cpp
SOURCE += yk_usb_device.cpp
SOURCE += help/ykush_help.cpp
SOURCE += utils/command_parser.cpp
SOURCE += utils/string2val.cpp


SOURCE_FULL = $(addprefix src/, $(SOURCE))
PROG_SOURCE_FULL = $(addprefix src/, $(PROG_SOURCE))
OBJS = $(SOURCE_FULL:.cpp=.o)
PROG_OBJ = $(PROG_SOURCE_FULL:.cpp=.o)

CUR_PATH = $(CURDIR)
INCLUDEPATHS = $(addprefix -I$(CUR_PATH)/, $(dir $(SOURCE_FULL)) hidapi )
LOADPATHS = -L$(CUR_PATH)/hidapi/mingw32
LIBS = -lhidapi
FLAGS = -static-libgcc -static-libstdc++

#Change MinGW exec name to match version instaled in your system
CPP = i686-w64-mingw32-g++
#CPP_WIN32 =  i686-w64-mingw32-g++ 
#CPP_WIN64 =  x86_64-w64-mingw32-g++ 


ykushcmd_win32.exe : $(PROG_OBJ) $(OBJS)
	$(CPP) $(FLAGS) $(LOADPATHS) -o bin/Win32/$@ $(PROG_OBJ) $(OBJS) $(LIBS)

$(PROG_OBJ) :  %.o : %.cpp
	$(CPP) $(FLAGS) $(PREPROCESSOR_DEFS) $(INCLUDEPATHS) -c $< -o $@

$(OBJS) : %.o : %.cpp %.h
	$(CPP) $(FLAGS) $(PREPROCESSOR_DEFS) $(INCLUDEPATHS) -c $< -o $@


clean :
	rm -f bin/Win32/yktrl_win32.exe $(OBJS) $(PROG_OBJ)

