-
Notifications
You must be signed in to change notification settings - Fork 5
/
Makefile
88 lines (74 loc) · 3.47 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
DESTDIR =
PREFIX = /usr/local
PROGRAM_PREFIX =
YOSYS_CFGFLAGS =
YOSYS_CONFIG ?= yosys-config
# On Windows, manually setting absolute path to Python binary may be required
# for launcher executable to work. From MSYS2, this can be done using the
# following command: "which python3 | cygpath -w -m -f -".
ifeq ($(OS), Windows_NT)
PYTHON = $(shell cygpath -w -m $(PREFIX)/bin/python3)
endif
ifeq ($(file < .gittag),$$Format:%(describe)$$)
YOSYS_RELEASE_VERSION := EQY $(shell git describe --dirty)
else
YOSYS_RELEASE_VERSION := EQY $(file < .gittag)
endif
build: src/eqy_combine.so src/eqy_partition.so src/eqy_recode.so
DEBUG_CXXFLAGS :=
#DEBUG_CXXFLAGS += -Og
COVERAGE := 0
ifeq ($(COVERAGE),1)
YOSYS_CFGFLAGS += --coverage
endif
src/eqy_combine.so: src/eqy_combine.cc
$(YOSYS_CONFIG) --build $@ $(DEBUG_CXXFLAGS) $^ $(YOSYS_CFGFLAGS)
src/eqy_partition.so: src/eqy_partition.cc
$(YOSYS_CONFIG) --build $@ $(DEBUG_CXXFLAGS) $^ $(YOSYS_CFGFLAGS)
src/eqy_recode.so: src/eqy_recode.cc
$(YOSYS_CONFIG) --build $@ $(DEBUG_CXXFLAGS) $^ $(YOSYS_CFGFLAGS)
install: src/eqy_combine.so src/eqy_partition.so src/eqy_recode.so
mkdir -p $(DESTDIR)$(PREFIX)/bin
mkdir -p $(DESTDIR)$(PREFIX)/share/yosys/python3
mkdir -p $(DESTDIR)$(PREFIX)/share/yosys/plugins
cp src/eqy_job.py $(DESTDIR)$(PREFIX)/share/yosys/python3/
cp src/eqy_combine.so $(DESTDIR)$(PREFIX)/share/yosys/plugins/
cp src/eqy_partition.so $(DESTDIR)$(PREFIX)/share/yosys/plugins/
cp src/eqy_recode.so $(DESTDIR)$(PREFIX)/share/yosys/plugins/
ifeq ($(OS), Windows_NT)
sed -e 's|##yosys-sys-path##|sys.path += [os.path.dirname(__file__) + p for p in ["/share/python3", "/../share/yosys/python3"]]|;' \
-e "s|##yosys-release-version##|release_version = '$(YOSYS_RELEASE_VERSION)'|;" \
-e "s|#!/usr/bin/env python3|#!$(PYTHON)|" < src/eqy.py > $(DESTDIR)$(PREFIX)/bin/eqy-script.py
gcc -DGUI=0 -O -s -o $(DESTDIR)$(PREFIX)/bin/eqy.exe extern/launcher.c
else
sed -e 's|##yosys-sys-path##|sys.path += [os.path.dirname(__file__) + p for p in ["/share/python3", "/../share/yosys/python3"]]|;' \
-e "s|##yosys-release-version##|release_version = '$(YOSYS_RELEASE_VERSION)'|;" < src/eqy.py > $(DESTDIR)$(PREFIX)/bin/eqy
chmod +x $(DESTDIR)$(PREFIX)/bin/eqy
endif
html:
$(MAKE) -C docs html
test:
$(MAKE) -C examples/simple clean
$(MAKE) -C examples/simple
$(MAKE) -C tests/python clean
$(MAKE) -C tests/python
+cd tests/plugin && bash run-test.sh
coverage:
rm -rf coverage.info coverage_html .coverage coverage.lcov
$(MAKE) COVERAGE_FILE="$$PWD/.coverage" EQY="coverage run -a $$PWD/src/eqy.py" -C examples/simple clean test
$(MAKE) COVERAGE_FILE="$$PWD/.coverage" EQY="coverage run -a $$PWD/src/eqy.py" -C examples/nerv clean test
$(MAKE) COVERAGE_FILE="$$PWD/.coverage" EQY="coverage run -a $$PWD/src/eqy.py" -C examples/risc16f84 clean test
$(MAKE) COVERAGE_FILE="$$PWD/.coverage" EQY="coverage run -a $$PWD/src/eqy.py" -C tests/python clean test
+cd tests/plugin && bash run-test.sh
lcov --capture -d . --no-external -o coverage.info --gcov-tool $$PWD/llvm-gcov.sh
coverage report --omit=*/dist-packages/*
coverage lcov --omit=*/dist-packages/*
cat coverage.lcov >> coverage.info
genhtml coverage.info --output-directory coverage_html
clean:
$(MAKE) -C docs clean
$(MAKE) -C examples/simple clean
$(MAKE) -C examples/nerv clean
find . -name "*.gcda" -type f -delete
find . -name "*.gcno" -type f -delete
rm -rf docs/build src/eqy_combine.so src/eqy_partition.so src/eqy_recode.so src/__pycache__ coverage.info coverage_html .coverage coverage.lcov