diff --git a/misc/preprocess.sh b/misc/preprocess.sh new file mode 100755 index 0000000000000000000000000000000000000000..1a6c4ce9b84143c144c0bc3dc0f59b65d4fb1566 --- /dev/null +++ b/misc/preprocess.sh @@ -0,0 +1,43 @@ +#!/bin/bash + +# Usage: +# $1: path to include directory +# $2..: additional flags to gcc + +# Either run this script in the include directory, or pass the include +# directory as an additional argument ($1). + +set -euo pipefail + +#set -x + +HEADERS="ALL_CustomExceptions.hpp +ALL_Defines.h +ALL_ForceBased.hpp +ALL_Functions.hpp +ALL_Histogram.hpp +ALL.hpp +ALL_LB.hpp +ALL_Point.hpp +ALL_Staggered.hpp +ALL_Tensor.hpp +ALL_Voronoi.hpp" + +PROCESSED_DIR=`mktemp -d` + +CWD="$1" +shift + + +for f in $HEADERS +do + cat $f | sed -e 's!#\s*include\s*<!// PPIGNORE <!' > "$PROCESSED_DIR/$f" +done + +cd "$PROCESSED_DIR" + +gcc -E -fdirectives-only "$@" -o ALL.ii ALL.hpp + +cat ALL.ii | sed -e 's!// PPIGNORE <!#include <!' > "$CWD/ALL_pp.hpp" + +rm -rf $PROCESSED_DIR