blob: b556fb57892d6f2ac04505db6b89e64bb3aac1b6 [file] [log] [blame]
agorararmard3f797352020-12-10 18:24:42 +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
Ahmed Ghazyf744e2e2020-11-06 11:32:09 +020017BLOCKS = $(shell find * -maxdepth 0 -type d)
Ahmed Ghazy72e52c62020-10-26 16:44:41 +020018CONFIG = $(foreach block,$(BLOCKS), ./$(block)/config.tcl)
19CLEAN = $(foreach block,$(BLOCKS), clean-$(block))
20
agorararmard9722aa22020-12-11 23:10:57 +020021OPENLANE_TAG ?= rc6
agorararmard32432082020-11-26 22:42:00 +020022OPENLANE_IMAGE_NAME ?= openlane:$(OPENLANE_TAG)
Ahmed Ghazyf744e2e2020-11-06 11:32:09 +020023OPENLANE_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
Ahmed Ghazy72e52c62020-10-26 16:44:41 +020026all: $(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
Ahmed Ghazyf744e2e2020-11-06 11:32:09 +020037ifeq ($(PDK_ROOT),)
38 @echo "Please export PDK_ROOT"
39 @exit 1
40endif
Ahmed Ghazy72e52c62020-10-26 16:44:41 +020041 @echo "###############################################"
42 @sleep 1
Ahmed Ghazyf744e2e2020-11-06 11:32:09 +020043
Ahmed Ghazy46668102020-11-25 18:53:02 +020044 @if [ -f ./$*/interactive.tcl ]; then\
Ahmed Ghazyf744e2e2020-11-06 11:32:09 +020045 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);\
Ahmed Ghazy72e52c62020-10-26 16:44:41 +020051 else\
Ahmed Ghazyf744e2e2020-11-06 11:32:09 +020052 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);\
Ahmed Ghazy72e52c62020-10-26 16:44:41 +020058 fi
59
agorararmard32432082020-11-26 22:42:00 +020060.PHONY: openlane
61openlane:
62ifeq ($(OPENLANE_ROOT),)
63 @echo "Please export OPENLANE_ROOT"
64 @exit 1
65endif
agorararmardab037c92020-12-14 23:30:29 +020066 git clone https://github.com/efabless/openlane.git --branch=master $(OPENLANE_ROOT) && \
agorararmard32432082020-11-26 22:42:00 +020067 cd $(OPENLANE_ROOT) && \
68 make openlane
Ahmed Ghazyf744e2e2020-11-06 11:32:09 +020069
Ahmed Ghazy72e52c62020-10-26 16:44:41 +020070FORCE:
71
72clean:
73 @echo "Use clean_all to clean everything :)"
74
75clean_all: $(CLEAN)
76
77$(CLEAN): clean-% :
78 rm -rf runs/$*
79 rm -rf ../gds/$**
80 rm -rf ../mag/$**
81 rm -rf ../lef/$**