#!/bin/sh # # Check that ports are hooked into the build # common_functions="$(realpath "$(dirname "$0")")/common.sh" if [ -r "${common_functions}" ]; then . "${common_functions}" fi newish_makefiles=$(git diff --name-only --cached --diff-filter=ACR | grep -E '^[^/]+/[^/]+/Makefile$') if [ $? -eq 0 ] ; then for newish_makefile in ${newish_makefiles} ; do category=$(echo "${newish_makefile}" | awk -F '/' '{print $1}') port=$(echo "${newish_makefile}" | awk -F '/' '{print $2}') grep -q -E "^[[:space:]]+SUBDIR[[:space:]]\+=[[:space:]]*${port}\$" ${category}/Makefile if [ $? -ne 0 ] ; then pre_commit_error "Missing 'SUBDIR += ${port}' in ${category}/Makefile" exit 1 fi done fi