######################################################################
## Filename:      makefile.in
## Version:       1.0
## Description:   Documentation makefile
## Author:        Yannick Copin <y.copin@ipnl.in2p3.fr>
## Created at:    Tue Mar 25 19:02:04 2003
## Modified at:   Thu Mar 27 19:46:17 2003
## Modified by:   Yannick Copin <y.copin@ipnl.in2p3.fr>
######################################################################

topdir = ..
include $(topdir)/add_defs/makedefs

PACKAGE = E3D_Template
VERSION = 1.0a
# Next variables should come from ./configure, to be done
DOXYGEN = doxygen
CTAGS   = ctags -e

DOC = latex/refman.pdf

OUT : TAGS $(DOC)

TAGS.iolib:
	@echo "Creating IO-lib tag file..."
	$(CTAGS) -R -f $@ $(C_ioLIBS_PATH)

TAGS.mathlib:
	@echo "Creating Math-lib tag file..."
	$(CTAGS) -R -f $@ $(C_mathLIBS_PATH)

TAGS: TAGS.iolib TAGS.mathlib
	@echo "Creating local tag file..."
	$(CTAGS) -R $(topdir) \
		--etags-include=TAGS.iolib --etags-include=TAGS.mathlib 

Doxyfile: 
	@echo "Creating Doxygen configuration file Doxyfile..."
	@$(DOXYGEN) -s -g - | sed \
		'/^PROJECT_NAME /s/=.*/= $(PACKAGE)/; \
		 /^PROJECT_NUMBER /s/=.*/= $(VERSION)/; \
		 /^EXTRACT_ALL /s/NO/YES/; \
		 /^FULL_PATH_NAMES /s/NO/YES/; \
		 /^STRIP_FROM_PATH /s|=.*|= \.\./pkg/|; \
		 /^ALIASES /s/=.*/= "copyright=\\par Copyright:\\n"\
				    "keywords=\\par Keywords:\\n"/; \
		 /^OPTIMIZE_OUTPUT_FOR_C /s/NO/YES/; \
		 /^INPUT /s|=.*|= \.\./pkg/|; \
		 /^FILE_PATTERNS /s/=.*/= \*\.c \*\.h/; \
		 /^RECURSIVE /s/NO/YES/; \
		 /^SOURCE_BROWSER /s/NO/YES/; \
		 /^PDF_HYPERLINKS /s/NO/YES/; \
		 /^DOT_IMAGE_FORMAT /s/gif/png/;' > Doxyfile

doc: $(DOC)

$(DOC): Doxyfile
	@echo "Creating Doxygen documentation $(DOC) (see doxygen.log)..."
	@$(DOXYGEN) > doxygen.log 2>&1 && \
		(cd latex; make pdf >> ../doxygen.log 2>&1)

clean:
	-rm -f TAGS.iolib TAGS.mathlib TAGS Doxyfile doxygen.log
	-rm -rf latex html

distclean: clean
	-rm -f makefile
