forked from os-fpga/yosys_verific_rs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
145 lines (129 loc) · 4.73 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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
SHELL := /bin/bash
ifeq ($(CPU_CORES),)
CPU_CORES := $(shell nproc)
ifeq ($(CPU_CORES),)
CPU_CORES := $(shell sysctl -n hw.physicalcpu)
endif
ifeq ($(CPU_CORES),)
CPU_CORES := 2 # Good minimum assumption
endif
endif
ADDITIONAL_CMAKE_OPTIONS ?=
PREFIX ?= /usr/local
RULE_MESSAGES ?= off
##
## @ release
## |---> info : Release build
## |---> usage : make release
release: run-cmake-release
cmake --build build -j $(CPU_CORES)
##
## @ debug
## |---> info : Debug build
## |---> usage : make debug
debug: run-cmake-debug
cmake --build dbuild -j $(CPU_CORES)
run-cmake-release:
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=$(PREFIX) -DPRODUCTION_BUILD=$(PRODUCTION_BUILD) -DCMAKE_RULE_MESSAGES=$(RULE_MESSAGES) -DUPDATE_SUBMODULES=$(UPDATE_SUBMODULES) $(ADDITIONAL_CMAKE_OPTIONS) -S . -B build
run-cmake-debug:
cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=$(PREFIX) -DPRODUCTION_BUILD=$(PRODUCTION_BUILD) -DCMAKE_RULE_MESSAGES=$(RULE_MESSAGES) -DUPDATE_SUBMODULES=$(UPDATE_SUBMODULES) $(ADDITIONAL_CMAKE_OPTIONS) -S . -B dbuild
##
## @ test_gen
## |---> info : Run unit tests
## |---> usage : make test
test_gen: release
cd build && ctest -R genesis-test
##
## @ test
## |---> info : Run unit tests
## |---> usage : make test
test: release
cd build && ctest -R smoke-test
##
## @ dtest
## |---> info : Run unit tests for debug build
## |---> usage : make dtest
dtest: debug
cd dbuild && ctest -R smoke-test
##
## @ dtest_gen
## |---> info : Run unit tests for debug build
## |---> usage : make dtest
dtest_gen: debug
cd dbuild && ctest -R genesis-test
##
## @ valgrind_gen
## |---> info : Run unit tests with valgrind
## |---> usage : make dtest
valgrind_gen:
cmake -DCMAKE_BUILD_TYPE=Debug -DENABLE_VALGRIND_TESTS=ON -DCMAKE_INSTALL_PREFIX=$(PREFIX) -DPRODUCTION_BUILD=$(PRODUCTION_BUILD) -DCMAKE_RULE_MESSAGES=$(RULE_MESSAGES) -DUPDATE_SUBMODULES=$(UPDATE_SUBMODULES) $(ADDITIONAL_CMAKE_OPTIONS) -S . -B dbuild
cmake --build dbuild -j $(CPU_CORES)
cd dbuild && ctest -R valgrind-genesis-test
##
## @ valgrind
## |---> info : Run unit tests with valgrind
## |---> usage : make dtest
valgrind:
cmake -DCMAKE_BUILD_TYPE=Debug -DENABLE_VALGRIND_TESTS=ON -DCMAKE_INSTALL_PREFIX=$(PREFIX) -DPRODUCTION_BUILD=$(PRODUCTION_BUILD) -DCMAKE_RULE_MESSAGES=$(RULE_MESSAGES) -DUPDATE_SUBMODULES=$(UPDATE_SUBMODULES) $(ADDITIONAL_CMAKE_OPTIONS) -S . -B dbuild
cmake --build dbuild -j $(CPU_CORES)
cd dbuild && ctest -R valgrind-test
##
## @ clean_test
## |---> info : Clean unit tests
## |---> usage : make clean_test
clean_test:
# cmake --build build --target clean_analyze
ifneq ("","$(wildcard yosys/install)")
cd yosys-rs-plugin && $(MAKE) $@ YOSYS_PATH=$(shell pwd)/yosys/install
endif
ifneq ("","$(wildcard yosys/debug-install)")
cd yosys-rs-plugin && $(MAKE) $@ YOSYS_PATH=$(shell pwd)/yosys/debug-install
endif
##
## @ clean
## |---> info : Clean all
## |---> usage : make clean
clean:
ifneq ("","$(wildcard build/Makefile)")
cmake --build build --target clean_yosys_verific_rs
endif
ifneq ("","$(wildcard dbuild/Makefile)")
cmake --build dbuild --target clean_yosys_verific_rs
endif
$(RM) -r build dbuild
##
## @ install
## |---> info : Install binaries and libraries
## |---> usage : make install
install: release
cmake --install build
##
## @ test_install
## |---> info : Test if everything is installed properly
## |---> usage : make test_install
test_install:
cd yosys-rs-plugin && $(MAKE) test YOSYS_PATH=$(PREFIX)
##
## @ uninstall
## |---> info : Uninstall binaries and libraries
## |---> usage : make uninstall
uninstall:
$(RM) -r $(PREFIX)/bin/yosys*
$(RM) -r $(PREFIX)/share/yosys
cd logic_synthesis-rs && $(MAKE) $@
help: Makefile
@echo ' #############################################'
@echo ' ###############################################'
@echo ' ### ###'
@echo '### ### ### ######## ### ######### ###'
@echo '### ### ### ######## ### ######### ###'
@echo '### ### ### ### ### ### ### ###'
@echo '### ########## ######## ### ######### ###'
@echo '### ########## ######## ### ######### ###'
@echo '### ### ### ### ### ### ###'
@echo '### ### ### ######## ######## ### ###'
@echo '### ### ### ######## ######## ### ###'
@echo ' ### ###'
@echo ' ###############################################'
@echo ' #############################################'
@sed -n 's/^##//p' $<