2023-12-08 07:53:46 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
# Get the name of the source file as a parameter
|
|
|
|
source_file="$1"
|
|
|
|
|
|
|
|
# Check if the source file parameter is empty
|
|
|
|
if [ -z "$source_file" ]; then
|
|
|
|
echo "No source file specified!"
|
|
|
|
echo " Usage: $0 <source_file>"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Strip the extension from the source file
|
|
|
|
source_basename="$(basename "$source_file" | cut -d. -f1)"
|
|
|
|
|
2023-12-16 22:58:27 +00:00
|
|
|
# Set working dir to project dir and make object file
|
|
|
|
project_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/.."
|
|
|
|
codematcher_path="$project_dir/tools/codematcher"
|
|
|
|
pushd $project_dir > /dev/null
|
2023-12-08 07:53:46 +00:00
|
|
|
echo "Compiling $source_basename.o..."
|
2023-12-16 22:58:27 +00:00
|
|
|
make clean > /dev/null
|
|
|
|
make obj/debug/$source_basename.o > /dev/null
|
2023-12-08 07:53:46 +00:00
|
|
|
|
2023-12-16 22:58:27 +00:00
|
|
|
# CD to codematcher directory and invoke codematcher with the compiled object file
|
2023-12-08 07:53:46 +00:00
|
|
|
echo "Matching $source_basename.o..."
|
2023-12-16 22:58:27 +00:00
|
|
|
cd tools/codematcher >/dev/null
|
|
|
|
./codematcher may_proto.elf --match "$project_dir/obj/debug/$source_basename.o"
|
2023-12-08 07:53:46 +00:00
|
|
|
|
|
|
|
# Move back to the original directory
|
|
|
|
popd >/dev/null
|
2023-12-16 22:58:27 +00:00
|
|
|
popd >/dev/null
|