all : \
	compile

full: 	build \
	build\win32\
	build\win32\bin \
	build\win32\bin\dia.exe \
	build\win32\bin\diaw.exe \
	build\win32\bin\dia-app.dll \
	build\win32\bin\libdia.dll \
	build\win32\bin\libart_lgpl_2-2.dll \
#	build\win32\bin\libfontconfig-1.dll \
	build\win32\bin\libgtk-win32-2.0-0.dll \
	build\win32\bin\libxml2.dll \
	build\win32\bin\libxslt.dll \
	build\win32\dia \
	build\win32\lib \
	build\win32\lib\locale \
#	build\win32\dia\bondgraph.dll \
	build\win32\dia\chronogram.dll \
	build\win32\dia\custom.dll \
	build\win32\dia\custom_lines.dll \
	build\win32\dia\Database.dll \
	build\win32\dia\drs.dll \
	build\win32\dia\er.dll \
	build\win32\dia\flowchart.dll \
	build\win32\dia\fs.dll \
	build\win32\dia\grafcet.dll \
	build\win32\dia\istar.dll \
	build\win32\dia\jackson.dll \
	build\win32\dia\kaos.dll \
	build\win32\dia\libart.dll \
	build\win32\dia\misc.dll \
	build\win32\dia\network.dll \
	build\win32\dia\sadt.dll \
	build\win32\dia\standard.dll \
	build\win32\dia\uml.dll \
	build\win32\dia\cairo.dll \
	build\win32\dia\cgm.dll \
	build\win32\dia\dxf.dll \
	build\win32\dia\hpgl.dll \
	build\win32\dia\metapost.dll \
	build\win32\dia\pgf.dll \
	build\win32\dia\pixbuf.dll \
	build\win32\dia\pstricks.dll \
	build\win32\dia\shape.dll \
	build\win32\dia\svg.dll \
	build\win32\dia\wmf.dll \
	build\win32\dia\wpg.dll \
	build\win32\dia\xfig.dll \
	build\win32\dia\xslt.dll \
	build\win32\dia-splash.png

compile :
	cd lib
	nmake -nologo -f makefile.msc
	cd ..\app
	nmake -nologo -f makefile.msc
	cd ..\objects
	nmake -nologo -f makefile.msc
	cd ..\plug-ins
	nmake -nologo -f makefile.msc
	cd python
# Comment out the following line, if you want to build without python	
	nmake -nologo -f makefile.msc
	cd ..\..
	cd tests
	nmake -nologo -f makefile.msc
	cd ..\bindings
# Comment out the following line, if you want to build without python	
	nmake -nologo -f makefile.msc
	cd ..

clean :
	del config.h
	cd lib
	nmake -nologo -f makefile.msc clean
	cd ..\app
	nmake -nologo -f makefile.msc clean
	cd ..\objects
	nmake -nologo -f makefile.msc clean
	cd ..\plug-ins
	nmake -nologo -f makefile.msc clean
	cd python
	nmake -nologo -f makefile.msc clean
	cd ..\..
	cd tests
	nmake -nologo -f makefile.msc clean
	cd ..
	
build:
	md build

build\win32: build
	md build\win32
	
build\win32\bin: build\win32
	md build\win32\bin

build\win32\dia: build\win32
	md build\win32\dia
	
build\win32\lib: build\win32
	md build\win32\lib
	
build\win32\lib\locale: build\win32\lib
	md build\win32\lib\locale

build\win32\bin\dia.exe: build\win32\bin app\dia.exe
	copy app\dia.exe build\win32\bin\dia.exe
	
build\win32\bin\diaw.exe: build\win32\bin app\diaw.exe
	copy app\diaw.exe build\win32\bin\diaw.exe

build\win32\bin\dia-app.dll: build\win32\bin app\dia-app.dll
	copy app\dia-app.dll build\win32\bin\dia-app.dll
	
build\win32\bin\libart_lgpl_2-2.dll: build\win32\bin ..\bin\libart_lgpl_2-2.dll
	copy ..\bin\libart_lgpl_2-2.dll build\win32\bin

build\win32\bin\libfontconfig-1.dll: build\win32\bin ..\bin\libfontconfig-1.dll
	copy ..\bin\libfontconfig-1.dll build\win32\bin

build\win32\bin\libdia.dll: lib\libdia.dll
	copy lib\libdia.dll build\win32\bin\libdia.dll

build\win32\bin\libgtk-win32-2.0-0.dll: ..\bin\libgtk-win32-2.0-0.dll
	copy ..\bin\libgtk-win32-2.0-0.dll build\win32\bin
	
build\win32\lib\zlib.dll: build\win32\bin\zlib.dll
	copy ..\lib\zlib.dll build\win32\bin
	
build\win32\bin\libxml2.dll: build\win32\bin ..\bin\libxml2.dll
	copy ..\bin\libxml2.dll build\win32\bin
	
build\win32\bin\libxslt.dll: build\win32\bin ..\bin\libxslt.dll
	copy ..\bin\libxslt.dll build\win32\bin

build\win32\bin\libcharset.dll: build\win32\bin ..\bin\libcharset.dll
	copy ..\bin\libcharset.dll build\win32\bin

build\win32\dia\bondgraph.dll: build\win32\dia objects\bondgraph\bondgraph.dll
	copy objects\bondgraph\bondgraph.dll build\win32\dia	

build\win32\dia\chronogram.dll: build\win32\dia objects\chronogram\chronogram.dll
	copy objects\chronogram\chronogram.dll build\win32\dia
	
build\win32\dia\custom.dll: build\win32\dia objects\custom\custom.dll
	copy objects\custom\custom.dll build\win32\dia
	
build\win32\dia\custom_lines.dll: build\win32\dia objects\custom_lines\custom_lines.dll
	copy objects\custom_lines\custom_lines.dll build\win32\dia

build\win32\dia\Database.dll: build\win32\dia objects\Database\Database.dll
	copy objects\Database\Database.dll build\win32\dia
	
build\win32\dia\drs.dll: build\win32\dia plug-ins\drs\drs.dll
	copy plug-ins\drs\drs.dll build\win32\dia

build\win32\dia\er.dll: build\win32\dia objects\ER\er.dll
	copy objects\ER\er.dll build\win32\dia

build\win32\dia\flowchart.dll: build\win32\dia objects\flowchart\flowchart.dll
	copy objects\flowchart\flowchart.dll build\win32\dia

build\win32\dia\fs.dll: build\win32\dia objects\FS\fs.dll
	copy objects\FS\fs.dll build\win32\dia

build\win32\dia\grafcet.dll: build\win32\dia objects\GRAFCET\grafcet.dll
	copy objects\GRAFCET\grafcet.dll build\win32\dia

build\win32\dia\istar.dll: build\win32\dia objects\Istar\istar.dll
	copy objects\Istar\istar.dll build\win32\dia	
	
build\win32\dia\jackson.dll: build\win32\dia objects\Jackson\jackson.dll
	copy objects\Jackson\jackson.dll build\win32\dia

build\win32\dia\kaos.dll: build\win32\dia objects\KAOS\kaos.dll
	copy objects\KAOS\kaos.dll build\win32\dia

build\win32\dia\libart.dll: build\win32\dia plug-ins\libart\libart.dll
	copy plug-ins\libart\libart.dll build\win32\dia	
	
build\win32\dia\misc.dll: build\win32\dia objects\Misc\misc.dll
	copy objects\Misc\misc.dll build\win32\dia

build\win32\dia\network.dll: build\win32\dia objects\network\network.dll
	copy objects\network\network.dll build\win32\dia

build\win32\dia\sadt.dll: build\win32\dia objects\SADT\sadt.dll
	copy objects\SADT\sadt.dll build\win32\dia	
	
build\win32\dia\standard.dll: build\win32\dia objects\standard\standard.dll
	copy objects\standard\standard.dll build\win32\dia

build\win32\dia\uml.dll: build\win32\dia objects\UML\uml.dll
	copy objects\UML\uml.dll build\win32\dia

build\win32\dia\cairo.dll: build\win32\dia plug-ins\cairo\cairo.dll
	copy plug-ins\cairo\cairo.dll build\win32\dia

build\win32\dia\cgm.dll: build\win32\dia plug-ins\cgm\cgm.dll
	copy plug-ins\cgm\cgm.dll build\win32\dia

build\win32\dia\dxf.dll: build\win32\dia plug-ins\dxf\dxf.dll
	copy plug-ins\dxf\dxf.dll build\win32\dia

build\win32\dia\hpgl.dll: build\win32\dia plug-ins\hpgl\hpgl.dll
	copy plug-ins\hpgl\hpgl.dll build\win32\dia

build\win32\dia\metapost.dll: build\win32\dia plug-ins\metapost\metapost.dll
	copy plug-ins\metapost\metapost.dll build\win32\dia

build\win32\dia\pgf.dll: build\win32\dia plug-ins\pgf\pgf.dll
	copy plug-ins\pgf\pgf.dll build\win32\dia
	
build\win32\dia\pixbuf.dll: build\win32\dia plug-ins\pixbuf\pixbuf.dll
	copy plug-ins\pixbuf\pixbuf.dll build\win32\dia

build\win32\dia\pstricks.dll: build\win32\dia plug-ins\pstricks\pstricks.dll
	copy plug-ins\pstricks\pstricks.dll build\win32\dia

build\win32\dia\shape.dll: build\win32\dia plug-ins\shape\shape.dll
	copy plug-ins\shape\shape.dll build\win32\dia

build\win32\dia\svg.dll: build\win32\dia plug-ins\svg\svg.dll
	copy plug-ins\svg\svg.dll build\win32\dia

build\win32\dia\wmf.dll: build\win32\dia plug-ins\wmf\wmf.dll
	copy plug-ins\wmf\wmf.dll build\win32\dia

build\win32\dia\wpg.dll: build\win32\dia plug-ins\wpg\wpg.dll
	copy plug-ins\wpg\wpg.dll build\win32\dia

build\win32\dia\xfig.dll: build\win32\dia plug-ins\xfig\xfig.dll
	copy plug-ins\xfig\xfig.dll build\win32\dia

build\win32\dia\xslt.dll: build\win32\dia plug-ins\xslt\xslt.dll
	copy plug-ins\xslt\xslt.dll build\win32\dia	

build\win32\lib\pango: build\win32\lib ..\lib\pango
	md build\win32\lib\pango
	xcopy /s ..\lib\pango\* build\win32\lib\pango\.

build\win32\lib\gtk-2.0: build\win32\lib ..\lib\gtk-2.0
	md build\win32\lib\gtk-2.0
	xcopy /s ..\lib\gtk-2.0\* build\win32\lib\gtk-2.0\.

build\win32\etc: build\win32 ..\etc
	md build\win32\etc
	xcopy /s ..\etc\* build\win32\etc\.	
	
build\win32\dia-splash.png: build\win32 data\dia-splash.png
	copy data\dia-splash.png build\win32

ALL_LINGUAS = am ar ast az be bg bs ca ca@valencia cs da de dz el en_CA en_GB eo es eu fi fr ga gl gu hr hu id is it ja kn ko lt lv mk ml mn mr ms nb ne nl nn oc pa pl pt pt_BR ro ru rw sk sl sq sr sr@Latn sv th tr uk vi zh_CN zh_HK zh_TW	

po: build\win32\locale
 	for %d in ($(ALL_LINGUAS)) do md build\win32\locale\%d
	for %d in ($(ALL_LINGUAS)) do md build\win32\locale\%d\LC_MESSAGES
	for %d in ($(ALL_LINGUAS)) do msgfmt -o build\win32\locale\%d\LC_MESSAGES\dia.mo po\%d.po
	
DOCBOOKDIR = c:\program files\docbook-xsl

XSLTPROC = "c:\gtk\bin\xsltproc.exe"

FOP = "c:\program files\fop\fop.bat"

HHC = "c:\program files\HTML Help Workshop\hhc.exe"

WGET = "c:\gtk\bin\wget.exe"

SED = "c:\gtk\bin\sed.exe"

.IGNORE:
doc: doc\en\dia.xml
	cd doc\en
	$(XSLTPROC) -o index.html "$(DOCBOOKDIR)\htmlhelp\profile-htmlhelp.xsl" dia.xml
	$(HHC) htmlhelp.hhp
	$(XSLTPROC) -o dia-manual.fo "$(DOCBOOKDIR)\fo\profile-docbook.xsl" dia.xml
	$(FOP) dia-manual.fo dia-manual.pdf
	copy htmlhelp.chm ..\..\build\win32\help\C\dia-manual.chm
	copy dia-manual.pdf ..\..\build\win32\help\C\dia-manual.pdf
	cd ..\..\doc\pl
	$(XSLTPROC) -o index.html "$(DOCBOOKDIR)\htmlhelp\profile-htmlhelp.xsl" dia.xml
	$(HHC) htmlhelp.hhp
	$(XSLTPROC) -o dia-manual.fo "$(DOCBOOKDIR)\fo\profile-docbook.xsl" dia.xml
	$(FOP) dia-manual.fo dia-manual.pdf
	copy htmlhelp.chm ..\..\build\win32\help\pl\dia-manual.chm
	copy dia-manual.pdf ..\..\build\win32\help\pl\dia-manual.pdf

faq:
	cd build\win32\help\C
	DEL faqwiki.html
	$(WGET) -O faqwiki.html http://live.gnome.org/Dia/Faq
	$(SED) -f ..\..\..\..\installer\win32\wikifaq2installerfaq.sed faqwiki.html > faq.html
	DEL faqwiki.html

changes:
	echo # Generated by Makefile. Do not edit. > ChangeLog.tmp
	git log --since=2009-04-15 --date=short --pretty=format:" * %ad  %an  <%ae>  %t%n%n    %%s%n%n%b" >> ChangeLog.tmp
