@@ -117,122 +117,122 @@ while [ "$#" -ge "1" ]; do # Get command line arguments while there are more lef
117117 key=" $1 " # Command line args are key-value pairs or value-less keys
118118
119119 case $key in # find known keys
120- --compiler) # pick the compiler. Defaults to gfortran, but intel or custom compilers can be used
121- case " $2 " in
122- intel|Intel|INTEL|ifort)
123- FCOMPILER=' Intel'
124- FCOMPILERFLAGS=" $INTELCOMPILERFLAGS "
125- shift
126- ;;
127- gnu|Gnu|GNU|gfortran|Gfortran|GFortran|GFORTRAN)
128- FCOMPILER=' gnu'
129- FCOMPILERFLAGS=" $GNUCOMPILERFLAGS "
130- shift
131- ;;
132- * )
133- FCOMPILER=" custom"
134- echo " Warning: Trying to build with unsupported compiler, $2 ." 1>&2
135- echo " Please ensure you set appropriate --cflags and (single) quote them" 1>&2
136- FC=" $2 "
137- shift
138- ;;
139- esac
140- ;;
141- --cflags)
142- FCOMPILERFLAGS=" $2 "
143- # no good way to check that the user didn't do something questionable
144- shift
145- ;;
146- --enable-unicode)
147- case $2 in
148- yes|Yes|YES)
149- TRY_UNICODE=" yes"
150- shift
151- ;;
152- no|No|NO)
153- TRY_UNICODE=" no"
154- shift
155- ;;
156- * )
157- TRY_UNICODE=" yes"
158- # don't shift; $2 is next arg
159- ;;
160- esac
161- ;;
162- --coverage) # enable coverage
163- case $2 in
164- yes|Yes|YES)
165- CODE_COVERAGE=" yes"
166- shift
167- ;;
168- no|No|NO)
169- CODE_COVERAGE=" no"
170- shift
171- ;;
172- * )
173- CODE_COVERAGE=" yes"
174- # don't shift because $2 is some other flag
175- ;;
176- esac
177- ;;
178- --profile) # nable profiling
179- case $2 in
180- yes|Yes|YES)
181- CODE_PROFILE=" yes"
182- shift
183- ;;
184- no|No|NO)
185- CODE_PROFILE=" no"
186- shift
187- ;;
188- * )
189- CODE_PROFILE=" yes"
190- # don't shift because $2 is some other flag
191- ;;
192- esac
193- ;;
194- --skip-tests) # skip tests
195- case $2 in
196- yes|Yes|YES)
197- JF_SKIP_TESTS=" yes"
198- shift
199- ;;
200- no|No|NO)
201- JF_SKIP_TESTS=" no"
202- shift
203- ;;
204- * )
205- JF_SKIP_TESTS=" yes"
206- ;;
207- esac
208- ;;
209- --skip-documentation)
210- case $2 in
211- yes|Yes|YES)
212- JF_SKIP_DOCS=" yes"
213- shift
214- ;;
215- no|No|NO)
216- JF_SKIP_DOCSS=" no"
217- shift
218- ;;
219- * )
220- JF_SKIP_DOCS=" yes"
221- ;;
222- esac
223- ;;
224- --help)
225- print_usage
226- exit 0
227- ;;
228- --clean)
229- rm -r src{,/tests}/* .o $DOCDIR * $LIBDIR * $BINDIR * * .gcov*
230- ;;
231- * )
232- echo " Unknown flag, \" $1 \" , passed to ${script_name} !" 2>&1
233- print_usage
234- exit 1
235- ;;
120+ --compiler) # pick the compiler. Defaults to gfortran, but intel or custom compilers can be used
121+ case " $2 " in
122+ intel|Intel|INTEL|ifort)
123+ FCOMPILER=' Intel'
124+ FCOMPILERFLAGS=" $INTELCOMPILERFLAGS "
125+ shift
126+ ;;
127+ gnu|Gnu|GNU|gfortran|Gfortran|GFortran|GFORTRAN)
128+ FCOMPILER=' gnu'
129+ FCOMPILERFLAGS=" $GNUCOMPILERFLAGS "
130+ shift
131+ ;;
132+ * )
133+ FCOMPILER=" custom"
134+ echo " Warning: Trying to build with unsupported compiler, $2 ." 1>&2
135+ echo " Please ensure you set appropriate --cflags and (single) quote them" 1>&2
136+ FC=" $2 "
137+ shift
138+ ;;
139+ esac
140+ ;;
141+ --cflags)
142+ FCOMPILERFLAGS=" $2 "
143+ # no good way to check that the user didn't do something questionable
144+ shift
145+ ;;
146+ --enable-unicode)
147+ case $2 in
148+ yes|Yes|YES)
149+ TRY_UNICODE=" yes"
150+ shift
151+ ;;
152+ no|No|NO)
153+ TRY_UNICODE=" no"
154+ shift
155+ ;;
156+ * )
157+ TRY_UNICODE=" yes"
158+ # don't shift; $2 is next arg
159+ ;;
160+ esac
161+ ;;
162+ --coverage) # enable coverage
163+ case $2 in
164+ yes|Yes|YES)
165+ CODE_COVERAGE=" yes"
166+ shift
167+ ;;
168+ no|No|NO)
169+ CODE_COVERAGE=" no"
170+ shift
171+ ;;
172+ * )
173+ CODE_COVERAGE=" yes"
174+ # don't shift because $2 is some other flag
175+ ;;
176+ esac
177+ ;;
178+ --profile) # nable profiling
179+ case $2 in
180+ yes|Yes|YES)
181+ CODE_PROFILE=" yes"
182+ shift
183+ ;;
184+ no|No|NO)
185+ CODE_PROFILE=" no"
186+ shift
187+ ;;
188+ * )
189+ CODE_PROFILE=" yes"
190+ # don't shift because $2 is some other flag
191+ ;;
192+ esac
193+ ;;
194+ --skip-tests) # skip tests
195+ case $2 in
196+ yes|Yes|YES)
197+ JF_SKIP_TESTS=" yes"
198+ shift
199+ ;;
200+ no|No|NO)
201+ JF_SKIP_TESTS=" no"
202+ shift
203+ ;;
204+ * )
205+ JF_SKIP_TESTS=" yes"
206+ ;;
207+ esac
208+ ;;
209+ --skip-documentation)
210+ case $2 in
211+ yes|Yes|YES)
212+ JF_SKIP_DOCS=" yes"
213+ shift
214+ ;;
215+ no|No|NO)
216+ JF_SKIP_DOCSS=" no"
217+ shift
218+ ;;
219+ * )
220+ JF_SKIP_DOCS=" yes"
221+ ;;
222+ esac
223+ ;;
224+ --help)
225+ print_usage
226+ exit 0
227+ ;;
228+ --clean)
229+ rm -r src{,/tests}/* .o $DOCDIR * $LIBDIR * $BINDIR * * .gcov*
230+ ;;
231+ * )
232+ echo " Unknown flag, \" $1 \" , passed to ${script_name} !" 2>&1
233+ print_usage
234+ exit 1
235+ ;;
236236 esac
237237 shift # look at next argument
238238done # with argument parsing loop
@@ -261,7 +261,7 @@ if [[ $TRY_UNICODE == [yY]* ]]; then
261261 echo " Trying to compile library with Unicode/UCS4 support"
262262 FoBiS.py build -ch -compiler ${FCOMPILER} ${CUSTOM} -cflags " ${FCOMPILERFLAGS} " -dbld " ${BINDIR} " -s " ${INTROSPECDIR} " -dmod ./ -dobj ./ -t ${UCS4TESTCODE} -o ${UCS4TESTCODE% .f90} -colors
263263 if " ${BINDIR} /${UCS4TESTCODE% .f90} " ; then
264- DEFINES=" -DUSE_UCS4 -Wunused-function"
264+ DEFINES=" -DUSE_UCS4 -Wunused-function"
265265 fi
266266fi
267267
@@ -280,9 +280,9 @@ if [[ $JF_SKIP_TESTS != [yY]* ]]; then
280280 [ -d " $BINDIR " ] || mkdir " $BINDIR "
281281
282282 for TEST in " ${TESTDIR%/ } " /jf_test_* .[fF]90; do
283- THIS_TEST=${TEST##*/ }
284- echo " Build ${THIS_TEST% .[fF]90} "
285- FoBiS.py build -ch -compiler ${FCOMPILER} ${CUSTOM} -cflags " ${FCOMPILERFLAGS} ${DEFINES} " ${COVERAGE} ${PROFILING} -dbld ${BINDIR} -s ${TESTDIR} -i ${LIBDIR} -libs ${LIBDIR} /${LIBOUT} -dmod ./ -dobj ./ -t ${THIS_TEST} -o ${THIS_TEST% .[fF]90} -colors
283+ THIS_TEST=${TEST##*/ }
284+ echo " Build ${THIS_TEST% .[fF]90} "
285+ FoBiS.py build -ch -compiler ${FCOMPILER} ${CUSTOM} -cflags " ${FCOMPILERFLAGS} ${DEFINES} " ${COVERAGE} ${PROFILING} -dbld ${BINDIR} -s ${TESTDIR} -i ${LIBDIR} -libs ${LIBDIR} /${LIBOUT} -dmod ./ -dobj ./ -t ${THIS_TEST} -o ${THIS_TEST% .[fF]90} -colors
286286 done
287287else
288288 echo " Skip building the unit tests since \$ JF_SKIP_TESTS has been set to 'true'."
@@ -297,37 +297,42 @@ if [[ $JF_SKIP_TESTS != [yY]* ]] ; then
297297 GLOBIGNORE=' *.*'
298298 #
299299 for TEST in jf_test_* ; do
300- # It would be nice to run json output printed to stdout through jsonlint, however,
301- # some tests output more than one json structure and these need to be split
302- echo " Running ${TEST} "
303- ./${TEST}
300+ # It would be nice to run json output printed to stdout through jsonlint, however,
301+ # some tests output more than one json structure and these need to be split
302+ echo " Running ${TEST} "
303+ ./${TEST}
304304 done
305305 cd -
306306 GLOBIGNORE=" $OLD_IGNORES "
307307 if [[ $CODE_COVERAGE = [yY]* ]] ; then
308- [ -f json_module.F90.gcov ] && rm json_module.F90.gcov
309- gcov -o $LIBDIR ${SRCDIR}${MODCODE}
310- if [[ $TRY_UNICODE = [yY]* ]] ; then
311- # gcov/gfortran bug work around
312- awk -F' :' ' {line=""; for(i=2;i<=NF;i++){line=line":"$i}; if (NR > 1) print $1 prevline; prevline=line}; END{print " -"prevline}' json_module.F90.gcov > json_module.F90.gcov.fixed && \
313- mv json_module.F90.gcov{.fixed,}
314- # rename so we can merge coverage info
315- mv json_module.F90.gcov json_module-unicode.F90.gcov
316- else
317- # rename so we can merge coverage info
318- mv json_module.F90.gcov json_module-no-unicode.F90.gcov
319- fi
320- if [ -f json_module-unicode.F90.gcov ] && [ -f json_module-no-unicode.F90.gcov ]; then
321- # merge them
322- ./pages/development-resources/gccr.pl -n -c json_module-no-unicode.F90.gcov no-unicode \
323- json_module-unicode.F90.gcov unicode > json_module.F90.gcov
324- else
325- cp json_module* -unicode.F90.gcov json_module.F90.gcov
326- fi
327- FoBiS.py rule -gcov_analyzer .
328- sed -i" bak" -E ' s; \*\*([a-zA-Z]+[a-zA-Z0-9_]*)\*\*; \*\*[[\1]]\*\*;' json_module.F90.gcov.md
329- sed -i" bak" -E ' s;, line ([0-9]+);, line [\1](https://github.com/jacobwilliams/json-fortran/blob/master/src/json_module.F90#L\1);' json_module.F90.gcov.md
330- gcov -o $BINDIR ${TESTDIR} * .[Ff]90
308+ for SRCFILE in json_string_utilities.F90 json_value_module.F90 json_file_module.F90 ; do
309+ [ -f ${SRCDIR}${SRCFILE} .gcov ] && rm ${SRCDIR}${SRCFILE} .gcov
310+ gcov -o $LIBDIR ${SRCDIR}${SRCFILE}
311+ if [[ $TRY_UNICODE = [yY]* ]] ; then
312+ # gcov/gfortran bug work around
313+ awk -F' :' ' {line=""; for(i=2;i<=NF;i++){line=line":"$i}; if (NR > 1) print $1 prevline; prevline=line}; END{print " -"prevline}' ${SRCFILE} .gcov > ${SRCFILE} .gcov.fixed && \
314+ mv ${SRCFILE} .gcov{.fixed,}
315+ # rename so we can merge coverage info
316+ mv ${SRCFILE} .gcov ${SRCFILE} -unicode.gcov
317+ else
318+ # rename so we can merge coverage info
319+ mv ${SRCFILE} .gcov ${SRCFILE} -no-unicode.gcov
320+ fi
321+ if [ -f ${SRCFILE} -unicode.gcov ] && [ -f ${SRCFILE} -no-unicode.gcov ]; then
322+ # merge them
323+ ./pages/development-resources/gccr.pl -n -c ${SRCFILE} -no-unicode.gcov no-unicode \
324+ ${SRCFILE} -unicode.gcov unicode > ${SRCFILE} .gcov
325+ else
326+ cp ${SRCFILE} * -unicode.gcov ${SRCFILE} .gcov
327+ fi
328+ done
329+
330+ FoBiS.py rule -gcov_analyzer .
331+ for SRCFILE in json_string_utilities.F90 json_value_module.F90 json_file_module.F90 ; do
332+ sed -i" bak" -E ' s; \*\*([a-zA-Z]+[a-zA-Z0-9_]*)\*\*; \*\*[[\1]]\*\*;' ${SRCFILE} .gcov.md
333+ sed -i" bak" -E " s;, line ([0-9]+);, line [\1](https://github.com/jacobwilliams/json-fortran/blob/master/src/${SRCFILE} #L\1);" ${SRCFILE} .gcov.md
334+ done
335+ gcov -o $BINDIR ${TESTDIR} * .[Ff]90
331336 fi
332337else
333338 echo " Skip running the unit tests since \$ JF_SKIP_TESTS has been set to ${JF_SKIP_TESTS} ."
337342echo " "
338343if [[ $JF_SKIP_DOCS != [yY]* ]]; then
339344 if hash ford 2> /dev/null; then
340- echo " Building documentation..."
341- [[ $TRY_UNICODE = [yY]* ]] && MACRO_FLAG=" -m USE_UCS4"
342- ford $MACRO_FLAG -p $PAGESDIR $FORDMD
345+ echo " Building documentation..."
346+ [[ $TRY_UNICODE = [yY]* ]] && MACRO_FLAG=" -m USE_UCS4"
347+ ford $MACRO_FLAG -p $PAGESDIR $FORDMD
343348 else
344- echo " FORD not found! Install using: sudo pip install ford"
349+ echo " FORD not found! Install using: sudo pip install ford"
345350 fi
346351else
347352 echo " Skip building documentation since \$ JF_SKIP_DOCS has been set to ${JF_SKIP_DOCS} ."
0 commit comments