#---------------------------------------------------------------------
#     Copyright (C) GFD Dennou Club, 2005. All rights reserved.
#---------------------------------------------------------------------
#= Makefile for dcpam/src/shared
#
#   * Developers: Yasuhiro MORIKAWA
#   * Version: $Id: Makefile,v 1.13 2005/06/17 15:08:39 morikawa Exp $
#   * Tag Name: $Name: dcpam2-20050623-4 $
#   * Change History: 
#
######################################################################
#
#== Settings

INCLUDEFILE = ../../Config.mk
include $(INCLUDEFILE)

SUBDIRS = type nmlfile constants time grid spml \
	  axis varinfo io dynamics hs94forcing # physics
DOCBASE = shared

# End Settings
######################################################################

######################################################################
#== Rules

all:
	@for i in $(SUBDIRS) ; do \
	  cd $$i ; \
	  $(MAKE); \
	  cd .. ; \
	done

doc:
	@for i in $(SUBDIRS) ; do \
	  cd $$i ; \
	  $(MAKE) $@; \
	  cd .. ; \
	done

htm:
	@for i in $(SUBDIRS) ; do \
	  cd $$i ; \
	  $(MAKE) $@; \
	  cd .. ; \
	done

pdf:
	rm -f $(DOCBASE).rd
	@for i in $(SUBDIRS) ; do \
	  sed 's/^[	 ]*!//' $$i/*f90 >> $(DOCBASE).rd ; \
	done
	$(RD2LATEX) $(DOCBASE).rd > $(DOCBASE).tex
	rm -f $(DOCBASE).rd
	$(JLATEX) $(DOCBASE).tex ; $(JLATEX) $(DOCBASE).tex
	rm -f $(DOCBASE).aux $(DOCBASE).toc $(DOCBASE).log
	$(DVI2PDF) $(DOCBASE).dvi

clean:
	@for i in $(SUBDIRS) ; do \
	  cd $$i ; \
	  $(MAKE) $@; \
	  cd .. ; \
	done
	-$(RM) $(LIBDIR)/$(DCPAMLIB)
	-$(RM) $(MODDIR)/$(MODS)

clean-doc:
	@for i in $(SUBDIRS) ; do \
	  cd $$i ; \
	  $(MAKE) $@; \
	  cd .. ; \
	done
	rm -f $(DOCBASE).tex $(DOCBASE).pdf $(DOCBASE).dvi
