##==================================================================================================
##  EVE - Expressive Vector Engine
##  Copyright : EVE Project Contributors
##  SPDX-License-Identifier: BSL-1.0
##==================================================================================================
#!/bin/bash
# Usage:
#
#  find_deps.sh <file name> <root_path> <filter>

FILE="#include <$1>"

if [[ "$#" -lt 2 ]]; then
  ROOT=`pwd`
else
  ROOT=$2
fi

if [[ "$#" -lt 3 ]]; then
  MARK="eve/function/definition"
else
  MARK=$3
fi

INCLUDE="$ROOT/include"
OPTIONS="-std=c++2a -fconcepts"

echo $FILE | g++ -I$INCLUDE $OPTIONS -M  -x c++ - | grep -v "$1" | grep $MARK | uniq | sort | tr '\\' ' '
