File tree Expand file tree Collapse file tree 2 files changed +36
-1
lines changed
Expand file tree Collapse file tree 2 files changed +36
-1
lines changed Original file line number Diff line number Diff line change @@ -409,4 +409,9 @@ jobs:
409409 path : cfn_guard_output
410410
411411 - name : Build project
412- run : make build
412+ run : |
413+ if scripts/check_makefile_target.sh build; then
414+ make build
415+ else
416+ echo "No build target found in Makefile, skipping build step"
417+ fi
Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+
3+ # Script to check if a target exists in a Makefile
4+ # Usage: check_makefile_target.sh <target_name> [makefile_path]
5+
6+ set -euo pipefail
7+
8+ TARGET_NAME=" ${1:- } "
9+ MAKEFILE_PATH=" ${2:- Makefile} "
10+
11+ if [ -z " $TARGET_NAME " ]; then
12+ echo " Error: Target name is required" >&2
13+ echo " Usage: $0 <target_name> [makefile_path]" >&2
14+ exit 1
15+ fi
16+
17+ if [ ! -f " $MAKEFILE_PATH " ]; then
18+ echo " Error: Makefile not found at '$MAKEFILE_PATH '" >&2
19+ exit 1
20+ fi
21+
22+ # Check if the target exists in the Makefile
23+ # Matches lines like "target:" or "target: dependencies"
24+ if grep -qE " ^${TARGET_NAME} :" " $MAKEFILE_PATH " ; then
25+ echo " Target '$TARGET_NAME ' exists in $MAKEFILE_PATH "
26+ exit 0
27+ else
28+ echo " Target '$TARGET_NAME ' not found in $MAKEFILE_PATH " >&2
29+ exit 1
30+ fi
You can’t perform that action at this time.
0 commit comments