agorararmard | 3f79735 | 2020-12-10 18:24:42 +0200 | [diff] [blame] | 1 | # 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 Ghazy | f744e2e | 2020-11-06 11:32:09 +0200 | [diff] [blame] | 17 | BLOCKS = $(shell find * -maxdepth 0 -type d) |
Ahmed Ghazy | 72e52c6 | 2020-10-26 16:44:41 +0200 | [diff] [blame] | 18 | CONFIG = $(foreach block,$(BLOCKS), ./$(block)/config.tcl) |
| 19 | CLEAN = $(foreach block,$(BLOCKS), clean-$(block)) |
| 20 | |
agorararmard | 9722aa2 | 2020-12-11 23:10:57 +0200 | [diff] [blame] | 21 | OPENLANE_TAG ?= rc6 |
agorararmard | 3243208 | 2020-11-26 22:42:00 +0200 | [diff] [blame] | 22 | OPENLANE_IMAGE_NAME ?= openlane:$(OPENLANE_TAG) |
Ahmed Ghazy | f744e2e | 2020-11-06 11:32:09 +0200 | [diff] [blame] | 23 | OPENLANE_BASIC_COMMAND = "cd /project/openlane && flow.tcl -design ./$* -save_path .. -save -tag $* -overwrite" |
| 24 | OPENLANE_INTERACTIVE_COMMAND = "cd /project/openlane && flow.tcl -it -file ./$*/interactive.tcl" |
| 25 | |
Ahmed Ghazy | 72e52c6 | 2020-10-26 16:44:41 +0200 | [diff] [blame] | 26 | all: $(BLOCKS) |
| 27 | |
| 28 | $(CONFIG) : |
| 29 | @echo "Missing $@. Please create a configuration for that design" |
| 30 | @exit 1 |
| 31 | |
| 32 | $(BLOCKS) : % : ./%/config.tcl FORCE |
| 33 | ifeq ($(OPENLANE_ROOT),) |
| 34 | @echo "Please export OPENLANE_ROOT" |
| 35 | @exit 1 |
| 36 | endif |
Ahmed Ghazy | f744e2e | 2020-11-06 11:32:09 +0200 | [diff] [blame] | 37 | ifeq ($(PDK_ROOT),) |
| 38 | @echo "Please export PDK_ROOT" |
| 39 | @exit 1 |
| 40 | endif |
Ahmed Ghazy | 72e52c6 | 2020-10-26 16:44:41 +0200 | [diff] [blame] | 41 | @echo "###############################################" |
| 42 | @sleep 1 |
Ahmed Ghazy | f744e2e | 2020-11-06 11:32:09 +0200 | [diff] [blame] | 43 | |
Ahmed Ghazy | 4666810 | 2020-11-25 18:53:02 +0200 | [diff] [blame] | 44 | @if [ -f ./$*/interactive.tcl ]; then\ |
Ahmed Ghazy | f744e2e | 2020-11-06 11:32:09 +0200 | [diff] [blame] | 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);\ |
Ahmed Ghazy | 72e52c6 | 2020-10-26 16:44:41 +0200 | [diff] [blame] | 51 | else\ |
Ahmed Ghazy | f744e2e | 2020-11-06 11:32:09 +0200 | [diff] [blame] | 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);\ |
Ahmed Ghazy | 72e52c6 | 2020-10-26 16:44:41 +0200 | [diff] [blame] | 58 | fi |
| 59 | |
agorararmard | 3243208 | 2020-11-26 22:42:00 +0200 | [diff] [blame] | 60 | .PHONY: openlane |
| 61 | openlane: |
| 62 | ifeq ($(OPENLANE_ROOT),) |
| 63 | @echo "Please export OPENLANE_ROOT" |
| 64 | @exit 1 |
| 65 | endif |
agorararmard | ab037c9 | 2020-12-14 23:30:29 +0200 | [diff] [blame^] | 66 | git clone https://github.com/efabless/openlane.git --branch=master $(OPENLANE_ROOT) && \ |
agorararmard | 3243208 | 2020-11-26 22:42:00 +0200 | [diff] [blame] | 67 | cd $(OPENLANE_ROOT) && \ |
| 68 | make openlane |
Ahmed Ghazy | f744e2e | 2020-11-06 11:32:09 +0200 | [diff] [blame] | 69 | |
Ahmed Ghazy | 72e52c6 | 2020-10-26 16:44:41 +0200 | [diff] [blame] | 70 | FORCE: |
| 71 | |
| 72 | clean: |
| 73 | @echo "Use clean_all to clean everything :)" |
| 74 | |
| 75 | clean_all: $(CLEAN) |
| 76 | |
| 77 | $(CLEAN): clean-% : |
| 78 | rm -rf runs/$* |
| 79 | rm -rf ../gds/$** |
| 80 | rm -rf ../mag/$** |
| 81 | rm -rf ../lef/$** |