This repository has been archived by the owner on Aug 23, 2024. It is now read-only.
forked from chipsalliance/Surelog
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
128 lines (98 loc) · 4.67 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
# Use bash as the default shell
SHELL := /usr/bin/env bash
ifdef $(LC_ALL)
undefine LC_ALL
endif
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
PREFIX ?= /usr/local
ADDITIONAL_CMAKE_OPTIONS ?=
release: run-cmake-release
cmake --build build -j $(CPU_CORES)
release_with_python: run-cmake-release-with-python
cmake --build build -j $(CPU_CORES)
release_no_tcmalloc: run-cmake-release_no_tcmalloc
cmake --build build -j $(CPU_CORES)
debug: run-cmake-debug
cmake --build dbuild -j $(CPU_CORES)
quick: run-cmake-quick
cmake --build dbuild -j $(CPU_CORES)
run-cmake-release:
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=$(PREFIX) $(ADDITIONAL_CMAKE_OPTIONS) -S . -B build
run-cmake-release-with-python:
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=$(PREFIX) $(ADDITIONAL_CMAKE_OPTIONS) -DSURELOG_WITH_PYTHON=1 -DCMAKE_CXX_FLAGS=-fpermissive -S . -B build
run-cmake-release_no_tcmalloc:
cmake -DNO_TCMALLOC=On -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=$(PREFIX) $(ADDITIONAL_CMAKE_OPTIONS) -S . -B build
run-cmake-debug:
cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=$(PREFIX) -DNO_TCMALLOC=On $(ADDITIONAL_CMAKE_OPTIONS) -S . -B dbuild
run-cmake-quick:
cmake -DQUICK_COMP=1 -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=$(PREFIX) -DNO_TCMALLOC=On $(ADDITIONAL_CMAKE_OPTIONS) -S . -B dbuild
run-cmake-coverage:
cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=$(PREFIX) -DMY_CXX_WARNING_FLAGS="--coverage" $(ADDITIONAL_CMAKE_OPTIONS) -S . -B coverage-build
test/unittest: run-cmake-release
cmake --build build --target UnitTests -j $(CPU_CORES)
pushd build && ctest --output-on-failure && popd
test/unittest-d: run-cmake-debug
cmake --build dbuild --target UnitTests -j $(CPU_CORES)
pushd dbuild && ctest --output-on-failure && popd
test/unittest-coverage: run-cmake-coverage
cmake --build coverage-build --target UnitTests -j $(CPU_CORES)
pushd coverage-build && ctest --output-on-failure && popd
coverage-build/surelog.coverage: test/unittest-coverage
lcov --no-external --exclude "*_test.cpp" --capture --directory coverage-build/CMakeFiles/surelog.dir --base-directory src --output-file coverage-build/surelog.coverage
coverage-build/html: coverage-build/surelog.coverage
genhtml --output-directory coverage-build/html $^
realpath coverage-build/html/index.html
test-parallel: release test/unittest
cmake -E make_directory build/tests
cmake -E remove_directory build/test
cmake -E make_directory build/test
tclsh tests/cmake_gen.tcl . build/test
cmake -S build/test -B build/test/build
pushd build && cmake --build test/build -j $(CPU_CORES) && popd
pushd build && tclsh ../tests/regression.tcl diff_mode show_diff && popd
hellodesign: release
pushd build && tclsh ../tests/regression.tcl exe_name=hellodesign test=Inverter && popd
regression: release
cmake -E make_directory build/tests
cmake -E remove_directory build/test
cmake -E make_directory build/test
tclsh tests/cmake_gen.tcl . build/test
cmake -S build/test -B build/test/build
pushd build && cmake --build test/build -j $(CPU_CORES) && popd
pushd build && tclsh ../tests/regression.tcl diff_mode show_diff && popd
# Formal equivalence checking of Surelog+UHDM+UHDMYosysPlugin+Yosys and Yosys parsers
verification: release
cmake -E make_directory build/tests
cmake -E remove_directory build/test
cmake -E make_directory build/test
tclsh tests/cmake_gen.tcl . build/test verification
cmake -S build/test -B build/test/build
pushd build && cmake --build test/build -j $(CPU_CORES) && popd
pushd build && tclsh ../tests/regression.tcl diff_mode show_diff && popd
test/regression: release
python3 scripts/regression.py run --jobs $(CPU_CORES) --show-diffs
test/valgrind: debug
python3 scripts/regression.py run --tool valgrind --filters TypeParamElab --build-dirpath ${PWD}/dbuild
python3 scripts/regression.py run --tool valgrind --filters ArianeElab --build-dirpath ${PWD}/dbuild
python3 scripts/regression.py run --tool valgrind --filters ArianeElab2 --build-dirpath ${PWD}/dbuild
python3 scripts/regression.py run --tool valgrind --filters BlackParrotMuteErrors --build-dirpath ${PWD}/dbuild
test: release test/unittest test/regression
clean:
$(RM) -r build dbuild coverage-build dist tests/TestInstall/build
install: release
cmake --install build
test_install:
cmake -DCMAKE_BUILD_TYPE=Release -DINSTALL_DIR=$(PREFIX) -S tests/TestInstall -B tests/TestInstall/build
cmake --build tests/TestInstall/build -j $(CPU_CORES)
uninstall:
$(RM) -r $(PREFIX)/bin/surelog
$(RM) -r $(PREFIX)/lib/surelog
$(RM) -r $(PREFIX)/include/Surelog