diff --git a/Makefile b/Makefile index 7d88a7ac7..dc3de3cb1 100644 --- a/Makefile +++ b/Makefile @@ -211,7 +211,7 @@ ifdef GGML_VULKAN BUILD_TARGETS += vulkan-shaders-gen endif -default: precompile_checks $(BUILD_TARGETS) $(LEGACY_TARGETS_BUILD) +default: $(BUILD_TARGETS) $(LEGACY_TARGETS_BUILD) test: $(TEST_TARGETS) @failures=0; \ @@ -248,10 +248,6 @@ test: $(TEST_TARGETS) all: $(BUILD_TARGETS) $(TEST_TARGETS) $(LEGACY_TARGETS_BUILD) -# Run the forbidden includes check before every build -precompile_checks: - @bash ./scripts/precompile-checks.sh - ifdef RISCV_CROSS_COMPILE CC := riscv64-unknown-linux-gnu-gcc CXX := riscv64-unknown-linux-gnu-g++ diff --git a/scripts/precompile-checks.sh b/scripts/precompile-checks.sh index f0be3a9f0..8fe62d4ca 100755 --- a/scripts/precompile-checks.sh +++ b/scripts/precompile-checks.sh @@ -11,23 +11,23 @@ SRC_DIR="./examples" FORBIDDEN_HEADERS=("llama-impl.h") echo "🔍 Scanning for forbidden includes in $SRC_DIR..." for HEADER in "${FORBIDDEN_HEADERS[@]}"; do - MATCHES=$(grep -rn --include=\*.{c,cpp} "#include \"$HEADER\"" "$SRC_DIR" 2>/dev/null) + MATCHES=$(grep -rn --include=\*.{c,cpp} "#include \"$HEADER\"" "$SRC_DIR" 2>/dev/null) - if [[ -n "$MATCHES" ]]; then - echo "❌ Forbidden include detected: $HEADER" - echo "$MATCHES" | while IFS=: read -r FILE LINE _; do - echo "::error file=$FILE,line=$LINE::Forbidden include: $HEADER in $FILE at line $LINE" - done - ERROR_FOUND=1 - fi + if [[ -n "$MATCHES" ]]; then + echo "❌ Forbidden include detected: $HEADER" + echo "$MATCHES" | while IFS=: read -r FILE LINE _; do + echo "::error file=$FILE,line=$LINE::Forbidden include: $HEADER in $FILE at line $LINE" + done + ERROR_FOUND=1 + fi done ## END OF INCLUDES EXCLUDED FROM EXAMPLES FOLDER ## if [[ "$ERROR_FOUND" -eq 1 ]]; then - echo "❌ Forbidden includes found. Please remove!" - exit 1 + echo "❌ Forbidden includes found. Please remove!" + exit 1 else - echo "✅ No forbidden includes found." + echo "✅ No forbidden includes found." fi