forked from chipsalliance/yosys-f4pga-plugins
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
103 lines (81 loc) · 3.1 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
# Copyright 2020-2022 F4PGA Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0
# Version number of Plugins. For simplicity, based on date when we choose to
# release. We can get more sophisticated later (but then need bump Major >= 2).
# Version number has a Major and Minor version number, git-tags are free to
# append a patchlevel (which is number of commits since last X.Y update).
#
# The CI will automatically tag the release with v${PLLUGIN_VERSION}
#
# TODO: pass as -D to gcc so that modules can provide e.g. --version flags.
PLUGIN_VERSION = 1.20230906
PLUGIN_LIST := fasm xdc params sdc ql-iob design_introspection integrateinv ql-qlf dsp-ff
PLUGINS := $(foreach plugin,$(PLUGIN_LIST),$(plugin).so)
PLUGINS_INSTALL := $(foreach plugin,$(PLUGIN_LIST),install_$(plugin))
PLUGINS_CLEAN := $(foreach plugin,$(PLUGIN_LIST),clean_$(plugin))
PLUGINS_TEST := $(foreach plugin,$(PLUGIN_LIST),test_$(plugin))
.PHONY: all
all: plugins
TOP_DIR := $(realpath $(dir $(lastword $(MAKEFILE_LIST))))
REQUIREMENTS_FILE ?= requirements.txt
ENVIRONMENT_FILE ?= environment.yml
-include third_party/make-env/conda.mk
define install_plugin =
.PHONY: $(1).so
$(1).so:
$$(MAKE) -C $(1)-plugin $$@
.PHONY: install_$(1)
install_$(1):
$$(MAKE) -C $(1)-plugin install
.PHONY: clean_$(1)
clean_$(1):
$$(MAKE) -C $(1)-plugin clean
.PHONY: test_$(1)
test_$(1):
@$$(MAKE) --no-print-directory -C $(1)-plugin test
endef
$(foreach plugin,$(PLUGIN_LIST),$(eval $(call install_plugin,$(plugin))))
pmgen.py:
wget -nc -O $@ https://raw.githubusercontent.com/YosysHQ/yosys/master/passes/pmgen/pmgen.py
.PHONY: plugins
plugins: $(PLUGINS)
.PHONY: install
install: $(PLUGINS_INSTALL)
.PHONY: test
test: $(PLUGINS_TEST)
.PHONY: plugins_clean
plugins_clean: $(PLUGINS_CLEAN)
.PHONY: clean
clean:: plugins_clean
rm -rf pmgen.py
CLANG_FORMAT ?= clang-format-8
.PHONY: format
format:
find . \( -name "*.h" -o -name "*.cc" \) -and -not -path '*/third_party/*' -print0 | xargs -0 -P $$(nproc) ${CLANG_FORMAT} -style=file -i
VERIBLE_FORMAT ?= verible-verilog-format
.PHONY: format-verilog
format-verilog:
find */tests \( -name "*.v" -o -name "*.sv" \) -and -not -path '*/third_party/*' -print0 | xargs -0 $(VERIBLE_FORMAT) --inplace
# Notify that the SystemVerilog plugin has been moved
.PHONY: systemverilog.so
systemverilog.so:
$(error The SystemVerilog plugin has been moved to https://github.com/chipsalliance/systemverilog-plugin.)
.PHONY: install_systemverilog
install_systemverilog: systemverilog.so
.PHONY: clean_systemverilog
clean_systemverilog: systemverilog.so
.PHONY: test_systemverilog
test_systemverilog: systemverilog.so