diff --git a/Makefile b/Makefile index 758497d..9a94e7a 100644 --- a/Makefile +++ b/Makefile @@ -2,6 +2,4 @@ build: cargo build gen: - cat /dev/null > $(PWD)/src/rfc2865.rs - cargo run --bin code_gen $(PWD)/dicts/dictionary.rfc2865 $(PWD)/src/rfc2865.rs - cargo fmt + bash ./scripts/generate_code.sh diff --git a/scripts/generate_code.sh b/scripts/generate_code.sh new file mode 100755 index 0000000..53952d9 --- /dev/null +++ b/scripts/generate_code.sh @@ -0,0 +1,17 @@ +#!/bin/bash + +set -eu + +REPO_ROOT="$(cd ./"$(git rev-parse --show-cdup)" || exit; pwd)" + +DICT_NAMES=( + "rfc2865" +) + +for DICT_NAME in "${DICT_NAMES[@]}"; do + cat /dev/null > "${REPO_ROOT}/src/${DICT_NAME}.rs" + cargo run --bin code_gen "${REPO_ROOT}/dicts/dictionary.${DICT_NAME}" "${REPO_ROOT}/src/${DICT_NAME}.rs" +done + +cargo fmt +