blob: e406d3b7364c110b8ca80c48d48c9e642fbfc0a6 [file] [log] [blame]
manarabdelaty32b6e9f2021-04-20 10:49:37 +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
17BLOCKS = $(shell find * -maxdepth 0 -type d)
18CONFIG = $(foreach block,$(BLOCKS), ./$(block)/config.tcl)
19CLEAN = $(foreach block,$(BLOCKS), clean-$(block))
20
21OPENLANE_TAG ?= rc7
22OPENLANE_IMAGE_NAME ?= efabless/openlane:$(OPENLANE_TAG)
23OPENLANE_BASIC_COMMAND = "cd /project/openlane && flow.tcl -design ./$* -save_path .. -save -tag $* -overwrite"
24OPENLANE_INTERACTIVE_COMMAND = "cd /project/openlane && flow.tcl -it -file ./$*/interactive.tcl"
25
26all: $(BLOCKS)
27
28$(CONFIG) :
29 @echo "Missing $@. Please create a configuration for that design"
30 @exit 1
31
32$(BLOCKS) : % : ./%/config.tcl FORCE
33ifeq ($(OPENLANE_ROOT),)
34 @echo "Please export OPENLANE_ROOT"
35 @exit 1
36endif
37ifeq ($(PDK_ROOT),)
38 @echo "Please export PDK_ROOT"
39 @exit 1
40endif
41 @echo "###############################################"
42 @sleep 1
43
44 @if [ -f ./$*/interactive.tcl ]; then\
45 docker run -it -v $(OPENLANE_ROOT):/openLANE_flow \
46 -v $(PDK_ROOT):$(PDK_ROOT) \
47 -v $(PWD)/..:/project \
48 -e PDK_ROOT=$(PDK_ROOT) \
49 -u $(shell id -u $(USER)):$(shell id -g $(USER)) \
50 $(OPENLANE_IMAGE_NAME) sh -c $(OPENLANE_INTERACTIVE_COMMAND);\
51 else\
52 docker run -it -v $(OPENLANE_ROOT):/openLANE_flow \
53 -v $(PDK_ROOT):$(PDK_ROOT) \
54 -v $(PWD)/..:/project \
55 -e PDK_ROOT=$(PDK_ROOT) \
56 -u $(shell id -u $(USER)):$(shell id -g $(USER)) \
57 $(OPENLANE_IMAGE_NAME) sh -c $(OPENLANE_BASIC_COMMAND);\
58 fi
59 mkdir -p ../signoff/$*/
60 cp $*/runs/$*/OPENLANE_VERSION ../signoff/$*/
61 cp $*/runs/$*/PDK_SOURCES ../signoff/$*/
62 cp $*/runs/$*/reports/final_summary_report.csv ../signoff/$*/
63
64.PHONY: openlane
65openlane:
66ifeq ($(OPENLANE_ROOT),)
67 @echo "Please export OPENLANE_ROOT"
68 @exit 1
69endif
70 git clone https://github.com/efabless/openlane.git --branch=$(OPENLANE_TAG) --depth=1 $(OPENLANE_ROOT) && \
71 cd $(OPENLANE_ROOT) && \
72 make openlane
73
74FORCE:
75
76clean:
77 @echo "Use clean_all to clean everything :)"
78
79clean_all: $(CLEAN)
80
81$(CLEAN): clean-% :
82 rm -rf runs/$*
83 rm -rf ../gds/$**
84 rm -rf ../mag/$**
85 rm -rf ../lef/$**