CPP  = g++.exe -D__DEBUG__ -DHAVE_MINGW -DHAVE_WIN32
CC   = gcc.exe -D__DEBUG__ -DHAVE_MINGW -DHAVE_WIN32
WINDRES = windres.exe
RES  = wx-console_private.res
OBJ  = main.o console_thread.o authenticate.o console_conf.o wxbrestorepanel.o wxbmainframe.o wxbtableparser.o wxbtreectrl.o wxblistctrl.o wxbutils.o wxbconfigpanel.o wxbconfigfileeditor.o $(RES)
LINKOBJ  = main.o console_thread.o authenticate.o console_conf.o wxbrestorepanel.o wxbmainframe.o wxbtableparser.o wxbtreectrl.o wxblistctrl.o wxbutils.o wxbconfigpanel.o wxbconfigfileeditor.o $(RES)
LIBS =  -L"../lib" -mwindows -Wl,--subsystem,windows -lbac `wx-config --libs`  -g3 /MinGW/lib/libpthreadGC.a
INCS =   -I".."  -I"../lib" -I"../win32/compat/" 
CXXINCS =  -I".."  -I"../lib" -I"../win32/compat/" 
BIN  = wx-console.exe
CXXFLAGS = $(CXXINCS) `wx-config --cppflags` -Wall   -g3
CFLAGS = $(INCS)  -g3

.PHONY: all all-before all-after clean clean-custom

all: all-before wx-console.exe all-after


clean: clean-custom
	rm -f $(OBJ) $(BIN)

$(BIN): $(OBJ) ../lib/libbac.a
	$(CPP) $(LINKOBJ) -o "wx-console.exe" $(LIBS)

../lib/libbac.a: ../lib/*.c*
	(cd ../lib/; make -f Makefile.mingw)
	@rm -f bacula-fd.exe

main.o: main.cpp
	$(CPP) -c main.cpp -o main.o $(CXXFLAGS)

console_thread.o: console_thread.cpp
	$(CPP) -c console_thread.cpp -o console_thread.o $(CXXFLAGS)

authenticate.o: authenticate.c
	$(CPP) -c authenticate.c -o authenticate.o $(CXXFLAGS)

console_conf.o: console_conf.c
	$(CPP) -c console_conf.c -o console_conf.o $(CXXFLAGS)

wxbrestorepanel.o: wxbrestorepanel.cpp
	$(CPP) -c wxbrestorepanel.cpp -o wxbrestorepanel.o $(CXXFLAGS)

wxbmainframe.o: wxbmainframe.cpp
	$(CPP) -c wxbmainframe.cpp -o wxbmainframe.o $(CXXFLAGS)

wxbtableparser.o: wxbtableparser.cpp
	$(CPP) -c wxbtableparser.cpp -o wxbtableparser.o $(CXXFLAGS)
	
wxbtreectrl.o: wxbtreectrl.cpp
	$(CPP) -c wxbtreectrl.cpp -o wxbtreectrl.o $(CXXFLAGS)

wxblistctrl.o: wxblistctrl.cpp
	$(CPP) -c wxblistctrl.cpp -o wxblistctrl.o $(CXXFLAGS)

wxbutils.o: wxbutils.cpp
	$(CPP) -c wxbutils.cpp -o wxbutils.o $(CXXFLAGS)

wxbconfigpanel.o: wxbconfigpanel.cpp
	$(CPP) -c wxbconfigpanel.cpp -o wxbconfigpanel.o $(CXXFLAGS)

wxbconfigfileeditor.o: wxbconfigfileeditor.cpp
	$(CPP) -c wxbconfigfileeditor.cpp -o wxbconfigfileeditor.o $(CXXFLAGS)

wx-console_private.res: wx-console_private.rc 
	$(WINDRES) -i wx-console_private.rc -I rc -o wx-console_private.res -O coff 
