Skip to content

Commit 0d69c4a

Browse files
committed
build script now using FoBiS
1 parent 808cf66 commit 0d69c4a

File tree

1 file changed

+33
-75
lines changed

1 file changed

+33
-75
lines changed

build.sh

Lines changed: 33 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -1,100 +1,58 @@
11
#!/bin/bash
22

33
#
4-
# This is just a simple script to build the json-fortran library
5-
# and example program on Linux and Mac.
4+
# Build the json-fortran library and example program.
65
#
7-
# It also builds the documentation using RoboDoc
6+
# Requires:
7+
# FoBiS.py : https://github.com/szaghi/FoBiS
8+
# RoboDoc : http://rfsber.home.xs4all.nl/Robo/
89
#
9-
# Jacob Williams : 2/8/2014
10-
# - modified 6/23/2014
10+
# Jacob Williams : 12/27/2014
1111
#
1212

13-
# Uncomment to debug
14-
#set -x
15-
1613
# Set to 1 to use ifort, otherwise use gfortran
1714
use_ifort=0
1815

19-
SRCDIR='src/' #source directory
20-
BUILDDIR='lib/' #build directory for library
21-
BINDIR='bin/' #build directory for executable
22-
DOCDIR='documentation/' #build directory for documentation
23-
ARCHIVER='ar' #archiver name
24-
ARCHIVERFLAGS='-cq' #archiver flags
25-
FEXT='.f90' #fortran file extension
26-
OBJEXT='.o' #object code extension
27-
LIBEXT='.a' #static library extension
28-
MODEXT='.mod' #fortran module file extension
29-
WC='*' #wildcard character
30-
LIBOUT='libjsonfortran' #name of json library
31-
EXEOUT='json' #name of example program
32-
MODCODE='json_module' #json module file name (no extension)
33-
EXAMPLECODE='json_example' #example program file name (no extension)
34-
ROBODOC='robodoc' #robodoc executable name
35-
PROJECTNAME='jsonfortran' #project name for robodoc (example: jsonfortran_1.0.0)
36-
ROBOFLAGS="--src ${SRCDIR} --doc ${DOCDIR} --multidoc --html --ignore_case_when_linking --syntaxcolors --source_line_numbers --index --tabsize 4 --documenttitle ${PROJECTNAME} --sections" #robodoc flags
37-
38-
#
39-
# Compiler-specifics:
40-
#
16+
PROJECTNAME='jsonfortran' # project name for robodoc (example: jsonfortran_2.0.0)
17+
DOCDIR='./documentation/' # build directory for documentation
18+
SRCDIR='./src/' # source directory
19+
BINDIR='./bin/' # build directory for example
20+
LIBDIR='./lib/' # build directory for library
21+
MODCODE='json_module.f90' # json module file name
22+
EXAMPLECODE='json_example.f90' # example program file name
23+
LIBOUT='libjsonfortran.a' # name of json library
4124

4225
if [ $use_ifort -eq 1 ]
4326
then
44-
4527
# Intel compiler
4628

47-
FCOMPILER='ifort'
29+
FCOMPILER='Intel'
4830
# The following warning might be triggered by ifort unless explicitly silenced:
4931
# warning #7601: F2008 standard does not allow an internal procedure to be an actual argument procedure name. (R1214.4).
5032
# In the context of F2008 this is an erroneous warning.
5133
# See https://prd1idz.cps.intel.com/en-us/forums/topic/486629
52-
FCOMPILERFLAGS='-O2 -warn -stand f08 -diag-disable 7601 -traceback'
53-
#FCOMPILERFLAGS='-warn -traceback -stand f08 -assume protect_parens -assume buffered_io -check all'
54-
# trailing space is significant
55-
FCMODULEPATHFLAG='-module '
34+
FCOMPILERFLAGS= '-c -O2 -warn -stand f08 -diag-disable 7601 -traceback'
35+
#FCOMPILERFLAGS='-c -O2 -warn -traceback -stand f08 -assume protect_parens -assume buffered_io -check all'
5636

5737
else
58-
5938
# GFortran (must be >= 4.9)
6039

61-
FCOMPILER='gfortran'
62-
#FCOMPILER='/opt/local/bin/gfortran-mp-4.9'
63-
FCOMPILERFLAGS='-O2 -fbacktrace -Wall -Wextra -Wno-maybe-uninitialized -pedantic -std=f2008'
64-
FCMODULEPATHFLAG='-J'
65-
40+
FCOMPILER='gnu'
41+
FCOMPILERFLAGS='-c -O2 -fbacktrace -Wall -Wextra -Wno-maybe-uninitialized -pedantic -std=f2008'
6642
fi
6743

68-
#
69-
# Always a clean build:
70-
#
71-
72-
mkdir -p $BUILDDIR
73-
mkdir -p $BINDIR
74-
mkdir -p $DOCDIR
75-
76-
rm -f $BUILDDIR$WC$OBJEXT
77-
rm -f $BUILDDIR$WC$MODEXT
78-
rm -f $BUILDDIR$WC$LIBEXT
79-
rm -rf $DOCDIR$WC
80-
81-
#
82-
# build library:
83-
#
84-
85-
$FCOMPILER $FCOMPILERFLAGS -c $SRCDIR$MODCODE$FEXT $FCMODULEPATHFLAG$BUILDDIR
86-
mv $MODCODE$OBJEXT $BUILDDIR
87-
$ARCHIVER $ARCHIVERFLAGS $BUILDDIR$LIBOUT$LIBEXT $BUILDDIR$MODCODE$OBJEXT
88-
89-
#
90-
# build example:
91-
#
92-
93-
$FCOMPILER $FCOMPILERFLAGS -o $BINDIR$EXEOUT $FCMODULEPATHFLAG$BUILDDIR $SRCDIR$EXAMPLECODE$FEXT $BUILDDIR$LIBOUT$LIBEXT
94-
95-
#
96-
# build documentation:
97-
#
98-
99-
$ROBODOC $ROBOFLAGS
100-
44+
#build the stand-alone library:
45+
echo ""
46+
echo "Building library..."
47+
./FoBiS.py build -compiler ${FCOMPILER} -cflags "${FCOMPILERFLAGS}" -dbld ${LIBDIR} -s ${SRCDIR} -dmod ./ -dobj ./ -t ${MODCODE} -o ${LIBOUT} -mklib static
48+
49+
#build the example program:
50+
echo ""
51+
echo "Building example program..."
52+
./FoBiS.py build -compiler ${FCOMPILER} -cflags "${FCOMPILERFLAGS}" -dbld ${BINDIR} -s ${SRCDIR} -dmod ./ -dobj ./ -t ${EXAMPLECODE} -o json
53+
54+
#build the documentation with RoboDoc:
55+
echo ""
56+
echo "Building documentation..."
57+
robodoc --src ${SRCDIR} --doc ${DOCDIR} --multidoc --html --ignore_case_when_linking --syntaxcolors --source_line_numbers --index --tabsize 4 --documenttitle ${PROJECTNAME} --sections
58+
echo ""

0 commit comments

Comments
 (0)