From a6a6fdacb5ecc663269988c5b4633a7584d0bc4c Mon Sep 17 00:00:00 2001 From: Roland Coeurjoly Date: Sun, 14 Apr 2024 19:42:17 +0200 Subject: [PATCH] Checking different cases for abc --- Makefile | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index 7eba7cb5f43..0f8718cf8dc 100644 --- a/Makefile +++ b/Makefile @@ -783,12 +783,24 @@ $(PROGRAM_PREFIX)yosys-config: misc/yosys-config.in .PHONY: check-git-abc check-git-abc: - @if [ -f "$(YOSYS_SRC)/abc/.git" ]; then \ - echo "abc/.git exists"; \ - exit 0; \ - else \ - echo "abc/.git does not exist. Please execute git submodule update --init"; \ + @if [ ! -d "$(YOSYS_SRC)/abc" ]; then \ + echo "Error: The 'abc' directory does not exist."; \ + echo "Initialize the submodule: Run 'git submodule update --init' to set up 'abc' as a submodule."; \ + exit 1; \ + elif [ -d "$(YOSYS_SRC)/abc" ] && git -C "$(YOSYS_SRC)" submodule status abc | grep -q '^ '; then \ + echo "'abc' is a git submodule. Continuing."; \ + exit 0; \ + elif [ -f "$(YOSYS_SRC)/abc/.gitcommit" ] && grep -q '\$$Format:%h\$$' "$(YOSYS_SRC)/abc/.gitcommit"; then \ + echo "Error: 'abc' is not configured as a git submodule."; \ + echo "To resolve this:"; \ + echo "1. Back up your changes: Save any modifications from the 'abc' directory to another location."; \ + echo "2. Remove the existing 'abc' directory: Delete the 'abc' directory and all its contents."; \ + echo "3. Initialize the submodule: Run 'git submodule update --init' to set up 'abc' as a submodule."; \ + echo "4. Reapply your changes: Move your saved changes back to the 'abc' directory, if necessary."; \ exit 1; \ + else \ + echo "'abc' comes from a tarball. Continuing."; \ + exit 0; \ fi ABC_SOURCES := $(wildcard $(YOSYS_SRC)/abc/*)