blob: 1896b7ee0d7670c617e73c6f3ee92a708a28270d [file] [log] [blame]
Tim 'mithro' Ansell8d719602020-05-08 17:51:41 -07001# Copyright 2020 SkyWater PDK Authors
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# https://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
Tim 'mithro' Ansell7e0b9792020-11-07 14:59:04 -080017# The top directory where environment will be created.
18TOP_DIR := $(realpath $(dir $(lastword $(MAKEFILE_LIST))))
19
20# A pip `requirements.txt` file.
21# https://pip.pypa.io/en/stable/reference/pip_install/#requirements-file-format
22REQUIREMENTS_FILE := requirements.txt
23
24# A conda `environment.yml` file.
25# https://docs.conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html
26ENVIRONMENT_FILE := environment.yml
27
28$(TOP_DIR)/third_party/make-env/conda.mk: $(TOP_DIR)/.gitmodules
29 cd $(TOP_DIR); git submodule update --init third_party/make-env
30
31-include $(TOP_DIR)/third_party/make-env/conda.mk
Tim 'mithro' Ansell8d719602020-05-08 17:51:41 -070032
Tim 'mithro' Ansell01c5bf72020-05-08 19:46:32 -070033.DEFAULT_GOAL := all
34
Tim 'mithro' Ansell7e0b9792020-11-07 14:59:04 -080035include $(TOP_DIR)/scripts/make/git.mk
Tim 'mithro' Ansell01c5bf72020-05-08 19:46:32 -070036README.rst: README.src.rst docs/status.rst Makefile | $(CONDA_ENV_PYTHON)
Tim 'mithro' Ansell8d719602020-05-08 17:51:41 -070037 @rm -f README.rst
Tim 'mithro' Ansell6118ce22020-07-20 14:58:59 -070038 $(IN_CONDA_ENV) rst_include include README.src.rst - \
Tim 'mithro' Ansell01c5bf72020-05-08 19:46:32 -070039 | sed \
40 -e's@|TAG_VERSION|@$(TAG_VERSION)@g' \
41 -e's@:ref:`Versioning Information`@`Versioning Information <docs/versioning.rst>`_@g' \
Tim 'mithro' Ansell24e43102020-05-14 17:12:43 -070042 -e's@:ref:`Known Issues`@`Known Issues <docs/known_issues.rst>`_@g' \
Tim 'mithro' Ansell1242fab2020-05-08 19:50:53 -070043 -e's@.. warning::@*Warning*@g' \
Tim 'mithro' Ansell01c5bf72020-05-08 19:46:32 -070044 > README.rst
45
46
Tim 'mithro' Ansellac8ba832020-05-08 21:32:12 -070047COPYRIGHT_HOLDER := SkyWater PDK Authors
48FIND := find . -path ./env -prune -o -path ./.git -prune -o
49ADDLICENSE := addlicense -f ./docs/license_header.txt
50fix-licenses:
51 @# Makefiles
52 @$(FIND) -type f -name Makefile -exec $(ADDLICENSE) $(ADDLICENSE_EXTRA) -v \{\} \+
53 @$(FIND) -type f -name \*.mk -exec $(ADDLICENSE) $(ADDLICENSE_EXTRA) -v \{\} \+
54 @# Scripting files
55 @$(FIND) -type f -name \*.sh -exec $(ADDLICENSE) $(ADDLICENSE_EXTRA) -v \{\} \+
56 @$(FIND) -type f -name \*.py -exec $(ADDLICENSE) $(ADDLICENSE_EXTRA) -v \{\} \+
57 @# Configuration files
58 @$(FIND) -type f -name \*.yml -exec $(ADDLICENSE) $(ADDLICENSE_EXTRA) -v \{\} \+
59 @# Actual PDK files
60 @$(FIND) -type f -name \*.v -exec $(ADDLICENSE) $(ADDLICENSE_EXTRA) -v \{\} \+
61
62.PHONY: fix-licenses
63
64check-licenses:
65 @make --no-print-directory ADDLICENSE_EXTRA=--check fix-licenses
66
67.PHONY: check-licenses
68
Tim 'mithro' Ansell7e0b9792020-11-07 14:59:04 -080069lint-python: | $(CONDA_ENV_PYTHON)
Christian Claussffffc112020-07-06 20:46:36 +020070 $(IN_CONDA_ENV) flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
Tim 'mithro' Ansellac8ba832020-05-08 21:32:12 -070071
Christian Clausse4f49b52020-07-06 11:41:23 +020072.PHONY: lint-python
73
Tim 'mithro' Ansellac8ba832020-05-08 21:32:12 -070074
Christian Clauss88ddb1e2020-07-07 07:23:43 +020075check: check-licenses lint-python
Tim 'mithro' Ansellac8ba832020-05-08 21:32:12 -070076 @true
77
Tim 'mithro' Ansell01c5bf72020-05-08 19:46:32 -070078all: README.rst
79 @true
80
Tim 'mithro' Ansell74273c42020-06-12 21:16:42 -070081
82LIBRARIES = $(sort $(notdir $(wildcard libraries/sky130_*_sc_*)))
83
84$(LIBRARIES): | $(CONDA_ENV_PYTHON)
85 @$(IN_CONDA_ENV) for V in libraries/$@/*; do \
Sylvain Munaut95238de2020-07-11 22:59:54 +020086 if [ -d "$$V/cells" ]; then \
87 python -m skywater_pdk.liberty $$V; \
88 python -m skywater_pdk.liberty $$V all; \
89 python -m skywater_pdk.liberty $$V all --ccsnoise; \
90 fi \
Tim 'mithro' Ansell74273c42020-06-12 21:16:42 -070091 done
92
93sky130_fd_sc_ms-leakage: | $(CONDA_ENV_PYTHON)
94 @$(IN_CONDA_ENV) for V in libraries/sky130_fd_sc_ms/*; do \
Sylvain Munaut95238de2020-07-11 22:59:54 +020095 if [ -d "$$V/cells" ]; then \
96 python -m skywater_pdk.liberty $$V all --leakage; \
97 fi \
Tim 'mithro' Ansell74273c42020-06-12 21:16:42 -070098 done
99
100sky130_fd_sc_ms: sky130_fd_sc_ms-leakage
101
102timing: $(LIBRARIES) | $(CONDA_ENV_PYTHON)
103 @true
104
105
Tim 'mithro' Ansell01c5bf72020-05-08 19:46:32 -0700106.PHONY: all