[modes]
modes = static-pgi
        shared-gnu static-gnu tests-gnu
        shared-gnu-debug static-gnu-debug tests-gnu-debug
        shared-intel static-intel tests-intel
        shared-intel-debug static-intel-debug tests-intel-debug
        shared-ibm static-ibm tests-ibm
        shared-ibm-debug static-ibm-debug tests-ibm-debug

[common-variables]
$CSHARED_GNU = -c -fPIC -frealloc-lhs
$CSHARED_INT = -c -fpic -assume realloc_lhs
$CSHARED_IBM = -c -qpic -qmkshrobj -qxlf2003=autorealloc
$LSHARED     = -shared
$CSTATIC_GNU = -c -frealloc-lhs
$CSTATIC_INT = -c -assume realloc_lhs
$CSTATIC_IBM = -c -qxlf2003=autorealloc
$DEBUG_GNU   = -Og -g3 -Warray-bounds -Wcharacter-truncation -Wline-truncation -Wimplicit-interface -Wimplicit-procedure -Wunderflow -Wuninitialized -fcheck=all -fmodule-private -ffree-line-length-132 -fimplicit-none -fbacktrace -fdump-core -finit-real=nan -std=f2008 -fall-intrinsics
$DEBUG_INT   = -O0 -debug all -check all -warn all -extend-source 132 -traceback -gen-interfaces#-fpe-all=0 -fp-stack-check -fstack-protector-all -ftrapuv -no-ftz -std08
$DEBUG_IBM   = -qcheck=all -qdbg=level=9
$OPTIMIZE    = -O2

# main modes
[shared-gnu]
template  = template-shared-gnu
target    = src/lib/penf.F90
build_dir = ./shared/
output    = penf.so
mklib     = shared

[static-gnu]
template  = template-static-gnu
target    = src/lib/penf.F90
build_dir = ./static/
output    = penf.a
mklib     = static

[tests-gnu]
template  = template-static-gnu
build_dir = ./exe/

[shared-gnu-debug]
template  = template-shared-gnu-debug
target    = src/lib/penf.F90
build_dir = ./shared/
output    = penf.so
mklib     = shared

[static-gnu-debug]
template  = template-static-gnu-debug
target    = src/lib/penf.F90
build_dir = ./static/
output    = penf.a
mklib     = static

[tests-gnu-debug]
template  = template-static-gnu-debug
build_dir = ./exe/

[shared-intel]
template  = template-shared-intel
target    = src/lib/penf.F90
build_dir = ./shared/
output    = penf.so
mklib     = shared

[static-intel]
template  = template-static-intel
target    = src/lib/penf.F90
build_dir = ./static/
output    = penf.a
mklib     = static

[tests-intel]
template  = template-static-intel
build_dir = ./exe/

[shared-intel-debug]
template  = template-shared-intel-debug
target    = src/lib/penf.F90
build_dir = ./shared/
output    = penf.so
mklib     = shared

[static-intel-debug]
template  = template-static-intel-debug
target    = src/lib/penf.F90
build_dir = ./static/
output    = penf.a
mklib     = static

[tests-intel-debug]
template  = template-static-intel-debug
build_dir = ./exe/

[shared-ibm]
template  = template-shared-ibm
target    = src/lib/penf.F90
build_dir = ./shared/
output    = penf.so
mklib     = shared

[static-ibm]
template  = template-static-ibm
target    = src/lib/penf.F90
build_dir = ./static/
output    = penf.a
mklib     = static

[tests-ibm]
template  = template-static-ibm
build_dir = ./exe/

[shared-ibm-debug]
template  = template-shared-ibm-debug
target    = src/lib/penf.F90
build_dir = ./shared/
output    = penf.so
mklib     = shared

[static-ibm-debug]
template  = template-static-ibm-debug
target    = src/lib/penf.F90
build_dir = ./static/
output    = penf.a
mklib     = static

[tests-ibm-debug]
template  = template-static-ibm-debug
build_dir = ./exe/

[static-pgi]
template  = template-static-pgi
target    = src/lib/penf.F90
build_dir = ./static/
output    = penf.a
mklib     = static

[template-static-pgi]
compiler     = pgi
cflags       = -c -O3
exclude_dirs = $EXDIRS
mod_dir      = ./mod/
obj_dir      = ./obj/
src          = ./src/
colors       = True
quiet        = False
log          = True
jobs         = 2

#templates
[template-shared-gnu]
compiler        = gnu
cflags          = $CSHARED_GNU $OPTIMIZE
lflags          = $LSHARED $OPTIMIZE
mod_dir         = ./mod/
obj_dir         = ./obj/
src             = ./src/
colors          = True
quiet           = False
log             = True
jobs            = 4
cflags_heritage = True

[template-static-gnu]
compiler        = gnu
cflags          = $CSTATIC_GNU $OPTIMIZE
lflags          = $OPTIMIZE
mod_dir         = ./mod/
obj_dir         = ./obj/
src             = ./src/
colors          = True
quiet           = False
log             = True
jobs            = 4
cflags_heritage = True

[template-shared-gnu-debug]
compiler        = gnu
cflags          = $CSHARED_GNU $DEBUG_GNU
lflags          = $LSHARED $DEBUG_GNU
preproc         = -D_ASCII_SUPPORTED -D_UCS4_SUPPORTED
mod_dir         = ./mod/
obj_dir         = ./obj/
src             = ./src/
colors          = True
quiet           = False
log             = True
jobs            = 4
cflags_heritage = True

[template-static-gnu-debug]
compiler        = gnu
cflags          = $CSTATIC_GNU $DEBUG_GNU
lflags          = $DEBUG_GNU
preproc         = -D_ASCII_SUPPORTED -D_UCS4_SUPPORTED
mod_dir         = ./mod/
obj_dir         = ./obj/
src             = ./src/
colors          = True
quiet           = False
log             = True
jobs            = 4
cflags_heritage = True

[template-shared-intel]
compiler        = intel
cflags          = $CSHARED_INT $OPTIMIZE
lflags          = $LSHARED $OPTIMIZE
mod_dir         = ./mod/
obj_dir         = ./obj/
src             = ./src/
colors          = True
quiet           = False
log             = True
jobs            = 4
cflags_heritage = True

[template-static-intel]
compiler        = intel
cflags          = $CSTATIC_INT $OPTIMIZE
lflags          = $OPTIMIZE
mod_dir         = ./mod/
obj_dir         = ./obj/
src             = ./src/
colors          = True
quiet           = False
log             = True
jobs            = 4
cflags_heritage = True

[template-shared-intel-debug]
compiler        = intel
cflags          = $CSHARED_INT $DEBUG_INT
lflags          = $LSHARED $DEBUG_INT
mod_dir         = ./mod/
obj_dir         = ./obj/
src             = ./src/
colors          = True
quiet           = False
log             = True
jobs            = 4
cflags_heritage = True

[template-static-intel-debug]
compiler        = intel
cflags          = $CSTATIC_INT $DEBUG_INT
lflags          = $DEBUG_INT
mod_dir         = ./mod/
obj_dir         = ./obj/
src             = ./src/
colors          = True
quiet           = False
log             = True
jobs            = 4
cflags_heritage = True

[template-shared-ibm]
compiler        = ibm
cflags          = $CSHARED_IBM $OPTIMIZE
lflags          = $LSHARED $OPTIMIZE
mod_dir         = ./mod/
obj_dir         = ./obj/
src             = ./src/
colors          = True
quiet           = False
log             = True
jobs            = 4
cflags_heritage = True

[template-static-ibm]
compiler        = ibm
cflags          = $CSTATIC_IBM $OPTIMIZE
lflags          = $OPTIMIZE
mod_dir         = ./mod/
obj_dir         = ./obj/
src             = ./src/
colors          = True
quiet           = False
log             = True
jobs            = 4
cflags_heritage = True

[template-shared-ibm-debug]
compiler        = ibm
cflags          = $CSHARED_IBM $DEBUG_IBM
lflags          = $LSHARED $DEBUG_IBM
mod_dir         = ./mod/
obj_dir         = ./obj/
src             = ./src/
colors          = True
quiet           = False
log             = True
jobs            = 4
cflags_heritage = True

[template-static-ibm-debug]
compiler        = ibm
cflags          = $CSTATIC_IBM $DEBUG_IBM
lflags          = $DEBUG_IBM
mod_dir         = ./mod/
obj_dir         = ./obj/
src             = ./src/
colors          = True
quiet           = False
log             = True
jobs            = 4
cflags_heritage = True

[rule-makedoc]
help   = Build documentation from source files
rule_1 = rm -rf doc/html/*
rule_2 = ford doc/main_page.md --debug
rule_3 = cp -r doc/html/publish/* doc/html/
rule_4 = rm -rf doc/html/publish

[rule-deldoc]
help = Delete documentation
rule = rm -rf doc/html/*

[rule-delexe]
help = Delete exes
rule = rm -rf exe/

[rule-clean]
help = Clean the project tree
rule_1 = FoBiS.py rule -ex deldoc
rule_2 = FoBiS.py rule -ex delexe
rule_3 = rm -f *.gcov

[rule-maketar]
help = Make tar archive of the project
rule = tar --xform="s%^%PENF/%" -czf PENF.tar.gz *

[rule-makecoverage]
help   = Perform coverage analysis
rule_1 = FoBiS.py doctests -mode tests-gnu-debug -coverage
rule_2 = gcov -o exe/obj/ src/lib/*

[rule-makecoverage-analysis]
help   = Perform coverage analysis and saving reports in markdown
rule_1 = FoBiS.py doctests -mode tests-gnu-debug -coverage
rule_2 = gcov -o exe/obj/ src/lib/*
rule_3 = FoBiS.py rule -gcov_analyzer wiki/ Coverage-Analysis -verbose
rule_4 = rm -f *.gcov
