#!/bin/sh set -euC cd "$(dirname "$0")/.." file="$(basename "$0")" in_file="include/gltraits.hpp" out_file="doc/$file.hpp" tmp_file="doc/$file-tmp.hpp" trap 'rm "$tmp_file"' EXIT grep -v '^\s*#include' < "$in_file" > "$tmp_file" ${CPP:-cpp} -DGLM_VERSION "$tmp_file" \ | grep -v '^\s*#' \ | ${CLANG_FORMAT:-clang-format} --style='{ "ColumnLimit": 79, "IndentWidth": 4, "UseTab": "Never", "BreakBeforeBraces": "Allman", # "AlignAfterOpenBracket": "BlockIndent", "AlignAfterOpenBracket": "AlwaysBreak", "PointerAlignment": "Middle", "BinPackArguments": false, "BinPackParameters": false, "AllowAllArgumentsOnNextLine": false, "AllowAllParametersOfDeclarationOnNextLine": false, "AlignConsecutiveDeclarations": true, "AlignConsecutiveAssignments": true, }' \ | sed 's/^\S.*;/&\n/' \ >| "$out_file"