#!/bin/sh #------------------------------------------------------------------------------ # ========= | # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / O peration | # \\ / A nd | Copyright (C) 2019 OpenCFD Ltd. # \\/ M anipulation | #------------------------------------------------------------------------------- # License # This file is part of OpenFOAM, licensed under GNU General Public License # . # # Script # wrap-lemon # # Usage # wrap-lemon [lemon-options] # # Description # A wrapper to use lemon compiled with OpenFOAM with the appropriate # parser template. # #------------------------------------------------------------------------------ binDir="${WMAKE_BIN:-$WM_PROJECT_DIR/wmake/platforms/$WM_ARCH$WM_COMPILER}" etcDir="${WM_DIR:-$WM_PROJECT_DIR/wmake}/etc" # Executable and skeleton locations lemon="$binDir/lemon" skel="-T${etcDir}/lempar.c" usage() { exec 1>&2 while [ "$#" -ge 1 ]; do echo "$1"; shift; done cat</dev/null mkdir "$tmpDir" 2>/dev/null # DO WE WANT THIS? # trap 'rm -f $tmpDir 2>/dev/null; exit $rc' EXIT TERM INT "$lemon" "$skel" "-d$tmpDir" $* rc=$? for src in "$tmpDir"/*.h do dst="${src##*/}" if [ -f "$src" ] then if ! cmp "$src" "$dst" 2>/dev/null then mv "$src" "$dst" echo "Updating $dst" 1>&2 fi fi done rm -rf "$tmpDir" 2>/dev/null exit "$rc" # Exit with lemon return code #------------------------------------------------------------------------------