Files
openfoam/wmake/scripts/makeDepend
Mark Olesen de72a04aeb ENH: make it easier to switch between the various make dependencies programs.
- However, the new ragel-based parser is much faster
  than the others, and does not cause 'too many open files' error
  that the flex-based parser does (issue #784).

  The timings (using src/sampling as being somewhat representative)

    $ wclean; wmakeLnInclude -u .; time wmake -s dep

        3.4s  wmkdepend (ragel) [now default]
        5.7s  wmkdep (flex)
        6.1s  cpp -M

- The makeDepend script is for testing purposes only, but could used as
  a hook for other dependency generation systems (eg, ninja).
  It simply wraps 'cpp -M' in a form that is calling compatible with
  wmkdepend.

BUG: wmkdepend parser was missing optional leading space on #include match

STYLE: use -G2 (goto-based) option for wmkdepend state machine

- the machine is compact with few states and lends itself to this
2018-04-12 10:14:03 +02:00

63 lines
1.7 KiB
Bash
Executable File

#!/bin/sh
#------------------------------------------------------------------------------
# ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration |
# \\ / A nd | Copyright (C) 2018 OpenCFD Ltd.
# \\/ M anipulation |
#------------------------------------------------------------------------------
# License
# This file is part of OpenFOAM, licensed under GNU General Public License
# <http://www.gnu.org/licenses/>.
#
# Script
# makeDepend
#
# Description
# Wrapping for cpp -M with argument/options compatible with
# <wmake/rules/General/transform> calls of wmkdepend or wmkdep.
#
# This is for testing purposes only, but could used as a hook for
# other dependency generation systems (eg, ninja).
#
# Note
# The order of the calling options is fragile.
# Handling of '-eENV' not working.
#
# Usage
# makeDepend [-eENV...] [-q] [-oFile] ...
#
# -eENV Environment variable path substitutions.
# -oFile Write output to File.
# -q Suppress 'No such file' warnings.
#
#------------------------------------------------------------------------------
unset envChanges output
while [ "$#" -gt 1 ]
do
case "$1" in
-q*) # quiet - ignore
;;
-e*) # -eENV - ignore for now
envChanges="$envChanges ${1#-e}"
;;
-o*) # -oFILE
output="${1#-o}"
;;
*)
break
;;
esac
shift
done
cpp -x c++ -std=c++11 -M \
-DWM_"$WM_PRECISION_OPTION" -DWM_LABEL_SIZE="$WM_LABEL_SIZE" \
$@ $output
#------------------------------------------------------------------------------