|
1 | 1 | #!/bin/bash
|
2 | 2 |
|
3 | 3 | #
|
4 |
| -# This is just a simple script to build the json-fortran library and example program on Linux and Mac. |
| 4 | +# This is just a simple script to build the json-fortran library |
| 5 | +# and example program on Linux and Mac. |
5 | 6 | #
|
6 | 7 | # It also builds the documentation using RoboDoc
|
7 | 8 | #
|
8 | 9 | # Jacob Williams : 2/8/2014
|
| 10 | +# - modified 6/23/2014 |
9 | 11 | #
|
10 | 12 |
|
11 | 13 | # Uncomment to debug
|
12 | 14 | #set -x
|
13 | 15 |
|
14 |
| -SRCDIR='src/' |
15 |
| -BUILDDIR='lib/' |
16 |
| -BINDIR='bin/' |
17 |
| -DOCDIR='documentation/' |
18 |
| - |
19 |
| -# Intel compiler |
20 |
| -FCOMPILER='ifort' |
21 |
| -# The following warning might be triggered by ifort unless explicitly silenced: |
22 |
| -# warning #7601: F2008 standard does not allow an internal procedure to be an actual argument procedure name. (R1214.4). |
23 |
| -# In the context of F2008 this is an erroneous warning. |
24 |
| -# See https://prd1idz.cps.intel.com/en-us/forums/topic/486629 |
25 |
| -FCOMPILERFLAGS='-O2 -warn -stand f08 -diag-disable 7601 -traceback' |
26 |
| -#FCOMPILERFLAGS='-warn -traceback -stand f08 -assume protect_parens -assume buffered_io -check all' |
27 |
| -# trailing space is significant |
28 |
| -FCMODULEPATHFLAG='-module ' |
29 |
| - |
30 |
| -# GFortran (must be >= 4.9) |
31 |
| -#FCOMPILER='gfortran' |
32 |
| -#FCOMPILER='/opt/local/bin/gfortran-mp-4.9' |
33 |
| -#FCOMPILERFLAGS='-O2 -fbacktrace -Wall -Wextra -Wno-maybe-uninitialized -pedantic -std=f2008' |
34 |
| -#FCMODULEPATHFLAG='-J' |
35 |
| - |
36 |
| -ARCHIVER='ar' |
37 |
| -ARCHIVERFLAGS='-cq' |
38 |
| - |
39 |
| -FEXT='.f90' |
40 |
| -OBJEXT='.o' |
41 |
| -LIBEXT='.a' |
42 |
| -MODEXT='.mod' |
43 |
| -WC='*' |
44 |
| - |
45 |
| -LIBOUT='libjsonfortran' |
46 |
| -EXEOUT='json' |
47 |
| - |
48 |
| -MODCODE='json_module' |
49 |
| -EXAMPLECODE='json_example' |
50 |
| - |
51 |
| -ROBODOC='robodoc' |
52 |
| -ROBOFLAGS="--src ${SRCDIR} --doc ${DOCDIR} --multidoc --html --ignore_case_when_linking --syntaxcolors --source_line_numbers --index --tabsize 4 --documenttitle jsonfortran --sections" |
53 |
| - |
54 |
| -#output directories: |
| 16 | +# Set to 1 to use ifort, otherwise use gfortran |
| 17 | +use_ifort=0 |
| 18 | + |
| 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 | +ROBOFLAGS="--src ${SRCDIR} --doc ${DOCDIR} --multidoc --html --ignore_case_when_linking --syntaxcolors --source_line_numbers --index --tabsize 4 --documenttitle jsonfortran --sections" #robodoc flags |
| 36 | + |
| 37 | +# |
| 38 | +# Compiler-specifics: |
| 39 | +# |
| 40 | + |
| 41 | +if [ $use_ifort -eq 1 ] |
| 42 | +then |
| 43 | + |
| 44 | + # Intel compiler |
| 45 | + |
| 46 | + FCOMPILER='ifort' |
| 47 | + # The following warning might be triggered by ifort unless explicitly silenced: |
| 48 | + # warning #7601: F2008 standard does not allow an internal procedure to be an actual argument procedure name. (R1214.4). |
| 49 | + # In the context of F2008 this is an erroneous warning. |
| 50 | + # See https://prd1idz.cps.intel.com/en-us/forums/topic/486629 |
| 51 | + FCOMPILERFLAGS='-O2 -warn -stand f08 -diag-disable 7601 -traceback' |
| 52 | + #FCOMPILERFLAGS='-warn -traceback -stand f08 -assume protect_parens -assume buffered_io -check all' |
| 53 | + # trailing space is significant |
| 54 | + FCMODULEPATHFLAG='-module ' |
| 55 | + |
| 56 | +else |
| 57 | + |
| 58 | + # GFortran (must be >= 4.9) |
| 59 | + |
| 60 | + FCOMPILER='gfortran' |
| 61 | + #FCOMPILER='/opt/local/bin/gfortran-mp-4.9' |
| 62 | + FCOMPILERFLAGS='-O2 -fbacktrace -Wall -Wextra -Wno-maybe-uninitialized -pedantic -std=f2008' |
| 63 | + FCMODULEPATHFLAG='-J' |
| 64 | + |
| 65 | +fi |
| 66 | + |
| 67 | +# |
| 68 | +# Always a clean build: |
| 69 | +# |
| 70 | + |
55 | 71 | mkdir -p $BUILDDIR
|
56 | 72 | mkdir -p $BINDIR
|
57 | 73 | mkdir -p $DOCDIR
|
58 | 74 |
|
59 |
| -#clean build: |
60 | 75 | rm -f $BUILDDIR$WC$OBJEXT
|
61 | 76 | rm -f $BUILDDIR$WC$MODEXT
|
62 | 77 | rm -f $BUILDDIR$WC$LIBEXT
|
|
0 commit comments