Merge pull request #195 from jix/sbyproc-truncated-output
[SymbiYosys.git] / Makefile
1
2 DESTDIR =
3 PREFIX = /usr/local
4 PROGRAM_PREFIX =
5
6 # On Windows, manually setting absolute path to Python binary may be required
7 # for launcher executable to work. From MSYS2, this can be done using the
8 # following command: "which python3 | cygpath -w -m -f -".
9 ifeq ($(OS), Windows_NT)
10 PYTHON = $(shell cygpath -w -m $(PREFIX)/bin/python3)
11 endif
12
13 .PHONY: help install ci test html clean
14
15 help:
16 @echo ""
17 @echo "sudo make install"
18 @echo " build and install SymbiYosys (sby)"
19 @echo ""
20 @echo "make html"
21 @echo " build documentation in docs/build/html/"
22 @echo ""
23 @echo "make test"
24 @echo " run tests, skipping tests with missing dependencies"
25 @echo ""
26 @echo "make ci"
27 @echo " run all tests, failing tests with missing dependencies"
28 @echo " note: this requires a full Tabby CAD Suite or OSS CAD Suite install"
29 @echo ""
30 @echo "make clean"
31 @echo " cleanup"
32 @echo ""
33
34 install:
35 mkdir -p $(DESTDIR)$(PREFIX)/bin
36 mkdir -p $(DESTDIR)$(PREFIX)/share/yosys/python3
37 cp sbysrc/sby_*.py $(DESTDIR)$(PREFIX)/share/yosys/python3/
38 sed -e 's|##yosys-program-prefix##|"'$(PROGRAM_PREFIX)'"|' < sbysrc/sby_core.py > $(DESTDIR)$(PREFIX)/share/yosys/python3/sby_core.py
39 ifeq ($(OS), Windows_NT)
40 sed -e 's|##yosys-sys-path##|sys.path += [os.path.dirname(__file__) + p for p in ["/share/python3", "/../share/yosys/python3"]]|;' \
41 -e "s|#!/usr/bin/env python3|#!$(PYTHON)|" < sbysrc/sby.py > $(DESTDIR)$(PREFIX)/bin/sby-script.py
42 gcc -DGUI=0 -O -s -o $(DESTDIR)$(PREFIX)/bin/sby.exe extern/launcher.c
43 else
44 sed 's|##yosys-sys-path##|sys.path += [os.path.dirname(__file__) + p for p in ["/share/python3", "/../share/yosys/python3"]]|;' < sbysrc/sby.py > $(DESTDIR)$(PREFIX)/bin/sby
45 chmod +x $(DESTDIR)$(PREFIX)/bin/sby
46 endif
47
48 .PHONY: check_cad_suite run_ci
49
50 ci: check_cad_suite
51 @$(MAKE) run_ci
52
53 run_ci:
54 $(MAKE) test NOSKIP=1
55 if yosys -qp 'read -verific' 2> /dev/null; then set -x; \
56 YOSYS_NOVERIFIC=1 $(MAKE) run_ci; \
57 fi
58
59 check_cad_suite:
60 @if ! which tabbypip >/dev/null 2>&1; then \
61 echo "'make ci' requries the Tabby CAD Suite or the OSS CAD Suite"; \
62 echo "try 'make test' instead or run 'make run_ci' to proceed anyway."; \
63 exit 1; \
64 fi
65
66 test_demo1:
67 cd sbysrc && python3 sby.py -f demo1.sby
68
69 test_demo2:
70 cd sbysrc && python3 sby.py -f demo2.sby
71
72 test_demo3:
73 cd sbysrc && python3 sby.py -f demo3.sby
74
75 test:
76 $(MAKE) -C tests test
77
78 html:
79 $(MAKE) -C docs html
80
81 clean:
82 $(MAKE) -C docs clean
83 rm -rf docs/build sbysrc/sby sbysrc/__pycache__