mirror of
https://github.com/pret/pokeplatinum.git
synced 2026-08-28 04:15:44 -05:00
tools: Implement and inject enumproc CLI tool for script-preprocessing
This commit is contained in:
@@ -8,6 +8,7 @@ help() {
|
||||
echo " -h | --help print this help message and exit"
|
||||
echo " -i | --include append an include directory for the assembler"
|
||||
echo " -a | --assembler path to the assembler executable"
|
||||
echo " -E | --enumproc path to the enumproc executable for translating enums to preproc #defines"
|
||||
echo " -o | --objcopy path to the objcopy executable for data extraction"
|
||||
echo " -d | --out-dir directory for output files (default: current directory)"
|
||||
echo " -M | --depfile output a compiler-generated depfile for the source"
|
||||
@@ -39,6 +40,11 @@ while [[ $# -gt 0 ]] ; do
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
-E|--enumproc)
|
||||
ENUMPROC="$2"
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
-o|--objcopy)
|
||||
OBJCOPY="$2"
|
||||
shift
|
||||
@@ -64,6 +70,8 @@ while [[ $# -gt 0 ]] ; do
|
||||
esac
|
||||
done
|
||||
|
||||
if [[ -z ${ENUMPROC:-} ]]; then echo "error: enumproc not specified!"; exit 1; fi
|
||||
|
||||
for script_file in "${SCRIPT_FILES[@]}" ; do
|
||||
script_fname=${script_file##*/}
|
||||
script_noext=${script_fname%.*}
|
||||
@@ -78,7 +86,9 @@ for script_file in "${SCRIPT_FILES[@]}" ; do
|
||||
script_bin="$OUTDIR/$script_noext"
|
||||
|
||||
# Convert + clean-up
|
||||
$AS $MD -c -x assembler-with-cpp "${INCLUDE_ARGS[@]}" -o "$script_obj" "$script_file"
|
||||
$AS $MD -E -x assembler-with-cpp "${INCLUDE_ARGS[@]}" "$script_file" \
|
||||
| $ENUMPROC \
|
||||
| $AS -x assembler-with-cpp -o "$script_obj" -c -
|
||||
$OBJCOPY -O binary --file-alignment 4 "$script_obj" "$script_bin"
|
||||
$LD "$script_obj" -o "$script_obj.dummy"
|
||||
rm "$script_obj" "$script_obj.dummy"
|
||||
|
||||
Reference in New Issue
Block a user