chore(makefile): add commitlint rule

Adds Makefile rule which lints commit messages from
a given start and endpoint in the commit history,
to ensure they follow the Conventional Commits format.

Makefile rule calls newly created build/commitlint.sh
which installs commitlint if not already present and
invokes the commitlint linting command.

Change-Id: I547a3ae9a5cf850d49aea69c9a709d32f02aa785
Signed-off-by: Lucas Bruckbauer <lucas.bruckbauer@arm.com>
diff --git a/build/commitlint.sh b/build/commitlint.sh
new file mode 100755
index 0000000..304cf30
--- /dev/null
+++ b/build/commitlint.sh
@@ -0,0 +1,24 @@
+#!/usr/bin/env bash
+#
+# Copyright 2025 The Hafnium Authors.
+#
+# Use of this source code is governed by a BSD-style
+# license that can be found in the LICENSE file or at
+# https://opensource.org/licenses/BSD-3-Clause.
+
+set -euo pipefail
+
+SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
+ROOT_DIR="$(dirname "$SCRIPT_DIR")"
+
+FROM="${1:-HEAD~1}"
+TO="${2:-HEAD}"
+
+# Install commitlint only if not already available.
+if [ ! -d "node_modules/@commitlint/cli" ]; then
+  export npm_config_cache=/tmp/.npm
+  npm install -D @commitlint/cli @commitlint/config-conventional
+fi
+
+# Execute the commitlint command.
+npx commitlint --from=$FROM --to=$TO --verbose