
DESTDIR = 

doxywizard:
	cd addon/doxywizard ; $(MAKE) 

doxysearch:
	cd addon/doxysearch ; $(MAKE) 

doxmlparser:
	cd addon/doxmlparser/src ; $(MAKE)
	cd addon/doxmlparser/test ; $(MAKE)
	cd addon/doxmlparser/examples/metrics ; $(MAKE)

doxyapp:
	cd addon/doxyapp ; $(MAKE) clean

clean: FORCE
	- cd examples ; $(MAKE) clean
	- cd doc ; $(MAKE) clean
	- cd qtools ; $(MAKE) clean
	- cd src ; $(MAKE) clean
	- cd libmd5 ; $(MAKE) clean
	- cd vhdlparser ; $(MAKE) clean
	-cd addon/doxywizard ; $(MAKE) clean
	-cd addon/doxysearch ; $(MAKE) clean
	-cd addon/doxyapp ; $(MAKE) clean
	-cd addon/doxmlparser/src ; $(MAKE) clean
	-cd addon/doxmlparser/test ; $(MAKE) clean
	-cd addon/doxmlparser/examples/metrics ; $(MAKE) clean
	-rm -f bin/doxy*
	-rm -f objects/*/*.o

distclean: clean
	-cd src ; $(MAKE) distclean
	-cd libmd5 ; $(MAKE) distclean
	-cd vhdlparser ; $(MAKE) distclean
	-cd qtools ; $(MAKE) distclean
	-cd addon/doxywizard ; $(MAKE) distclean
	-cd addon/doxysearch ; $(MAKE) distclean
	-cd addon/doxyapp ; $(MAKE) distclean
	-cd addon/doxmlparser/src ; $(MAKE) distclean
	-cd addon/doxmlparser/test ; $(MAKE) distclean
	-cd addon/doxmlparser/examples/metrics ; $(MAKE) distclean
	-rm -rf lib
	-rm -rf bin
	-rm -rf objects
	-rm -rf html
	-rm -rf latex
	-rm -rf man
	-rm -rf docbook
	-rm -rf perlmod
	-rm -rf rtf
	-rm -rf xml
	-rm -f src/Makefile.doxygen src/Makefile.libdoxygen 
	-rm -f src/Makefile.libdoxycfg src/libdoxycfg.t src/libdoxygen.t
	-rm -f libmd5/Makefile.libmd5
	-rm -f vhdlparser/Makefile.vhdlparser
	-rm -f .makeconfig .tmakeconfig
	-rm -f src/doxygen.pro src/libdoxygen.pro qtools/qtools.pro src/libdoxycfg.pro libmd5/libmd5.pro vhdlparser/vhdlparser.pro
	-rm -rf generated_src
	-rm -f addon/doxywizard/doxywizard.pro
	-rm -f VERSION
	-rm -f packages/rpm/doxygen.spec
	-rm -r addon/doxywizard/Makefile
	-rm -f addon/doxysearch/Makefile
	-rm -f addon/doxyapp/Makefile
	-rm -f addon/doxmlparser/src/Makefile
	-rm -f addon/doxmlparser/test/Makefile
	-rm -f addon/doxmlparser/examples/metrics/Makefile
	-rm -f qtools/Makefile src/Makefile examples/Makefile doc/Makefile 
	-rm -f Makefile

DATE=$(shell date "+%B %Y")

MAN1DIR = man/man1

install: doxywizard_install doxysearch_install
	$(INSTTOOL) -d $(DESTDIR)$(INSTALL)/bin
	$(INSTTOOL) -m 755 bin/doxygen        $(DESTDIR)$(INSTALL)/bin
	$(INSTTOOL) -d $(DESTDIR)$(INSTALL)/$(MAN1DIR)
	cat doc/doxygen.1    | sed -e "s/DATE/$(DATE)/g" -e "s/VERSION/$(VERSION)/g" > doxygen.1 
	$(INSTTOOL) -m 644 doxygen.1 $(DESTDIR)$(INSTALL)/$(MAN1DIR)/doxygen.1
	rm doxygen.1

install_docs: 
	$(INSTTOOL) -d $(DESTDIR)$(DOCDIR)
	$(MAKE) -C examples
	$(MAKE) -C doc 
	$(MAKE) -C latex 
	$(INSTTOOL) -m 644 latex/doxygen_manual.pdf $(DESTDIR)$(DOCDIR)
	cp -r examples $(DESTDIR)$(DOCDIR)
	cp -r html $(DESTDIR)$(DOCDIR)

docs: FORCE
	cd examples ; $(MAKE)
	cd doc ; $(MAKE)

pdf: docs
	cd latex ; $(MAKE)

DISTFILES =  Doxyfile vhdlparser libmd5 addon tmake doc examples bin lib objects testing \
             qtools src configure configure.bin Makefile.in Makefile.win_nmake.in \
             Makefile.win_make.in INSTALL LANGUAGE.HOWTO LICENSE PLATFORMS \
             VERSION README.md packages winbuild jquery

archive: clean
	tar zcvf dx`date +%y%m%d`.tgz $(DISTFILES)

DISTDIR = doxygen-`echo $(VERSION) | tr - _`

dist: clean
	rm -rf $(DISTDIR)
	mkdir $(DISTDIR)
	cp -a $(DISTFILES) README $(DISTDIR)
	find $(DISTDIR) \( -name ".svn" \) -print0 | xargs -0 rm -rf
	tar zcvf $(DISTDIR).src.tar.gz $(DISTDIR)
	rm -rf $(DISTDIR)

DISTDIR = doxygen-`echo $(VERSION) | tr - _`
rpm: dist
	gzip -df $(DISTDIR).src.tar.gz
	mkdir $(DISTDIR)
	mkdir $(DISTDIR)/packages
	mkdir $(DISTDIR)/packages/rpm
	cp packages/rpm/doxygen.spec $(DISTDIR)/packages/rpm
	rm -rf $(DISTDIR)
	gzip -9v $(DISTDIR).src.tar
	rpmbuild -ta %%WITHDOXYWIZARD%% $(DISTDIR).src.tar.gz

rpmsrc: dist
	gzip -df $(DISTDIR).src.tar.gz
	mkdir $(DISTDIR)
	mkdir $(DISTDIR)/packages
	mkdir $(DISTDIR)/packages/rpm
	cp packages/rpm/doxygen.spec $(DISTDIR)/packages/rpm
	tar -rvf $(DISTDIR).src.tar $(DISTDIR)/packages/rpm/doxygen.spec
	rm -rf $(DISTDIR)
	gzip -9v $(DISTDIR).src.tar
	rpmbuild -ts %%WITHDOXYWIZARD%% $(DISTDIR).src.tar.gz

rpmbinary: dist
	gzip -df $(DISTDIR).src.tar.gz
	mkdir $(DISTDIR)
	mkdir $(DISTDIR)/packages
	mkdir $(DISTDIR)/packages/rpm
	cp packages/rpm/doxygen.spec $(DISTDIR)/packages/rpm
	tar -rvf $(DISTDIR).src.tar $(DISTDIR)/packages/rpm/doxygen.spec
	rm -rf $(DISTDIR)
	gzip -9v $(DISTDIR).src.tar
	rpmbuild -tb %%WITHDOXYWIZARD%% $(DISTDIR).src.tar.gz


ctags:
	ctags -R -f tags src addon/doxywizard qtools

test: FORCE
	make -C testing

FORCE:

