mirror of
https://git.lynn.is/Gwen/pretty-automata.git
synced 2024-05-05 01:11:09 +02:00
27 lines
518 B
Bash
Executable file
27 lines
518 B
Bash
Executable file
#!/usr/bin/env bash
|
|
|
|
if [ "$#" -ne 1 ]; then
|
|
echo "exactly one argument required"
|
|
exit 1
|
|
fi
|
|
|
|
mkdir -p preprocessed-shaders
|
|
|
|
preprocess_file() {
|
|
input_file="shaders/$1"
|
|
while IFS= read -r line || [ -n "$line" ]; do
|
|
if [[ $line = \#include* ]]; then
|
|
name=$( echo "$line" | cut -d'"' -f2)
|
|
preprocess_file "$name"
|
|
else
|
|
echo -e "$line"
|
|
fi
|
|
done < "$input_file"
|
|
}
|
|
|
|
input_name="$1"
|
|
output_file="preprocessed-shaders/$input_name"
|
|
|
|
preprocess_file "$input_name" > "$output_file"
|
|
|