#---------------------------------------------------------------------
#     Copyright (C) GFD Dennou Club, 2005. All rights reserved.
#---------------------------------------------------------------------
#
#= Mkinclude of dcpam/
#
#   * Developers: Yasuhiro Morikawa, Masaki Ishiwatari
#   * Version: $Id: Mkinclude,v 1.8 2005/05/21 16:32:10 morikawa Exp $
#   * Tag Name: $Name: dcpam2-20050522-2 $
#   * Change History: 
#

#
#== Directory to which the all files are archived locally
#
DESTDIR = $(HOME)/dcpam2
# These are developer's local settings, should not be here fundamentally...
#DESTDIR = /home/morikawa/DCPAM/dcpam2
#DESTDIR = /home/momoko/util/dcpam2

#
#== Directory to which the all files are installed
#
INSTDIR = /usr/local/dcpam2
# These are developer's local settings, should not be here fundamentally...
#INSTDIR = /home/morikawa/DCPAM
#INSTDIR = /home/momoko/data/dcpam

#
#== Set Commands for basis command
#
#Please edit according to your system.
#
CP         = cp -p
INSTALL    = install -m 644
INSTALLBIN = install -m 755
MKDIR      = mkdir
RM         = rm -f
TAGS       = etags
GUNZIP     = gunzip        # decompression  (equal to "gzip -d")
MAKE       = make
AR         = ar rfv        # AR : Library builder specification
RUBY       = ruby          # for Generation RD documents
RD2        = rd2           # for Generation RD documents
JLATEX     = platex        # for Generation DVI documents
DVI2PDF    = dvipdfm       # for Generation PDF documents
DVI2JPS    = dvi2ps        # for Generation PS documents
LPR        = lpr -s        # for Print out


#
#== Fortran Compiler
#
#Please edit according to your fortran compiler.
#
FRT=frt
#IFORT=ifort
FC=$(FRT)
#
#=== Flags for compile and link
#
FCOPTS_FRT4       = -Am -Kfast,parallel -E fitu
FCOPTS_FRT4_DEBUG = -Am -O0 -g -H aesux -E cg -v95d,95o,95s
FCOPTS_IFORT8     = -O
FCOPTS=$(FCOPTS_FRT4_DEBUG)
#
#=== Options to specify libraries and modules
#
MODOPT=-I
LIBOPT=-L

#
#== Set library names on which dcpam depends.
#
DCPAMLIB        = dcpam
GT4LIB          = gt4f90io
SPMODELLIB      = spml-ssl2
ISPACKLIB       = isp-ffc5
NETCDFLIB       = netcdf-ffc5

#
#== Set locations of libraries on which dcpam depends.
#
#Please edit according to your system.
#
#=== gt4f90io  Library Install Directory
GT4LIBDIR=/usr/lib/gt4f90io-ffc5/lib
# These are developer's local settings, should not be here fundamentally...
#GT4LIBDIR=/home/momoko/f90/lib
#GT4LIBDIR=/home/morikawa/f90/lib
#
#=== gt4f90io  Modules Install Directory
GT4MODDIR=/usr/lib/gt4f90io-ffc5/include
# These are developer's local settings, should not be here fundamentally...
#GT4MODDIR=/home/momoko/f90/include
#GT4MODDIR=/home/morikawa/f90/include
#
#=== spmodel  Library Install Directory
SPMODELLIBDIR=/usr/lib/spml-ssl2-ffc5/lib
#
#=== spmodel  Modules Install Directory
SPMODELMODDIR=/usr/lib/spml-ssl2-ffc5/include
#
#=== spmodel  Library Install Directory
ISPACKLIBDIR=/usr/lib
#
#=== NetCDF Library Install Directory
NETCDFLIBDIR=/usr/lib
#NETCDFLIBDIR=/usr/local/netcdf-ifc/lib
#
#=== NetCDF Modules Install Directory
#NETCDFMODDIR=/usr/local/netcdf/include
#NETCDFMODDIR=/usr/local/netcdf-ifc/include
#
#=== Extensions of modules (".mod" or "MOD" or ".d" or ".f90")
MODEXT=.mod
#
# make clean 時に使用するモジューリ情報ファイル指定
# (F90MODTYPE = hitachi.f90 のときは何も消してはならない)
MODS=*.mod


#
#== Directories to which several files are archived
#
#Don't edit there individually. Please edit "DESTDIR".
#
#=== DEST_MOD : directory to which the module files are archived
#=== DEST_LIB : directory to which the library files are archived
#=== DEST_BIN : directory to which the executable files are archived
#=== DEST_DOC : directory to which the documantations files are archived
DEST_MOD=$(DESTDIR)/include
DEST_LIB=$(DESTDIR)/lib
DEST_BIN=$(DESTDIR)/bin
DEST_DOC=$(DESTDIR)/doc

#
#== Directories to which several files are installed
#
#Don't edit there individually. Please edit "INSTDIR".
#
#=== INST_MOD  : directory to which the module files are installed
#=== INST_LIB  : directory to which the library files are installed
#=== INST_BIN  : directory to which the executable files are installed
#=== INST_DOC  : directory to which the documantation files are installed
INST_MOD=$(INSTDIR)/include
INST_LIB=$(INSTDIR)/lib
INST_BIN=$(INSTDIR)/bin
INST_DOC=$(INSTDIR)/doc


#== RD Document Setting
#
#RUBYLIB = $(DESTDIR)
CSS            = css/dcpam-rd2html.css
RD2HTM_LIB     = $(RD2) -r rd/rd2html-lib
RD2_JA_FLAG    = --html-charset=EUC-JP --with-part=JA:rd
RD2_EN_FLAG    = --html-charset=US-ASCII --with-part=EN:rd
RD2_LIB_FLAG   = --with-part=HTML:include --out-code=euc
RD2HTM_EXT_LIB = $(RD2) -r rd/rd2html-ext-lib
EXT_LIB_FLAG   = --ref-extension --native-inline --head-element # --headline-secno
RD2_CSSFLAG    = --with-css=$(CSS)

RD2HTML        = $(RD2HTM_EXT_LIB) $(RDFLAG) $(RD2_CSSFLAG)
RD2MAN         = $(RD2) -r rd/rd2man-lib.rb
RD2LATEX       = $(RD2) -r rd/rd2latex-lib.rb \
                --documentclass="jarticle" \
                --documentclass-option="titlepage" \
                --title="DCPAM Reference Manual" \
                --author="GFD Dennou Club"  \
                --maketoc     \
                --maketitle

#
#== dcnote command
#
#dcnote is available from
#http://www.gfd-dennou.org/arch/cc-env/dcnote/SIGEN.htm
#
ICONDIR = /usr/lib/dcnote

DCNOTE-PS2GIF= dcnote-ps2gif
DCNOTE-HTMS  = dcnote-htms -s $(ICONDIR)
DCNOTE-LATEX2DESC= dcnote-latex2desc
DCNOTE-MKINDEX= dcnote-mkindex

#
#== latex2html_jp for Dennou.sty
#
#latex2html_jp+dennou is available from
#http://www.gfd-dennou.org/arch/cc-env/latex2html/SIGEN.htm
#
LATEX2HTML = latex2html
LATEX2HTMLOPTIONS = -no_footnode -local_icons -short_extn \
	-bottom_navigation -no_contents_in_navigation -no_auto_link \
	-up_url $(HREFTOPDIR)/index.htm -up_title $(HREFTOPDIRNAME) \
	-split 3 -show_section_numbers -dir $(TARGETHTMDIR) 


#== Suffixes rules for documents
#
.SUFFIXES: .htm .3f .tex .pdf

.f90.htm:
	sed 's/^[	 ]*!//' $< > $<.rd
	$(RD2HTML) $<.rd > $@.tmp || rm -f $@.tmp $<.rd
	mv $@.tmp $@
	rm -f $<.rd

.f90.3f:
	sed 's/^[	 ]*!//' $< > $<.rd
	$(RD2MAN) $<.rd > $@.tmp || rm -f $@.tmp $<.rd
	mv $@.tmp $@
	rm -f $<.rd

.f90.tex:
	sed 's/^[	 ]*!//' $< > $<.rd
	$(RD2LATEX) $<.rd > $@.tmp || rm -f $@.tmp $<.rd
	mv $@.tmp $@
	rm -f $<.rd

.f90.pdf:
	sed 's/^[	 ]*!//' $< > $<.rd
	$(RD2LATEX) $<.rd > $@.tmp || rm -f $@.tmp $<.rd
	mv $@.tmp $@
	rm -f $<.rd
	$(PLATEX) $@ ; $(PLATEX) $@
	rm -f $*.aux $*.toc $*.log
	$(DVI2PDF) $*.dvi
