blob: 4f75f8bd60c1df8e26132b64594469b946ec02c6 [file] [log] [blame]
manarabdelatyb41301c2021-04-19 23:30:35 +02001# SPDX-FileCopyrightText: 2020 Efabless Corporation
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7# http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14#
15# SPDX-License-Identifier: Apache-2.0
16
Jeff DiCorpofb944f92021-04-20 00:40:50 +000017CARAVEL_ROOT?=$(shell pwd)/caravel
manarabdelatyb41301c2021-04-19 23:30:35 +020018UPRJ_ROOT?=$(shell pwd)
19
20# Install lite version of caravel, (1): caravel-lite, (0): caravel
21CARAVEL_LITE?=1
22
23ifeq ($(CARAVEL_LITE),1)
24 CARAVEL_NAME := caravel-lite
25 CARAVEL_REPO := https://github.com/Manarabdelaty/caravel-lite
26else
27 CARAVEL_NAME := caravel
28 CARAVEL_REPO := https://github.com/efabless/caravel
29endif
30
31# Install caravel as submodule, (1): submodule, (0): clone
32SUBMODULE?=1
33
34# Include Caravel Makefile Targets
35.PHONY: %
36%:
37 $(MAKE) -f $(CARAVEL_ROOT)/Makefile $@
38
39# Verify Target for running simulations
40.PHONY: verify
41verify:
42 cd ./verilog/dv/ && \
43 $(MAKE) -j$(THREADS) all
44 cd ./verilog/dv/ && \
45 SIM=GL $(MAKE) -j$(THREADS) all
46
47# Openlane Makefile Targets
48BLOCKS = $(shell cd openlane && find * -maxdepth 0 -type d)
49.PHONY: $(BLOCKS)
50$(BLOCKS):
51 cd openlane && $(MAKE) $*
52
53# Install caravel
54.PHONY: install
55install:
56ifeq ($(SUBMODULE),1)
57 @echo "Installing $(CARAVEL_NAME) as a submodule.."
Jeff DiCorpoe94e3652021-04-20 01:10:57 +000058 #git submodule add $(CARAVEL_REPO) $(CARAVEL_ROOT)
Jeff DiCorpoa2af4232021-04-20 01:23:54 +000059 @git submodule update --init
manarabdelatyb41301c2021-04-19 23:30:35 +020060 $(MAKE) simlink
61else
62 @echo "Installing $(CARAVEL_NAME).."
63 @git clone $(CARAVEL_REPO) $(CARAVEL_ROOT)
64endif
65
66# Create symbolic links to caravel's main files
67.PHONY: simlink
68simlink: check-caravel
69 @ln -sf $(CARAVEL_ROOT)/openlane/Makefile openlane/Makefile
70 @ln -sf $(CARAVEL_ROOT)/openlane/user_project_wrapper_empty/pin_order.cfg openlane/user_project_wrapper/pin_order.cfg
71
72# Update Caravel
73.PHONY: update_caravel
74update_caravel: check-caravel
Jeff DiCorpoa2af4232021-04-20 01:23:54 +000075ifeq ($(SUBMODULE),1)
76 @git submodule update --init
manarabdelatyb41301c2021-04-19 23:30:35 +020077else
78 cd $(CARAVEL_ROOT)/ && \
79 git checkout master && \
80 git pull
81endif
82
83# Uninstall Caravel
84.PHONY: uninstall
85uninstall:
86ifeq ($(SUBMODULE),1)
87 git submodule deinit -f $(CARAVEL_ROOT)
88 rm -rf .git/modules/$(CARAVEL_NAME)
89 git rm -f $(CARAVEL_ROOT)
90else
91 rm -rf $(CARAVEL_ROOT)
92endif
93
94# Clean
95.PHONY: clean
96clean:
97 cd ./verilog/dv/ && \
98 $(MAKE) -j$(THREADS) clean
99
100check-caravel:
101 @if [ ! -d "$(CARAVEL_ROOT)" ]; then \
102 echo "Caravel Root: "$(CARAVEL_ROOT)" doesn't exists, please export the correct path before running make. "; \
103 exit 1; \
Jeff DiCorpofb944f92021-04-20 00:40:50 +0000104 fi