Merge branch 'main' of https://github.com/efabless/caravel_user_project into makefile_fixes
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..ed3bfef
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1 @@
+checks/
\ No newline at end of file
diff --git a/Makefile b/Makefile
index 6006565..e3298a4 100644
--- a/Makefile
+++ b/Makefile
@@ -14,7 +14,8 @@
#
# SPDX-License-Identifier: Apache-2.0
-CARAVEL_ROOT?=caravel
+CARAVEL_ROOT?=$(PWD)/caravel
+PRECHECK_ROOT?=${HOME}/precheck
SIM ?= RTL
# Install lite version of caravel, (1): caravel-lite, (0): caravel
@@ -23,11 +24,11 @@
ifeq ($(CARAVEL_LITE),1)
CARAVEL_NAME := caravel-lite
CARAVEL_REPO := https://github.com/efabless/caravel-lite
- CARAVEL_COMMIT := main
+ CARAVEL_BRANCH := main
else
CARAVEL_NAME := caravel
CARAVEL_REPO := https://github.com/efabless/caravel
- CARAVEL_COMMIT := master
+ CARAVEL_BRANCH := master
endif
# Install caravel as submodule, (1): submodule, (0): clone
@@ -74,7 +75,9 @@
install:
ifeq ($(SUBMODULE),1)
@echo "Installing $(CARAVEL_NAME) as a submodule.."
- @if [ ! -d $(CARAVEL_ROOT) ]; then git submodule add --name $(CARAVEL_NAME) $(CARAVEL_REPO) $(CARAVEL_ROOT); fi
+# Convert CARAVEL_ROOT to relative path because .gitmodules doesn't accept '/'
+ $(eval CARAVEL_PATH := $(shell realpath --relative-to=$(shell pwd) $(CARAVEL_ROOT)))
+ @if [ ! -d $(CARAVEL_ROOT) ]; then git submodule add --name $(CARAVEL_NAME) $(CARAVEL_REPO) $(CARAVEL_PATH); fi
@git submodule update --init
@cd $(CARAVEL_ROOT); git checkout $(CARAVEL_HASH)
$(MAKE) simlink
@@ -87,21 +90,27 @@
# Create symbolic links to caravel's main files
.PHONY: simlink
simlink: check-caravel
+### Symbolic links relative path to $CARAVEL_ROOT
+ $(eval MAKEFILE_PATH := $(shell realpath --relative-to=openlane $(CARAVEL_ROOT)/openlane/Makefile))
+ $(eval PIN_CFG_PATH := $(shell realpath --relative-to=openlane/user_project_wrapper $(CARAVEL_ROOT)/openlane/user_project_wrapper_empty/pin_order.cfg))
mkdir -p openlane
mkdir -p openlane/user_project_wrapper
cd openlane &&\
- ln -sf ../$(CARAVEL_ROOT)/openlane/Makefile Makefile
+ ln -sf $(MAKEFILE_PATH) Makefile
cd openlane/user_project_wrapper &&\
- ln -sf ../../$(CARAVEL_ROOT)/openlane/user_project_wrapper_empty/pin_order.cfg pin_order.cfg
+ ln -sf $(PIN_CFG_PATH) pin_order.cfg
# Update Caravel
.PHONY: update_caravel
update_caravel: check-caravel
ifeq ($(SUBMODULE),1)
- @git submodule update --init
+ @git submodule update --init --recursive
+ cd $(CARAVEL_ROOT) && \
+ git checkout $(CARAVEL_BRANCH) && \
+ git pull
else
cd $(CARAVEL_ROOT)/ && \
- git checkout $(CARAVEL_COMMIT) && \
+ git checkout $(CARAVEL_BRANCH) && \
git pull
endif
@@ -109,10 +118,12 @@
.PHONY: uninstall
uninstall:
ifeq ($(SUBMODULE),1)
+ git config -f .gitmodules --remove-section "submodule.$(CARAVEL_NAME)"
+ git add .gitmodules
git submodule deinit -f $(CARAVEL_ROOT)
- sed -ie '/\[submodule \"caravel\"\]/,/\url =/d' .gitmodules
+ git rm --cached $(CARAVEL_ROOT)
rm -rf .git/modules/$(CARAVEL_NAME)
- git rm -f $(CARAVEL_ROOT)
+ rm -rf $(CARAVEL_ROOT)
else
rm -rf $(CARAVEL_ROOT)
endif
@@ -122,6 +133,20 @@
openlane:
cd openlane && $(MAKE) openlane
+# Install Pre-check
+# Default installs to the user home directory, override by "export PRECHECK_ROOT=<precheck-installation-path>"
+.PHONY: precheck
+precheck:
+ @git clone https://github.com/efabless/open_mpw_precheck.git --depth=1 $(PRECHECK_ROOT)
+ @docker pull efabless/open_mpw_precheck:latest
+
+.PHONY: run-precheck
+run-precheck: check-precheck check-pdk check-caravel
+ $(eval TARGET_PATH := $(shell pwd))
+ cd $(PRECHECK_ROOT) && \
+ docker run -v $(PRECHECK_ROOT):/usr/local/bin -v $(TARGET_PATH):$(TARGET_PATH) -v $(PDK_ROOT):$(PDK_ROOT) -v $(CARAVEL_ROOT):$(CARAVEL_ROOT) \
+ -u $(shell id -u $(USER)):$(shell id -g $(USER)) efabless/open_mpw_precheck:latest bash -c "python3 open_mpw_prechecker.py --pdk_root $(PDK_ROOT) --target_path $(TARGET_PATH) -c $(CARAVEL_ROOT)"
+
# Clean
.PHONY: clean
clean:
@@ -133,3 +158,15 @@
echo "Caravel Root: "$(CARAVEL_ROOT)" doesn't exists, please export the correct path before running make. "; \
exit 1; \
fi
+
+check-precheck:
+ @if [ ! -d "$(PRECHECK_ROOT)" ]; then \
+ echo "Pre-check Root: "$(PRECHECK_ROOT)" doesn't exists, please export the correct path before running make. "; \
+ exit 1; \
+ fi
+
+check-pdk:
+ @if [ ! -d "$(PDK_ROOT)" ]; then \
+ echo "PDK Root: "$(PDK_ROOT)" doesn't exists, please export the correct path before running make. "; \
+ exit 1; \
+ fi
\ No newline at end of file