
################################################################################
# Makefile generated by DialogBlocks
#
# Available configurations:
# debug
# release
# unicodedebug
# unicoderelease
################################################################################

CONFIG=unicodedebug

WX_CONFIG=/usr/bin/wx-config

# debug
ifeq ($(CONFIG),debug)
#Override - debug isn't standard
WXWIN=/usr/src/wxwidgets2.8-2.8.7.1
WX_CONFIG=$(WXWIN)/GCCBuildDebugGTK2/wx-config
TOOLCHAINNAME=gtk2d
WXVERSION:=$(shell echo `$(WX_CONFIG) --version`)
CXX=g++
CC=gcc
RESCOMP=windres.exe
RCFILEOBJ=pwsafe_rc.o
RCFILESRC=pwsafe.rc
RESOURCEOBJECT=
OUTPUTPATH=GCCDebug
OBJECTPATH=GCCDebug
BUILDPATHS=$(OBJECTPATH)
PROGRAM=pwsafe
LIBS=`$(WX_CONFIG) --debug=yes --unicode=no --libs` -lcore -los -luuid -lXtst -lX11
LINKERFLAGS=
WARNINGFLAGS=-Wall
OPTFLAGS=-O0
DEBUGFLAGS=-ggdb -D_DEBUG
LIBPATH=../../../lib/debug
CPPINC=`$(WX_CONFIG) --debug=yes --unicode=no --inplace --cxxflags`
GCCFLAGS=
LIBDIRNAME=$(WXWIN)/GCCBuildDebugGTK2/lib
RESPATH=--include-dir "$(WXWIN)/include" --include-dir "$(WXWIN)/contrib/include" --include-dir "$(WXWIN)/GCCBuildDebugGTK2/lib/wx/include/gtk2-ansi-debug-static-2.6"
MACPACKAGEINFO=

# release
else
ifeq ($(CONFIG),release)
WXWIN=/usr/src/wxwidgets2.8-2.8.7.1
TOOLCHAINNAME=gtk2
WXVERSION:=$(shell echo `$(WX_CONFIG) --debug=no --unicode=no --version`)
CXX=g++
CC=gcc
RESCOMP=windres.exe
RCFILEOBJ=pwsafe_rc.o
RCFILESRC=pwsafe.rc
RESOURCEOBJECT=
OUTPUTPATH=GCCRelease
OBJECTPATH=GCCRelease
BUILDPATHS=$(OBJECTPATH)
PROGRAM=pwsafe
LIBS=`$(WX_CONFIG) --debug=no --unicode=no --inplace --libs` -lcore -los -luuid -lXtst -lX11
LINKERFLAGS=
WARNINGFLAGS=-Wall
OPTFLAGS=-O
DEBUGFLAGS=
LIBPATH=../../../lib/release
CPPINC=`$(WX_CONFIG) --debug=no --unicode=no --inplace --cxxflags`
GCCFLAGS=
LIBDIRNAME=$(WXWIN)/GCCBuildReleaseGTK2/lib
RESPATH=--include-dir "$(WXWIN)/include" --include-dir "$(WXWIN)/contrib/include" --include-dir "$(WXWIN)/GCCBuildReleaseGTK2/lib/wx/include/gtk2-ansi-release-static-2.6"
MACPACKAGEINFO=

# unicodedebug
else
ifeq ($(CONFIG),unicodedebug)
WXWIN=/usr/src/wxwidgets2.8-2.8.7.1
TOOLCHAINNAME=gtk2ud
WXVERSION:=$(shell echo `$(WX_CONFIG) --debug=yes --unicode=yes --version`)
CXX=g++
CC=gcc
RESCOMP=windres.exe
RCFILEOBJ=pwsafe_rc.o
RCFILESRC=pwsafe.rc
RESOURCEOBJECT=
OUTPUTPATH=GCCUnicodeDebug
OBJECTPATH=GCCUnicodeDebug
BUILDPATHS=$(OBJECTPATH)
PROGRAM=pwsafe
LIBS=`$(WX_CONFIG) --debug=yes --unicode=yes --inplace --libs` -lcore -los -luuid -lXtst -lX11
LINKERFLAGS=
WARNINGFLAGS=-Wall
OPTFLAGS=-O0
DEBUGFLAGS=-ggdb -D_DEBUG
LIBPATH=../../../lib/unicodedebug
CPPINC=`$(WX_CONFIG) --debug=yes --unicode=yes --inplace --cxxflags` -DUNICODE
XERCESCPPFLAGS=-DUSE_XML_LIBRARY=XERCES -DWCHAR_INCOMPATIBLE_XMLCH
XERCESLIBFLAGS=-lxerces-c
GCCFLAGS=
LIBDIRNAME=$(WXWIN)/GCCBuildDebugGTK2Unicode/lib
RESPATH=--include-dir "$(WXWIN)/include" --include-dir "$(WXWIN)/contrib/include" --include-dir "$(WXWIN)/GCCBuildDebugGTK2Unicode/lib/wx/include/gtk2-unicode-debug-static-2.6"
MACPACKAGEINFO=

# unicoderelease
else
WXWIN=/usr/src/wxwidgets2.8-2.8.7.1
TOOLCHAINNAME=gtk2u
WXVERSION:=$(shell echo `$(WX_CONFIG) --debug=no --unicode=yes --version`)
CXX=g++
CC=gcc
RESCOMP=windres.exe
RCFILEOBJ=pwsafe_rc.o
RCFILESRC=pwsafe.rc
RESOURCEOBJECT=
OUTPUTPATH=GCCUnicodeRelease
OBJECTPATH=GCCUnicodeRelease
BUILDPATHS=$(OBJECTPATH)
PROGRAM=pwsafe
LIBS=`$(WX_CONFIG) --debug=no --unicode=yes --inplace --libs` -lcore -los -luuid -lXtst -lX11
LINKERFLAGS=
WARNINGFLAGS=-Wall
OPTFLAGS=-O
DEBUGFLAGS=
LIBPATH=../../../lib/unicoderelease
CPPINC=`$(WX_CONFIG) --debug=no --unicode=yes --inplace --cxxflags` -DUNICODE
XERCESCPPFLAGS=-DUSE_XML_LIBRARY=XERCES -DWCHAR_INCOMPATIBLE_XMLCH
XERCESLIBFLAGS=-lxerces-c
GCCFLAGS=
LDFLAGS=$(LIBS) -L$(LIBPATH) $(LINKERFLAGS)
RESPATH=--include-dir "$(WXWIN)/include" --include-dir "$(WXWIN)/contrib/include" --include-dir "$(WXWIN)/GCCBuildReleaseGTK2Unicode/lib/wx/include/gtk2-unicode-release-static-2.6"
MACPACKAGEINFO=
endif
endif
endif

DEPDIR= ./deps

CPPINC += -I../..

LDFLAGS=$(LIBS) -L$(LIBPATH) $(LINKERFLAGS) $(XERCESLIBFLAGS)
CPPFLAGS=$(CPPINC) $(GCCFLAGS) $(DEBUGFLAGS) $(OPTFLAGS) $(WARNINGFLAGS) $(XERCESCPPFLAGS)

SOURCES= passwordsafeframe.cpp \
	pwsafeapp.cpp safecombinationentry.cpp \
	safecombinationsetup.cpp safecombinationprompt.cpp \
	safecombinationchange.cpp about.cpp \
	properties.cpp PWSgrid.cpp \
	PWStree.cpp version.cpp \
	pwsclip.cpp mainEdit.cpp \
	addeditpropsheet.cpp PWSgridtable.cpp \
	optionspropsheet.cpp PasswordSafeSearch.cpp \
	deleteconfirmation.cpp editshortcut.cpp \
	createshortcutdlg.cpp SystemTray.cpp \
	RUEList.cpp guiinfo.cpp ImportTextDlg.cpp \
	ImportXmlDlg.cpp OpenFilePickerValidator.cpp \
	SafeCombinationCtrl.cpp ExportTextWarningDlg.cpp \
	AdvancedSelectionDlg.cpp ViewReport.cpp dragbar.cpp \
	PWSDragBar.cpp MergeDlg.cpp ExternalKeyboardButton.cpp \
	PwsSync.cpp DbSelectionPanel.cpp


OBJECTS=$(SOURCES:%.cpp=$(OBJECTPATH)/%.o)
OBJECTS += $(RESOURCEOBJECT)


all:	$(BUILDPATHS) $(MACPACKAGEINFO) $(OUTPUTPATH)/$(PROGRAM)

debug release unicodedebug unicoderelease:
	$(MAKE) all CONFIG=$@

$(OBJECTPATH):
	mkdir -p $(OBJECTPATH)

clean:
	@rm -f $(OBJECTPATH)/*.o
	@rm -f $(OBJECTPATH)/*.res
	@rm -fr .deps .pch
	@rm -fr $(PROGRAM).app
	@rm -f $(OUTPUTPATH)/$(PROGRAM)
	@rm -rf $(DEPDIR)
	@rm -f version.h

help:
	@echo "Usage: make -f Makefile CONFIG=[debug|release|unicodedebug|unicoderelease] [all|clean|help]"

LIBRARIES=$(LIBPATH)/libcore.a $(LIBPATH)/libos.a

$(OUTPUTPATH)/$(PROGRAM):	$(OBJECTS) $(LIBRARIES)
	$(CXX) -o $@ $(OBJECTS) $(LDFLAGS)


$(OBJECTPATH)/%.o : %.cpp
	$(CXX) -c -o $@ $(CPPFLAGS) $<

# Windows only
$(OBJECTPATH)/$(RCFILEOBJ):	$(RCFILESRC)
	$(RESCOMP) --use-temp-file -i$< -o$@ $(RESPATH) --include-dir . --define NOPCH

# Mac only
$(OUTPUTPATH)/$(PROGRAM).app/Contents/PkgInfo: $(OUTPUTPATH)/$(PROGRAM) $(INFOPLISTSOURCE) $(ICNSSOURCE)
	mkdir -p $(OUTPUTPATH)/$(PROGRAM).app/Contents
	mkdir -p $(OUTPUTPATH)/$(PROGRAM).app/Contents/MacOS
	mkdir -p $(OUTPUTPATH)/$(PROGRAM).app/Contents/Resources
	sed -e "s/IDENTIFIER/$(PROGRAM)/" \
	-e "s/EXECUTABLE/$(PROGRAM)/" \
	-e "s/VERSION/$(WXVERSION)/" \
	$(INFOPLISTSOURCE) >$(OUTPUTPATH)/$(PROGRAM).app/Contents/Info.plist
	echo -n "APPL????" >$(OUTPUTPATH)/$(PROGRAM).app/Contents/PkgInfo
	ln -f $(OUTPUTPATH)/$(PROGRAM) $(OUTPUTPATH)/$(PROGRAM).app/Contents/MacOS/$(PROGRAM)
	cp -f $(ICNSSOURCE) $(ICNSDEST)

$(DEPDIR)/%.d: %.cpp version.h
	@set -e; mkdir -p $(DEPDIR); $(RM) $@; \
	$(CXX) -MM $(CPPFLAGS) $< > $@.$$$$; \
	sed 's,\($*\)\.o[ :]*,$(OBJECTPATH)/\1.o $@ : ,g' < $@.$$$$ > $@; \
	$(RM) $@.$$$$

version.h: always
	@../../../Misc/mkversion.pl version.in $@

-include $(SOURCES:%.cpp=$(DEPDIR)/%.d)


.PHONY:	all clean help always
### Begin DialogBlocks generated body
### End DialogBlocks generated body
