rabbitizer/tools/table_gen.sh

31 lines
758 B
Bash
Raw Normal View History

2022-12-16 17:36:53 +00:00
#!/bin/bash
2023-05-02 20:41:02 +00:00
# SPDX-FileCopyrightText: © 2022-2023 Decompollaborate
2022-12-16 17:36:53 +00:00
# SPDX-License-Identifier: MIT
set -e
INPUT_FILE=$1
OUTPUT_FILE=$2
HEADER_GUARD_BAD=$3
# Change dots to underscores
HEADER_GUARD=$(echo ${HEADER_GUARD_BAD} | sed 's/\./_/g')
2023-05-02 20:41:02 +00:00
echo "/* SPDX-FileCopyrightText: © 2022-2023 Decompollaborate */" > ${OUTPUT_FILE}
2022-12-16 18:37:46 +00:00
echo "/* SPDX-License-Identifier: MIT */" >> ${OUTPUT_FILE}
2022-12-16 17:36:53 +00:00
echo >> ${OUTPUT_FILE}
echo "/* Automatically generated. DO NOT MODIFY */" >> ${OUTPUT_FILE}
echo >> ${OUTPUT_FILE}
2022-12-16 18:37:46 +00:00
echo "#ifndef ${HEADER_GUARD}_automatic" >> ${OUTPUT_FILE}
echo "#define ${HEADER_GUARD}_automatic" >> ${OUTPUT_FILE}
echo >> ${OUTPUT_FILE}
cpp -P -I include ${INPUT_FILE} >> ${OUTPUT_FILE}
2022-12-16 17:36:53 +00:00
echo >> ${OUTPUT_FILE}
echo "#endif" >> ${OUTPUT_FILE}