12 # features (the more the better)
29 # other configuration flags
35 # sccache is not always a drop-in replacement for ccache in practice
40 # Needed for environments that can't run executables (i.e. emscripten, wasm)
42 # Needed for environments that don't have proper thread support (i.e. emscripten, wasm--for now)
43 DISABLE_ABC_THREADS
:= 0
49 # SANITIZER = undefined
54 OS
:= $(shell uname
-s
)
58 ifneq ($(wildcard Makefile.conf
),)
62 ifeq ($(ENABLE_PYOSYS
),1)
66 BINDIR
:= $(PREFIX
)/bin
67 LIBDIR
:= $(PREFIX
)/lib
/$(PROGRAM_PREFIX
)yosys
68 DATDIR
:= $(PREFIX
)/share
/$(PROGRAM_PREFIX
)yosys
75 TARGETS
= $(PROGRAM_PREFIX
)yosys
$(EXE
) $(PROGRAM_PREFIX
)yosys-config
81 UNITESTPATH
:= tests
/unit
85 YOSYS_SRC
:= $(dir $(firstword $(MAKEFILE_LIST
)))
88 CXXFLAGS
:= $(CXXFLAGS
) -Wall
-Wextra
-ggdb
-I.
-I
"$(YOSYS_SRC)" -MD
-MP
-D_YOSYS_
-fPIC
-I
$(PREFIX
)/include
89 LDLIBS
:= $(LDLIBS
) -lstdc
++ -lm
92 PKG_CONFIG ?
= pkg-config
99 PLUGIN_LDFLAGS
+= -undefined dynamic_lookup
101 # homebrew search paths
102 ifneq ($(shell :; command
-v brew
),)
103 BREW_PREFIX
:= $(shell brew
--prefix)/opt
104 $(info $$BREW_PREFIX is
[${BREW_PREFIX}])
105 ifeq ($(ENABLE_PYOSYS
),1)
106 CXXFLAGS
+= -I
$(BREW_PREFIX
)/boost
/include/boost
107 LDFLAGS
+= -L
$(BREW_PREFIX
)/boost
/lib
109 CXXFLAGS
+= -I
$(BREW_PREFIX
)/readline
/include
110 LDFLAGS
+= -L
$(BREW_PREFIX
)/readline
/lib
111 PKG_CONFIG_PATH
:= $(BREW_PREFIX
)/libffi
/lib
/pkgconfig
:$(PKG_CONFIG_PATH
)
112 PKG_CONFIG_PATH
:= $(BREW_PREFIX
)/tcl-tk
/lib
/pkgconfig
:$(PKG_CONFIG_PATH
)
113 export PATH
:= $(BREW_PREFIX
)/bison
/bin
:$(BREW_PREFIX
)/gettext
/bin
:$(BREW_PREFIX
)/flex
/bin
:$(PATH
)
115 # macports search paths
116 else ifneq ($(shell :; command
-v port
),)
117 PORT_PREFIX
:= $(patsubst %/bin
/port
,%,$(shell :; command
-v port
))
118 CXXFLAGS
+= -I
$(PORT_PREFIX
)/include
119 LDFLAGS
+= -L
$(PORT_PREFIX
)/lib
120 PKG_CONFIG_PATH
:= $(PORT_PREFIX
)/lib
/pkgconfig
:$(PKG_CONFIG_PATH
)
121 export PATH
:= $(PORT_PREFIX
)/bin
:$(PATH
)
129 YOSYS_VER
:= 0.9+4081
130 GIT_REV
:= $(shell cd
$(YOSYS_SRC
) && git rev-parse
--short HEAD
2> /dev
/null || echo UNKNOWN
)
131 OBJS
= kernel
/version_
$(GIT_REV
).o
134 sed
-i
"/^YOSYS_VER := / s/+[0-9][0-9]*$$/+`git log --oneline 8a4c6e6.. | wc -l`/;" Makefile
136 # set 'ABCREV = default' to use abc/ as it is
138 # Note: If you do ABC development, make sure that 'abc' in this directory
139 # is just a symlink to your actual ABC working directory, as 'make mrproper'
140 # will remove the 'abc' directory and you do not want to accidentally
141 # delete your work on ABC..
144 ABCURL ?
= https
://github.com
/YosysHQ
/abc
145 ABCMKARGS
= CC
="$(CXX)" CXX
="$(CXX)" ABC_USE_LIBSTDCXX
=1
147 # set ABCEXTERNAL = <abc-command> to use an external ABC instance
148 # Note: The in-tree ABC (yosys-abc) will not be installed when ABCEXTERNAL is set.
156 ifneq ($(wildcard Makefile.conf
),)
157 # don't echo Makefile.conf contents when invoked to print source versions
158 ifeq ($(findstring echo-
,$(MAKECMDGOALS
)),)
159 $(info $(subst $$--$$,$(newline
),$(shell sed
's,^,[Makefile.conf] ,; s,$$,$$--$$,;' < Makefile.conf | tr
-d
'\n' | sed
's,\$$--\$$$$,,')))
161 include Makefile.conf
164 PYTHON_EXECUTABLE
:= $(shell if python3
-c
""; then echo
"python3"; else echo
"python"; fi
)
165 ifeq ($(ENABLE_PYOSYS
),1)
166 PYTHON_VERSION_TESTCODE
:= "import sys;t='{v[0]}.{v[1]}'.format(v=list(sys.version_info[:2]));print(t)"
167 PYTHON_VERSION
:= $(shell $(PYTHON_EXECUTABLE
) -c
""$(PYTHON_VERSION_TESTCODE
)"")
168 PYTHON_MAJOR_VERSION
:= $(shell echo
$(PYTHON_VERSION
) | cut
-f1
-d.
)
170 ENABLE_PYTHON_CONFIG_EMBED ?
= $(shell $(PYTHON_EXECUTABLE
)-config
--embed
--libs
> /dev
/null
&& echo
1)
171 ifeq ($(ENABLE_PYTHON_CONFIG_EMBED
),1)
172 PYTHON_CONFIG
:= $(PYTHON_EXECUTABLE
)-config
--embed
174 PYTHON_CONFIG
:= $(PYTHON_EXECUTABLE
)-config
177 PYTHON_DESTDIR
:= $(shell $(PYTHON_EXECUTABLE
) -c
"import site; print(site.getsitepackages()[-1]);")
179 # Reload Makefile.conf to override python specific variables if defined
180 ifneq ($(wildcard Makefile.conf
),)
181 include Makefile.conf
186 ifeq ($(CONFIG
),clang
)
189 CXXFLAGS
+= -std
=c
++11 -Os
190 ABCMKARGS
+= ARCHFLAGS
="-DABC_USE_STDINT_H"
192 ifneq ($(SANITIZER
),)
193 $(info [Clang Sanitizer
] $(SANITIZER
))
194 CXXFLAGS
+= -g
-O1
-fno-omit-frame-pointer
-fno-optimize-sibling-calls
-fsanitize
=$(SANITIZER
)
195 LDFLAGS
+= -g
-fsanitize
=$(SANITIZER
)
196 ifeq ($(SANITIZER
),address
)
199 ifeq ($(SANITIZER
),memory
)
200 CXXFLAGS
+= -fPIE
-fsanitize-memory-track-origins
201 LDFLAGS
+= -fPIE
-fsanitize-memory-track-origins
203 ifeq ($(SANITIZER
),cfi
)
209 else ifeq ($(CONFIG
),gcc
)
212 CXXFLAGS
+= -std
=c
++11 -Os
213 ABCMKARGS
+= ARCHFLAGS
="-DABC_USE_STDINT_H"
215 else ifeq ($(CONFIG
),gcc-static
)
217 LDFLAGS
:= $(filter-out -rdynamic
,$(LDFLAGS
)) -static
218 LDLIBS
:= $(filter-out -lrt
,$(LDLIBS
))
219 CXXFLAGS
:= $(filter-out -fPIC
,$(CXXFLAGS
))
220 CXXFLAGS
+= -std
=c
++11 -Os
221 ABCMKARGS
= CC
="$(CC)" CXX
="$(CXX)" LD
="$(LD)" ABC_USE_LIBSTDCXX
=1 LIBS
="-lm -lpthread -static" OPTFLAGS
="-O" \
222 ARCHFLAGS
="-DABC_USE_STDINT_H -DABC_NO_DYNAMIC_LINKING=1 -Wno-unused-but-set-variable $(ARCHFLAGS)" ABC_USE_NO_READLINE
=1
223 ifeq ($(DISABLE_ABC_THREADS
),1)
224 ABCMKARGS
+= "ABC_USE_NO_PTHREADS=1"
227 else ifeq ($(CONFIG
),gcc-4.8
)
230 CXXFLAGS
+= -std
=c
++11 -Os
231 ABCMKARGS
+= ARCHFLAGS
="-DABC_USE_STDINT_H"
233 else ifeq ($(CONFIG
),afl-gcc
)
234 CXX
= AFL_QUIET
=1 AFL_HARDEN
=1 afl-gcc
235 LD
= AFL_QUIET
=1 AFL_HARDEN
=1 afl-gcc
236 CXXFLAGS
+= -std
=c
++11 -Os
237 ABCMKARGS
+= ARCHFLAGS
="-DABC_USE_STDINT_H"
239 else ifeq ($(CONFIG
),cygwin
)
242 CXXFLAGS
+= -std
=gnu
++11 -Os
243 ABCMKARGS
+= ARCHFLAGS
="-DABC_USE_STDINT_H"
245 else ifeq ($(CONFIG
),emcc
)
248 CXXFLAGS
:= -std
=c
++11 $(filter-out -fPIC
-ggdb
,$(CXXFLAGS
))
249 ABCMKARGS
+= ARCHFLAGS
="-DABC_USE_STDINT_H -DABC_MEMALIGN=8"
250 EMCCFLAGS
:= -Os
-Wno-warn-absolute-paths
251 EMCCFLAGS
+= --memory-init-file
0 --embed-file share
-s NO_EXIT_RUNTIME
=1
252 EMCCFLAGS
+= -s EXPORTED_FUNCTIONS
="['_main','_run','_prompt','_errmsg','_memset']"
253 EMCCFLAGS
+= -s TOTAL_MEMORY
=134217728
254 EMCCFLAGS
+= -s EXTRA_EXPORTED_RUNTIME_METHODS
='["ccall", "cwrap"]'
255 # https://github.com/kripken/emscripten/blob/master/src/settings.js
256 CXXFLAGS
+= $(EMCCFLAGS
)
257 LDFLAGS
+= $(EMCCFLAGS
)
263 TARGETS
:= $(filter-out $(PROGRAM_PREFIX
)yosys-config
,$(TARGETS
))
264 EXTRA_TARGETS
+= yosysjs-
$(YOSYS_VER
).zip
266 ifeq ($(ENABLE_ABC
),1)
268 DISABLE_ABC_THREADS
:= 1
272 wget
-O viz.js.part https
://github.com
/mdaines
/viz.js
/releases
/download
/0.0.3/viz.js
273 mv viz.js.part viz.js
275 yosysjs-
$(YOSYS_VER
).zip
: yosys.js yosys.wasm viz.js misc
/yosysjs
/*
276 rm -rf yosysjs-
$(YOSYS_VER
) yosysjs-
$(YOSYS_VER
).zip
277 mkdir
-p yosysjs-
$(YOSYS_VER
)
278 cp viz.js misc
/yosysjs
/* yosys.js yosys.wasm yosysjs-
$(YOSYS_VER
)/
279 zip
-r yosysjs-
$(YOSYS_VER
).zip yosysjs-
$(YOSYS_VER
)
281 yosys.html
: misc
/yosys.html
282 $(P
) cp misc
/yosys.html yosys.html
284 else ifeq ($(CONFIG
),wasi
)
290 WASIFLAGS
:= -target wasm32-wasi
--sysroot
$(WASI_SYSROOT
) $(WASIFLAGS
)
292 CXX
= $(WASI_SDK
)/bin
/clang
293 LD
= $(WASI_SDK
)/bin
/clang
++
294 AR
= $(WASI_SDK
)/bin
/ar
295 RANLIB
= $(WASI_SDK
)/bin
/ranlib
296 WASIFLAGS
:= --sysroot
$(WASI_SDK
)/share
/wasi-sysroot
$(WASIFLAGS
)
298 CXXFLAGS
:= $(WASIFLAGS
) -std
=c
++11 -Os
$(filter-out -fPIC
,$(CXXFLAGS
))
299 LDFLAGS
:= $(WASIFLAGS
) -Wl
,-z
,stack-size
=1048576 $(filter-out -rdynamic
,$(LDFLAGS
))
300 LDLIBS
:= $(filter-out -lrt
,$(LDLIBS
))
301 ABCMKARGS
+= AR
="$(AR)" RANLIB
="$(RANLIB)"
302 ABCMKARGS
+= ARCHFLAGS
="$(WASIFLAGS) -DABC_USE_STDINT_H -DABC_NO_DYNAMIC_LINKING"
303 ABCMKARGS
+= OPTFLAGS
="-Os"
308 ifeq ($(ENABLE_ABC
),1)
310 DISABLE_ABC_THREADS
:= 1
313 else ifeq ($(CONFIG
),mxe
)
314 PKG_CONFIG
= /usr
/local
/src
/mxe
/usr
/bin
/i686-w64-mingw32.static-pkg-config
315 CXX
= /usr
/local
/src
/mxe
/usr
/bin
/i686-w64-mingw32.static-g
++
316 LD
= /usr
/local
/src
/mxe
/usr
/bin
/i686-w64-mingw32.static-g
++
317 CXXFLAGS
+= -std
=c
++11 -Os
-D_POSIX_SOURCE
-DYOSYS_MXE_HACKS
-Wno-attributes
318 CXXFLAGS
:= $(filter-out -fPIC
,$(CXXFLAGS
))
319 LDFLAGS
:= $(filter-out -rdynamic
,$(LDFLAGS
)) -s
320 LDLIBS
:= $(filter-out -lrt
,$(LDLIBS
))
321 ABCMKARGS
+= ARCHFLAGS
="-DWIN32_NO_DLL -DHAVE_STRUCT_TIMESPEC -fpermissive -w"
322 # TODO: Try to solve pthread linking issue in more appropriate way
323 ABCMKARGS
+= LIBS
="lib/x86/pthreadVC2.lib -s" LDFLAGS
="-Wl,--allow-multiple-definition" ABC_USE_NO_READLINE
=1 CC
="/usr/local/src/mxe/usr/bin/i686-w64-mingw32.static-gcc"
326 else ifeq ($(CONFIG
),msys2-32
)
327 CXX
= i686-w64-mingw32-g
++
328 LD
= i686-w64-mingw32-g
++
329 CXXFLAGS
+= -std
=c
++11 -Os
-D_POSIX_SOURCE
-DYOSYS_WIN32_UNIX_DIR
330 CXXFLAGS
:= $(filter-out -fPIC
,$(CXXFLAGS
))
331 LDFLAGS
:= $(filter-out -rdynamic
,$(LDFLAGS
)) -s
332 LDLIBS
:= $(filter-out -lrt
,$(LDLIBS
))
333 ABCMKARGS
+= ARCHFLAGS
="-DABC_USE_STDINT_H -DWIN32_NO_DLL -DHAVE_STRUCT_TIMESPEC -fpermissive -w"
334 ABCMKARGS
+= LIBS
="-lpthread -s" ABC_USE_NO_READLINE
=0 CC
="i686-w64-mingw32-gcc" CXX
="$(CXX)"
337 else ifeq ($(CONFIG
),msys2-64
)
338 CXX
= x86_64-w64-mingw32-g
++
339 LD
= x86_64-w64-mingw32-g
++
340 CXXFLAGS
+= -std
=c
++11 -Os
-D_POSIX_SOURCE
-DYOSYS_WIN32_UNIX_DIR
341 CXXFLAGS
:= $(filter-out -fPIC
,$(CXXFLAGS
))
342 LDFLAGS
:= $(filter-out -rdynamic
,$(LDFLAGS
)) -s
343 LDLIBS
:= $(filter-out -lrt
,$(LDLIBS
))
344 ABCMKARGS
+= ARCHFLAGS
="-DABC_USE_STDINT_H -DWIN32_NO_DLL -DHAVE_STRUCT_TIMESPEC -fpermissive -w"
345 ABCMKARGS
+= LIBS
="-lpthread -s" ABC_USE_NO_READLINE
=0 CC
="x86_64-w64-mingw32-gcc" CXX
="$(CXX)"
348 else ifneq ($(CONFIG
),none
)
349 $(error Invalid CONFIG setting
'$(CONFIG)'. Valid values
: clang
, gcc
, gcc-4.8
, emcc
, mxe
, msys2-32
, msys2-64
)
352 ifeq ($(ENABLE_LIBYOSYS
),1)
353 TARGETS
+= libyosys.so
356 ifeq ($(ENABLE_PYOSYS
),1)
358 #Detect name of boost_python library. Some distros usbe boost_python-py<version>, other boost_python<version>, some only use the major version number, some a concatenation of major and minor version numbers
360 BOOST_PYTHON_LIB ?
= $(shell \
361 if echo
"int main(int argc, char ** argv) {return 0;}" |
$(CXX
) -xc
-o
/dev
/null
$(shell $(PYTHON_CONFIG
) --ldflags) -lboost_python-py
$(subst .
,,$(PYTHON_VERSION
)) - > /dev
/null
2>&1; then echo
"-lboost_python-py$(subst .,,$(PYTHON_VERSION))"; else \
362 if echo
"int main(int argc, char ** argv) {return 0;}" |
$(CXX
) -xc
-o
/dev
/null
$(shell $(PYTHON_CONFIG
) --ldflags) -lboost_python-py
$(subst .
,,$(PYTHON_MAJOR_VERSION
)) - > /dev
/null
2>&1; then echo
"-lboost_python-py$(subst .,,$(PYTHON_MAJOR_VERSION))"; else \
363 if echo
"int main(int argc, char ** argv) {return 0;}" |
$(CXX
) -xc
-o
/dev
/null
$(shell $(PYTHON_CONFIG
) --ldflags) -lboost_python
$(subst .
,,$(PYTHON_VERSION
)) - > /dev
/null
2>&1; then echo
"-lboost_python$(subst .,,$(PYTHON_VERSION))"; else \
364 if echo
"int main(int argc, char ** argv) {return 0;}" |
$(CXX
) -xc
-o
/dev
/null
$(shell $(PYTHON_CONFIG
) --ldflags) -lboost_python
$(subst .
,,$(PYTHON_MAJOR_VERSION
)) - > /dev
/null
2>&1; then echo
"-lboost_python$(subst .,,$(PYTHON_MAJOR_VERSION))"; else \
365 echo
""; fi
; fi
; fi
; fi
;)
367 BOOST_PYTHON_LIB ?
= $(shell \
368 if echo
"int main(int argc, char ** argv) {return 0;}" |
$(CXX
) -xc
-o
/dev
/null
`$(PYTHON_CONFIG) --libs` -lboost_python-py
$(subst .
,,$(PYTHON_VERSION
)) - > /dev
/null
2>&1; then echo
"-lboost_python-py$(subst .,,$(PYTHON_VERSION))"; else \
369 if echo
"int main(int argc, char ** argv) {return 0;}" |
$(CXX
) -xc
-o
/dev
/null
`$(PYTHON_CONFIG) --libs` -lboost_python-py
$(subst .
,,$(PYTHON_MAJOR_VERSION
)) - > /dev
/null
2>&1; then echo
"-lboost_python-py$(subst .,,$(PYTHON_MAJOR_VERSION))"; else \
370 if echo
"int main(int argc, char ** argv) {return 0;}" |
$(CXX
) -xc
-o
/dev
/null
`$(PYTHON_CONFIG) --libs` -lboost_python
$(subst .
,,$(PYTHON_VERSION
)) - > /dev
/null
2>&1; then echo
"-lboost_python$(subst .,,$(PYTHON_VERSION))"; else \
371 if echo
"int main(int argc, char ** argv) {return 0;}" |
$(CXX
) -xc
-o
/dev
/null
`$(PYTHON_CONFIG) --libs` -lboost_python
$(subst .
,,$(PYTHON_MAJOR_VERSION
)) - > /dev
/null
2>&1; then echo
"-lboost_python$(subst .,,$(PYTHON_MAJOR_VERSION))"; else \
372 echo
""; fi
; fi
; fi
; fi
;)
375 ifeq ($(BOOST_PYTHON_LIB
),)
376 $(error BOOST_PYTHON_LIB could not be detected. Please
define manually
)
380 ifeq ($(PYTHON_MAJOR_VERSION
),3)
381 LDLIBS
+= $(shell $(PYTHON_CONFIG
) --ldflags) $(BOOST_PYTHON_LIB
) -lboost_system
-lboost_filesystem
382 CXXFLAGS
+= $(shell $(PYTHON_CONFIG
) --includes
) -DWITH_PYTHON
384 LDLIBS
+= $(shell $(PYTHON_CONFIG
) --ldflags) $(BOOST_PYTHON_LIB
) -lboost_system
-lboost_filesystem
385 CXXFLAGS
+= $(shell $(PYTHON_CONFIG
) --includes
) -DWITH_PYTHON
388 ifeq ($(PYTHON_MAJOR_VERSION
),3)
389 LDLIBS
+= $(shell $(PYTHON_CONFIG
) --libs
) $(BOOST_PYTHON_LIB
) -lboost_system
-lboost_filesystem
390 CXXFLAGS
+= $(shell $(PYTHON_CONFIG
) --includes
) -DWITH_PYTHON
392 LDLIBS
+= $(shell $(PYTHON_CONFIG
) --libs
) $(BOOST_PYTHON_LIB
) -lboost_system
-lboost_filesystem
393 CXXFLAGS
+= $(shell $(PYTHON_CONFIG
) --includes
) -DWITH_PYTHON
397 ifeq ($(ENABLE_PYOSYS
),1)
398 PY_WRAPPER_FILE
= kernel
/python_wrappers
399 OBJS
+= $(PY_WRAPPER_FILE
).o
400 PY_GEN_SCRIPT
= py_wrap_generator
401 PY_WRAP_INCLUDES
:= $(shell python
$(PYTHON_VERSION
) -c
"from misc import $(PY_GEN_SCRIPT); $(PY_GEN_SCRIPT).print_includes()")
405 ifeq ($(ENABLE_READLINE
),1)
406 CXXFLAGS
+= -DYOSYS_ENABLE_READLINE
407 ifeq ($(OS
), FreeBSD
)
408 CXXFLAGS
+= -I
/usr
/local
/include
411 ifeq ($(LINK_CURSES
),1)
413 ABCMKARGS
+= "ABC_READLINE_LIBRARIES=-lcurses -lreadline"
415 ifeq ($(LINK_TERMCAP
),1)
417 ABCMKARGS
+= "ABC_READLINE_LIBRARIES=-lreadline -ltermcap"
423 ifeq ($(ENABLE_EDITLINE
),1)
424 CXXFLAGS
+= -DYOSYS_ENABLE_EDITLINE
425 LDLIBS
+= -ledit
-ltinfo
-lbsd
427 ABCMKARGS
+= "ABC_USE_NO_READLINE=1"
431 ifeq ($(DISABLE_ABC_THREADS
),1)
432 ABCMKARGS
+= "ABC_USE_NO_PTHREADS=1"
435 ifeq ($(DISABLE_SPAWN
),1)
436 CXXFLAGS
+= -DYOSYS_DISABLE_SPAWN
439 ifeq ($(ENABLE_PLUGINS
),1)
440 CXXFLAGS
+= $(shell PKG_CONFIG_PATH
=$(PKG_CONFIG_PATH
) $(PKG_CONFIG
) --silence-errors
--cflags libffi
) -DYOSYS_ENABLE_PLUGINS
441 LDLIBS
+= $(shell PKG_CONFIG_PATH
=$(PKG_CONFIG_PATH
) $(PKG_CONFIG
) --silence-errors
--libs libffi || echo
-lffi
)
442 ifneq ($(OS
), FreeBSD
)
447 ifeq ($(ENABLE_GLOB
),1)
448 CXXFLAGS
+= -DYOSYS_ENABLE_GLOB
451 ifeq ($(ENABLE_ZLIB
),1)
452 CXXFLAGS
+= -DYOSYS_ENABLE_ZLIB
457 ifeq ($(ENABLE_TCL
),1)
458 TCL_VERSION ?
= tcl
$(shell bash
-c
"tclsh <(echo 'puts [info tclversion]')")
459 ifeq ($(OS
), FreeBSD
)
460 TCL_INCLUDE ?
= /usr
/local
/include/$(TCL_VERSION
)
462 TCL_INCLUDE ?
= /usr
/include/$(TCL_VERSION
)
466 CXXFLAGS
+= -DYOSYS_ENABLE_TCL
467 LDLIBS
+= -ltcl86
-lwsock32
-lws2_32
-lnetapi32
-lz
-luserenv
469 CXXFLAGS
+= $(shell PKG_CONFIG_PATH
=$(PKG_CONFIG_PATH
) $(PKG_CONFIG
) --silence-errors
--cflags tcl || echo
-I
$(TCL_INCLUDE
)) -DYOSYS_ENABLE_TCL
470 ifeq ($(OS
), FreeBSD
)
471 # FreeBSD uses tcl8.6, but lib is named "libtcl86"
472 LDLIBS
+= $(shell PKG_CONFIG_PATH
=$(PKG_CONFIG_PATH
) $(PKG_CONFIG
) --silence-errors
--libs tcl || echo
-l
$(TCL_VERSION
) | tr
-d
'.')
474 LDLIBS
+= $(shell PKG_CONFIG_PATH
=$(PKG_CONFIG_PATH
) $(PKG_CONFIG
) --silence-errors
--libs tcl || echo
-l
$(TCL_VERSION
))
479 ifeq ($(ENABLE_GCOV
),1)
480 CXXFLAGS
+= --coverage
481 LDFLAGS
+= --coverage
484 ifeq ($(ENABLE_GPROF
),1)
489 ifeq ($(ENABLE_NDEBUG
),1)
490 CXXFLAGS
:= -O3
-DNDEBUG
$(filter-out -Os
-ggdb
,$(CXXFLAGS
))
493 ifeq ($(ENABLE_DEBUG
),1)
494 ifeq ($(CONFIG
),clang
)
495 CXXFLAGS
:= -O0
-DDEBUG
$(filter-out -Os
,$(CXXFLAGS
))
497 CXXFLAGS
:= -Og
-DDEBUG
$(filter-out -Os
,$(CXXFLAGS
))
501 ifeq ($(ENABLE_ABC
),1)
502 CXXFLAGS
+= -DYOSYS_ENABLE_ABC
504 CXXFLAGS
+= -DYOSYS_LINK_ABC
505 ifeq ($(DISABLE_ABC_THREADS
),0)
509 ifeq ($(ABCEXTERNAL
),)
510 TARGETS
+= $(PROGRAM_PREFIX
)yosys-abc
$(EXE
)
515 ifeq ($(ENABLE_GHDL
),1)
516 GHDL_PREFIX ?
= $(PREFIX
)
517 GHDL_INCLUDE_DIR ?
= $(GHDL_PREFIX
)/include
518 GHDL_LIB_DIR ?
= $(GHDL_PREFIX
)/lib
519 CXXFLAGS
+= -I
$(GHDL_INCLUDE_DIR
) -DYOSYS_ENABLE_GHDL
520 LDLIBS
+= $(GHDL_LIB_DIR
)/libghdl.a
$(file
<$(GHDL_LIB_DIR
)/libghdl.link
)
523 ifeq ($(ENABLE_VERIFIC
),1)
524 VERIFIC_DIR ?
= /usr
/local
/src
/verific_lib
525 VERIFIC_COMPONENTS ?
= verilog vhdl database util containers hier_tree
526 CXXFLAGS
+= $(patsubst %,-I
$(VERIFIC_DIR
)/%,$(VERIFIC_COMPONENTS
)) -DYOSYS_ENABLE_VERIFIC
528 LDLIBS
+= $(patsubst %,$(VERIFIC_DIR
)/%/*-mac.a
,$(VERIFIC_COMPONENTS
)) -lz
530 LDLIBS
+= $(patsubst %,$(VERIFIC_DIR
)/%/*-linux.a
,$(VERIFIC_COMPONENTS
)) -lz
534 ifeq ($(ENABLE_PROTOBUF
),1)
535 LDLIBS
+= $(shell pkg-config
--cflags --libs protobuf
)
538 ifeq ($(ENABLE_COVER
),1)
539 CXXFLAGS
+= -DYOSYS_ENABLE_COVER
542 ifeq ($(ENABLE_CCACHE
),1)
545 ifeq ($(ENABLE_SCCACHE
),1)
546 CXX
:= sccache
$(CXX
)
550 define add_share_file
551 EXTRA_TARGETS
+= $(subst //,/,$(1)/$(notdir $(2)))
552 $(subst //,/,$(1)/$(notdir $(2))): $(2)
554 $$(Q
) cp
"$(YOSYS_SRC)"/$(2) $(subst //,/,$(1)/$(notdir $(2)))
557 define add_gen_share_file
558 EXTRA_TARGETS
+= $(subst //,/,$(1)/$(notdir $(2)))
559 $(subst //,/,$(1)/$(notdir $(2))): $(2)
561 $$(Q
) cp
$(2) $(subst //,/,$(1)/$(notdir $(2)))
564 define add_include_file
565 $(eval
$(call add_share_file
,$(dir share
/include/$(1)),$(1)))
568 define add_extra_objs
576 P_UPDATE
= $(eval P_STATUS
=$(shell echo
$(OBJS
) $(PROGRAM_PREFIX
)yosys
$(EXE
) |
$(AWK
) 'BEGIN { RS = " "; I = $(P_STATUS)+0; } $$1 == "$@" && NR > I { I = NR; } END { print I; }'))
577 P_SHOW
= [$(shell $(AWK
) "BEGIN { N=$(words $(OBJS) $(PROGRAM_PREFIX)yosys$(EXE)); printf \"%3d\", $(P_OFFSET)+90*$(P_STATUS)/N; exit; }")%]
578 P
= @echo
"$(if $(findstring $@,$(TARGETS) $(EXTRA_TARGETS)),$(eval P_OFFSET = 10))$(call P_UPDATE)$(call P_SHOW) Building $@";
588 $(eval
$(call add_include_file
,kernel
/yosys.h
))
589 $(eval
$(call add_include_file
,kernel
/hashlib.h
))
590 $(eval
$(call add_include_file
,kernel
/log.h
))
591 $(eval
$(call add_include_file
,kernel
/rtlil.h
))
592 $(eval
$(call add_include_file
,kernel
/register.h
))
593 $(eval
$(call add_include_file
,kernel
/celltypes.h
))
594 $(eval
$(call add_include_file
,kernel
/celledges.h
))
595 $(eval
$(call add_include_file
,kernel
/consteval.h
))
596 $(eval
$(call add_include_file
,kernel
/constids.inc
))
597 $(eval
$(call add_include_file
,kernel
/sigtools.h
))
598 $(eval
$(call add_include_file
,kernel
/modtools.h
))
599 $(eval
$(call add_include_file
,kernel
/macc.h
))
600 $(eval
$(call add_include_file
,kernel
/utils.h
))
601 $(eval
$(call add_include_file
,kernel
/satgen.h
))
602 $(eval
$(call add_include_file
,kernel
/ff.h
))
603 $(eval
$(call add_include_file
,kernel
/ffinit.h
))
604 $(eval
$(call add_include_file
,kernel
/mem.h
))
605 $(eval
$(call add_include_file
,libs
/ezsat
/ezsat.h
))
606 $(eval
$(call add_include_file
,libs
/ezsat
/ezminisat.h
))
607 $(eval
$(call add_include_file
,libs
/sha1
/sha1.h
))
608 $(eval
$(call add_include_file
,libs
/json11
/json11.hpp
))
609 $(eval
$(call add_include_file
,passes
/fsm
/fsmdata.h
))
610 $(eval
$(call add_include_file
,frontends
/ast
/ast.h
))
611 $(eval
$(call add_include_file
,backends
/rtlil
/rtlil_backend.h
))
612 $(eval
$(call add_include_file
,backends
/cxxrtl
/cxxrtl.h
))
613 $(eval
$(call add_include_file
,backends
/cxxrtl
/cxxrtl_vcd.h
))
614 $(eval
$(call add_include_file
,backends
/cxxrtl
/cxxrtl_capi.
cc))
615 $(eval
$(call add_include_file
,backends
/cxxrtl
/cxxrtl_capi.h
))
616 $(eval
$(call add_include_file
,backends
/cxxrtl
/cxxrtl_vcd_capi.
cc))
617 $(eval
$(call add_include_file
,backends
/cxxrtl
/cxxrtl_vcd_capi.h
))
619 OBJS
+= kernel
/driver.o kernel
/register.o kernel
/rtlil.o kernel
/log.o kernel
/calc.o kernel
/yosys.o
620 ifeq ($(ENABLE_ABC
),1)
621 ifneq ($(ABCEXTERNAL
),)
622 kernel
/yosys.o
: CXXFLAGS
+= -DABCEXTERNAL
='"$(ABCEXTERNAL)"'
625 OBJS
+= kernel
/cellaigs.o kernel
/celledges.o kernel
/satgen.o kernel
/mem.o kernel
/ffmerge.o
627 kernel
/log.o
: CXXFLAGS
+= -DYOSYS_SRC
='"$(YOSYS_SRC)"'
628 kernel
/yosys.o
: CXXFLAGS
+= -DYOSYS_DATDIR
='"$(DATDIR)"' -DYOSYS_PROGRAM_PREFIX
='"$(PROGRAM_PREFIX)"'
630 OBJS
+= libs
/bigint
/BigIntegerAlgorithms.o libs
/bigint
/BigInteger.o libs
/bigint
/BigIntegerUtils.o
631 OBJS
+= libs
/bigint
/BigUnsigned.o libs
/bigint
/BigUnsignedInABase.o
633 OBJS
+= libs
/sha1
/sha1.o
637 OBJS
+= libs
/json11
/json11.o
639 OBJS
+= libs
/subcircuit
/subcircuit.o
641 OBJS
+= libs
/ezsat
/ezsat.o
642 OBJS
+= libs
/ezsat
/ezminisat.o
644 OBJS
+= libs
/minisat
/Options.o
645 OBJS
+= libs
/minisat
/SimpSolver.o
646 OBJS
+= libs
/minisat
/Solver.o
647 OBJS
+= libs
/minisat
/System.o
649 include $(YOSYS_SRC
)/frontends
/*/Makefile.inc
650 include $(YOSYS_SRC
)/passes
/*/Makefile.inc
651 include $(YOSYS_SRC
)/backends
/*/Makefile.inc
652 include $(YOSYS_SRC
)/techlibs
/*/Makefile.inc
656 include $(YOSYS_SRC
)/frontends
/verilog
/Makefile.inc
657 include $(YOSYS_SRC
)/frontends
/rtlil
/Makefile.inc
658 include $(YOSYS_SRC
)/frontends
/ast
/Makefile.inc
659 include $(YOSYS_SRC
)/frontends
/blif
/Makefile.inc
661 OBJS
+= passes
/hierarchy
/hierarchy.o
662 OBJS
+= passes
/cmds
/select.o
663 OBJS
+= passes
/cmds
/show.o
664 OBJS
+= passes
/cmds
/stat.o
665 OBJS
+= passes
/cmds
/cover.o
666 OBJS
+= passes
/cmds
/design.o
667 OBJS
+= passes
/cmds
/plugin.o
669 include $(YOSYS_SRC
)/passes
/proc
/Makefile.inc
670 include $(YOSYS_SRC
)/passes
/opt
/Makefile.inc
671 include $(YOSYS_SRC
)/passes
/techmap
/Makefile.inc
673 include $(YOSYS_SRC
)/backends
/verilog
/Makefile.inc
674 include $(YOSYS_SRC
)/backends
/rtlil
/Makefile.inc
676 include $(YOSYS_SRC
)/techlibs
/common
/Makefile.inc
681 OBJS
+= $(PROGRAM_PREFIX
)yosys-libabc.a
684 # prevent the CXXFLAGS set by this Makefile from reaching abc/Makefile,
685 # especially the -MD flag which will break the build when CXX is clang
688 top-all
: $(TARGETS
) $(EXTRA_TARGETS
)
690 @echo
" Build successful."
693 ifeq ($(CONFIG
),emcc
)
694 yosys.js
: $(filter-out yosysjs-
$(YOSYS_VER
).zip
,$(EXTRA_TARGETS
))
697 $(PROGRAM_PREFIX
)yosys
$(EXE
): $(OBJS
)
698 $(P
) $(LD
) -o
$(PROGRAM_PREFIX
)yosys
$(EXE
) $(LDFLAGS
) $(OBJS
) $(LDLIBS
)
700 libyosys.so
: $(filter-out kernel
/driver.o
,$(OBJS
))
702 $(P
) $(LD
) -o libyosys.so
-shared
-Wl
,-install_name
,$(DESTDIR
)$(LIBDIR
)/libyosys.so
$(LDFLAGS
) $^
$(LDLIBS
)
704 $(P
) $(LD
) -o libyosys.so
-shared
-Wl
,-soname
,$(DESTDIR
)$(LIBDIR
)/libyosys.so
$(LDFLAGS
) $^
$(LDLIBS
)
708 $(Q
) mkdir
-p
$(dir $@
)
709 $(P
) $(CXX
) -o
$@
-c
$(CPPFLAGS
) $(CXXFLAGS
) $<
712 $(Q
) mkdir
-p
$(dir $@
)
713 $(P
) cat
$< | grep
-E
-v
"#[ ]*(include|error)" |
$(LD
) $(CXXFLAGS
) -x c
++ -o
$@
-E
-P
-
715 ifeq ($(ENABLE_PYOSYS
),1)
716 $(PY_WRAPPER_FILE
).
cc: misc
/$(PY_GEN_SCRIPT
).py
$(PY_WRAP_INCLUDES
)
717 $(Q
) mkdir
-p
$(dir $@
)
718 $(P
) python
$(PYTHON_VERSION
) -c
"from misc import $(PY_GEN_SCRIPT); $(PY_GEN_SCRIPT).gen_wrappers(\"$(PY_WRAPPER_FILE).cc\")"
722 $(Q
) mkdir
-p
$(dir $@
)
723 $(P
) $(CXX
) -o
$@
-c
$(CPPFLAGS
) $(CXXFLAGS
) $<
725 YOSYS_VER_STR
:= Yosys
$(YOSYS_VER
) (git sha1
$(GIT_REV
), $(notdir $(CXX
)) $(shell \
726 $(CXX
) --version | tr
' ()' '\n' | grep
'^[0-9]' | head
-n1
) $(filter -f
% -m
% -O
% -DNDEBUG
,$(CXXFLAGS
)))
728 kernel
/version_
$(GIT_REV
).
cc: $(YOSYS_SRC
)/Makefile
729 $(P
) rm -f kernel
/version_
*.o kernel
/version_
*.d kernel
/version_
*.
cc
730 $(Q
) mkdir
-p kernel
&& echo
"namespace Yosys { extern const char *yosys_version_str; const char *yosys_version_str=\"$(YOSYS_VER_STR)\"; }" > kernel
/version_
$(GIT_REV
).
cc
732 ifeq ($(ENABLE_VERIFIC
),1)
733 CXXFLAGS_NOVERIFIC
= $(foreach v
,$(CXXFLAGS
),$(if
$(findstring $(VERIFIC_DIR
),$(v
)),,$(v
)))
734 LDLIBS_NOVERIFIC
= $(foreach v
,$(LDLIBS
),$(if
$(findstring $(VERIFIC_DIR
),$(v
)),,$(v
)))
736 CXXFLAGS_NOVERIFIC
= $(CXXFLAGS
)
737 LDLIBS_NOVERIFIC
= $(LDLIBS
)
740 $(PROGRAM_PREFIX
)yosys-config
: misc
/yosys-config.in
741 $(P
) $(SED
) -e
's#@CXXFLAGS@#$(subst -I. -I"$(YOSYS_SRC)",-I"$(DATDIR)/include",$(strip $(CXXFLAGS_NOVERIFIC)))#;' \
742 -e
's#@CXX@#$(strip $(CXX))#;' -e
's#@LDFLAGS@#$(strip $(LDFLAGS) $(PLUGIN_LDFLAGS))#;' -e
's#@LDLIBS@#$(strip $(LDLIBS_NOVERIFIC))#;' \
743 -e
's#@BINDIR@#$(strip $(BINDIR))#;' -e
's#@DATDIR@#$(strip $(DATDIR))#;' < $< > $(PROGRAM_PREFIX
)yosys-config
744 $(Q
) chmod
+x
$(PROGRAM_PREFIX
)yosys-config
746 abc
/abc-
$(ABCREV
)$(EXE
) abc
/libabc-
$(ABCREV
).a
:
748 ifneq ($(ABCREV
),default
)
749 $(Q
) if
test -d abc
/.hg
; then \
750 echo
'REEBE: NOP qverpgbel vf n ut jbexvat pbcl! Erzbir nop/ naq er-eha "znxr".' | tr
'A-Za-z' 'N-ZA-Mn-za-m'; false
; \
752 $(Q
) if
( cd abc
2> /dev
/null
&& ! git diff-index
--quiet HEAD
; ); then \
753 echo
'REEBE: NOP pbagnvaf ybpny zbqvsvpngvbaf! Frg NOPERI=qrsnhyg va Lbflf Znxrsvyr!' | tr
'A-Za-z' 'N-ZA-Mn-za-m'; false
; \
755 # set a variable so the test fails if git fails to run - when comparing outputs directly, empty string would match empty string
756 $(Q
) if
! (cd abc
2> /dev
/null
&& rev
="`git rev-parse $(ABCREV)`" && test "`git rev-parse HEAD`" == "$$rev"); then \
757 test $(ABCPULL
) -ne
0 ||
{ echo
'REEBE: NOP abg hc gb qngr naq NOPCHYY frg gb 0 va Znxrsvyr!' | tr
'A-Za-z' 'N-ZA-Mn-za-m'; exit
1; }; \
758 echo
"Pulling ABC from $(ABCURL):"; set
-x
; \
759 test -d abc || git clone
$(ABCURL
) abc
; \
760 cd abc
&& $(MAKE
) DEP
= clean && git fetch
$(ABCURL
) && git checkout
$(ABCREV
); \
763 $(Q
) rm -f abc
/abc-
[0-9a-f
]*
764 $(Q
) cd abc
&& $(MAKE
) $(S
) $(ABCMKARGS
) $(if
$(filter %.a
,$@
),PROG
="abc-$(ABCREV)",PROG
="abc-$(ABCREV)$(EXE)") MSG_PREFIX
="$(eval P_OFFSET = 5)$(call P_SHOW)$(eval P_OFFSET = 10) ABC: " $(if
$(filter %.a
,$@
),libabc-
$(ABCREV
).a
)
766 ifeq ($(ABCREV
),default
)
767 .PHONY
: abc
/abc-
$(ABCREV
)$(EXE
)
768 .PHONY
: abc
/libabc-
$(ABCREV
).a
771 $(PROGRAM_PREFIX
)yosys-abc
$(EXE
): abc
/abc-
$(ABCREV
)$(EXE
)
772 $(P
) cp abc
/abc-
$(ABCREV
)$(EXE
) $(PROGRAM_PREFIX
)yosys-abc
$(EXE
)
774 $(PROGRAM_PREFIX
)yosys-libabc.a
: abc
/libabc-
$(ABCREV
).a
775 $(P
) cp abc
/libabc-
$(ABCREV
).a
$(PROGRAM_PREFIX
)yosys-libabc.a
783 ifneq ($(ABCEXTERNAL
),)
784 ABCOPT
="-A $(ABCEXTERNAL)"
789 test: $(TARGETS
) $(EXTRA_TARGETS
)
790 +cd tests
/simple
&& bash run-test.sh
$(SEEDOPT
)
791 +cd tests
/simple_abc9
&& bash run-test.sh
$(SEEDOPT
)
792 +cd tests
/hana
&& bash run-test.sh
$(SEEDOPT
)
793 +cd tests
/asicworld
&& bash run-test.sh
$(SEEDOPT
)
794 # +cd tests/realmath && bash run-test.sh $(SEEDOPT)
795 +cd tests
/share
&& bash run-test.sh
$(SEEDOPT
)
796 +cd tests
/opt_share
&& bash run-test.sh
$(SEEDOPT
)
797 +cd tests
/fsm
&& bash run-test.sh
$(SEEDOPT
)
798 +cd tests
/techmap
&& bash run-test.sh
799 +cd tests
/memories
&& bash run-test.sh
$(ABCOPT
) $(SEEDOPT
)
800 +cd tests
/bram
&& bash run-test.sh
$(SEEDOPT
)
801 +cd tests
/various
&& bash run-test.sh
802 +cd tests
/select
&& bash run-test.sh
803 +cd tests
/sat
&& bash run-test.sh
804 +cd tests
/svinterfaces
&& bash run-test.sh
$(SEEDOPT
)
805 +cd tests
/svtypes
&& bash run-test.sh
$(SEEDOPT
)
806 +cd tests
/proc
&& bash run-test.sh
807 +cd tests
/blif
&& bash run-test.sh
808 +cd tests
/opt
&& bash run-test.sh
809 +cd tests
/aiger
&& bash run-test.sh
$(ABCOPT
)
810 +cd tests
/arch
&& bash run-test.sh
811 +cd tests
/arch
/ice40
&& bash run-test.sh
$(SEEDOPT
)
812 +cd tests
/arch
/xilinx
&& bash run-test.sh
$(SEEDOPT
)
813 +cd tests
/arch
/ecp5
&& bash run-test.sh
$(SEEDOPT
)
814 +cd tests
/arch
/machxo2
&& bash run-test.sh
$(SEEDOPT
)
815 +cd tests
/arch
/efinix
&& bash run-test.sh
$(SEEDOPT
)
816 +cd tests
/arch
/anlogic
&& bash run-test.sh
$(SEEDOPT
)
817 +cd tests
/arch
/gowin
&& bash run-test.sh
$(SEEDOPT
)
818 +cd tests
/arch
/intel_alm
&& bash run-test.sh
$(SEEDOPT
)
819 +cd tests
/arch
/nexus
&& bash run-test.sh
$(SEEDOPT
)
820 +cd tests
/arch
/quicklogic
&& bash run-test.sh
$(SEEDOPT
)
821 +cd tests
/rpc
&& bash run-test.sh
822 +cd tests
/memfile
&& bash run-test.sh
823 +cd tests
/verilog
&& bash run-test.sh
825 @echo
" Passed \"make test\"."
828 VALGRIND ?
= valgrind
--error-exitcode
=1 --leak-check
=full
--show-reachable
=yes
--errors-for-leak-kinds
=all
830 vgtest
: $(TARGETS
) $(EXTRA_TARGETS
)
831 $(VALGRIND
) .
/yosys
-p
'setattr -mod -unset top; synth' $$( ls tests
/simple
/*.v | grep
-v repwhile.v
)
833 @echo
" Passed \"make vgtest\"."
836 vloghtb
: $(TARGETS
) $(EXTRA_TARGETS
)
837 +cd tests
/vloghtb
&& bash run-test.sh
839 @echo
" Passed \"make vloghtb\"."
842 ystests
: $(TARGETS
) $(EXTRA_TARGETS
)
844 git clone https
://github.com
/YosysHQ
/yosys-tests.git tests
/ystests
845 +$(MAKE
) PATH
="$$PWD:$$PATH" -C tests
/ystests
847 @echo
" Finished \"make ystests\"."
851 unit-test
: libyosys.so
852 @
$(MAKE
) -C
$(UNITESTPATH
) CXX
="$(CXX)" CPPFLAGS
="$(CPPFLAGS)" \
853 CXXFLAGS
="$(CXXFLAGS)" LDLIBS
="$(LDLIBS)" ROOTPATH
="$(CURDIR)"
856 @
$(MAKE
) -C
$(UNITESTPATH
) clean
858 install: $(TARGETS
) $(EXTRA_TARGETS
)
859 $(INSTALL_SUDO
) mkdir
-p
$(DESTDIR
)$(BINDIR
)
860 $(INSTALL_SUDO
) cp
$(filter-out libyosys.so
,$(TARGETS
)) $(DESTDIR
)$(BINDIR
)
861 ifneq ($(filter $(PROGRAM_PREFIX
)yosys
,$(TARGETS
)),)
862 $(INSTALL_SUDO
) $(STRIP
) -S
$(DESTDIR
)$(BINDIR
)/$(PROGRAM_PREFIX
)yosys
864 ifneq ($(filter $(PROGRAM_PREFIX
)yosys-abc
,$(TARGETS
)),)
865 $(INSTALL_SUDO
) $(STRIP
) $(DESTDIR
)$(BINDIR
)/$(PROGRAM_PREFIX
)yosys-abc
867 ifneq ($(filter $(PROGRAM_PREFIX
)yosys-filterlib
,$(TARGETS
)),)
868 $(INSTALL_SUDO
) $(STRIP
) $(DESTDIR
)$(BINDIR
)/$(PROGRAM_PREFIX
)yosys-filterlib
870 $(INSTALL_SUDO
) mkdir
-p
$(DESTDIR
)$(DATDIR
)
871 $(INSTALL_SUDO
) cp
-r share
/.
$(DESTDIR
)$(DATDIR
)/.
872 ifeq ($(ENABLE_LIBYOSYS
),1)
873 $(INSTALL_SUDO
) mkdir
-p
$(DESTDIR
)$(LIBDIR
)
874 $(INSTALL_SUDO
) cp libyosys.so
$(DESTDIR
)$(LIBDIR
)/
875 $(INSTALL_SUDO
) $(STRIP
) -S
$(DESTDIR
)$(LIBDIR
)/libyosys.so
876 ifeq ($(ENABLE_PYOSYS
),1)
877 $(INSTALL_SUDO
) mkdir
-p
$(DESTDIR
)$(PYTHON_DESTDIR
)/$(subst -,_
,$(PROGRAM_PREFIX
))pyosys
878 $(INSTALL_SUDO
) cp libyosys.so
$(DESTDIR
)$(PYTHON_DESTDIR
)/$(subst -,_
,$(PROGRAM_PREFIX
))pyosys
/libyosys.so
879 $(INSTALL_SUDO
) cp misc
/__init__.py
$(DESTDIR
)$(PYTHON_DESTDIR
)/$(subst -,_
,$(PROGRAM_PREFIX
))pyosys
/
884 $(INSTALL_SUDO
) rm -vf
$(addprefix $(DESTDIR
)$(BINDIR
)/,$(notdir $(TARGETS
)))
885 $(INSTALL_SUDO
) rm -rvf
$(DESTDIR
)$(DATDIR
)
886 ifeq ($(ENABLE_LIBYOSYS
),1)
887 $(INSTALL_SUDO
) rm -vf
$(DESTDIR
)$(LIBDIR
)/libyosys.so
888 ifeq ($(ENABLE_PYOSYS
),1)
889 $(INSTALL_SUDO
) rm -vf
$(DESTDIR
)$(PYTHON_DESTDIR
)/$(subst -,_
,$(PROGRAM_PREFIX
))pyosys
/libyosys.so
890 $(INSTALL_SUDO
) rm -vf
$(DESTDIR
)$(PYTHON_DESTDIR
)/$(subst -,_
,$(PROGRAM_PREFIX
))pyosys
/__init__.py
891 $(INSTALL_SUDO
) rmdir
$(DESTDIR
)$(PYTHON_DESTDIR
)/$(subst -,_
,$(PROGRAM_PREFIX
))pyosys
895 update-manual
: $(TARGETS
) $(EXTRA_TARGETS
)
896 cd manual
&& ..
/$(PROGRAM_PREFIX
)yosys
-p
'help -write-tex-command-reference-manual'
898 manual
: $(TARGETS
) $(EXTRA_TARGETS
)
899 cd manual
&& bash appnotes.sh
900 cd manual
&& bash presentation.sh
901 cd manual
&& bash manual.sh
906 if
test -d manual
; then cd manual
&& sh
clean.sh
; fi
907 rm -f
$(OBJS
) $(GENFILES
) $(TARGETS
) $(EXTRA_TARGETS
) $(EXTRA_OBJS
) $(PY_WRAP_INCLUDES
) $(PY_WRAPPER_FILE
).
cc
908 rm -f kernel
/version_
*.o kernel
/version_
*.
cc
909 rm -f libs
/*/*.d frontends
/*/*.d passes
/*/*.d backends
/*/*.d kernel
/*.d techlibs
/*/*.d
910 rm -rf tests
/asicworld
/*.out tests
/asicworld
/*.log
911 rm -rf tests
/hana
/*.out tests
/hana
/*.log
912 rm -rf tests
/simple
/*.out tests
/simple
/*.log
913 rm -rf tests
/memories
/*.out tests
/memories
/*.log tests
/memories
/*.dmp
914 rm -rf tests
/sat
/*.log tests
/techmap
/*.log tests
/various
/*.log
915 rm -rf tests
/bram
/temp tests
/fsm
/temp tests
/realmath
/temp tests
/share
/temp tests
/smv
/temp
916 rm -rf vloghtb
/Makefile vloghtb
/refdat vloghtb
/rtl vloghtb
/scripts vloghtb
/spec vloghtb
/check_yosys vloghtb
/vloghammer_tb.
tar.bz2 vloghtb
/temp vloghtb
/log_test_
*
917 rm -f tests
/svinterfaces
/*.log_stdout tests
/svinterfaces
/*.log_stderr tests
/svinterfaces
/dut_result.txt tests
/svinterfaces
/reference_result.txt tests
/svinterfaces
/a.out tests
/svinterfaces
/*_syn.v tests
/svinterfaces
/*.diff
918 rm -f tests
/tools
/cmp_tbdata
921 $(MAKE
) -C abc DEP
= clean
922 rm -f
$(PROGRAM_PREFIX
)yosys-abc
$(EXE
) $(PROGRAM_PREFIX
)yosys-libabc.a abc
/abc-
[0-9a-f
]* abc
/libabc-
[0-9a-f
]*.a
928 .
/$(PROGRAM_PREFIX
)yosys
-qp
'help; help -all'
929 rm -rf coverage.
info coverage_html
930 lcov
--capture
-d .
--no-external
-o coverage.
info
931 genhtml coverage.
info --output-directory coverage_html
934 { for file in
$(basename $(OBJS
)); do \
935 for
prefix in
cc y l
; do if
[ -f
$${file}.
$${prefix} ]; then echo
$$file.
$${prefix}; fi
; done \
936 done
; find backends frontends kernel libs passes
-type f \
( -name
'*.h' -o
-name
'*.hh' \
); } > qtcreator.files
937 { echo .
; find backends frontends kernel libs passes
-type f \
( -name
'*.h' -o
-name
'*.hh' \
) -printf
'%h\n' |
sort -u
; } > qtcreator.includes
938 touch qtcreator.config qtcreator.creator
940 vcxsrc
: $(GENFILES
) $(EXTRA_TARGETS
)
941 rm -rf yosys-win32-vcxsrc-
$(YOSYS_VER
){,.zip
}
942 set
-e
; for f in
`ls $(filter %.cc %.cpp,$(GENFILES)) $(addsuffix .cc,$(basename $(OBJS))) $(addsuffix .cpp,$(basename $(OBJS))) 2> /dev/null`; do \
943 echo
"Analyse: $$f" >&2; cpp -std
=c
++11 -MM
-I.
-D_YOSYS_
$$f; done | sed
's,.*:,,; s,//*,/,g; s,/[^/]*/\.\./,/,g; y, \\,\n\n,;' | grep
'^[^/]' |
sort -u | grep
-v kernel
/version_
> srcfiles.txt
944 bash misc
/create_vcxsrc.sh yosys-win32-vcxsrc
$(YOSYS_VER
) $(GIT_REV
)
945 echo
"namespace Yosys { extern const char *yosys_version_str; const char *yosys_version_str=\"Yosys (Version Information Unavailable)\"; }" > kernel
/version.
cc
946 zip yosys-win32-vcxsrc-
$(YOSYS_VER
)/genfiles.zip
$(GENFILES
) kernel
/version.
cc
947 zip
-r yosys-win32-vcxsrc-
$(YOSYS_VER
).zip yosys-win32-vcxsrc-
$(YOSYS_VER
)/
948 rm -f srcfiles.txt kernel
/version.
cc
951 mxebin
: $(TARGETS
) $(EXTRA_TARGETS
)
952 rm -rf yosys-win32-mxebin-
$(YOSYS_VER
){,.zip
}
953 mkdir
-p yosys-win32-mxebin-
$(YOSYS_VER
)
954 cp
-r
$(PROGRAM_PREFIX
)yosys.exe share
/ yosys-win32-mxebin-
$(YOSYS_VER
)/
955 ifeq ($(ENABLE_ABC
),1)
956 cp
-r
$(PROGRAM_PREFIX
)yosys-abc.exe abc
/lib
/x86
/pthreadVC2.dll yosys-win32-mxebin-
$(YOSYS_VER
)/
958 echo
-en
'This is Yosys $(YOSYS_VER) for Win32.\r\n' > yosys-win32-mxebin-
$(YOSYS_VER
)/readme.txt
959 echo
-en
'Documentation at http://www.clifford.at/yosys/.\r\n' >> yosys-win32-mxebin-
$(YOSYS_VER
)/readme.txt
960 zip
-r yosys-win32-mxebin-
$(YOSYS_VER
).zip yosys-win32-mxebin-
$(YOSYS_VER
)/
967 echo
'CONFIG := clang' > Makefile.conf
970 echo
'CONFIG := gcc' > Makefile.conf
972 config-gcc-static
: clean
973 echo
'CONFIG := gcc-static' > Makefile.conf
974 echo
'ENABLE_PLUGINS := 0' >> Makefile.conf
975 echo
'ENABLE_READLINE := 0' >> Makefile.conf
976 echo
'ENABLE_TCL := 0' >> Makefile.conf
978 config-gcc-4.8
: clean
979 echo
'CONFIG := gcc-4.8' > Makefile.conf
981 config-afl-gcc
: clean
982 echo
'CONFIG := afl-gcc' > Makefile.conf
985 echo
'CONFIG := emcc' > Makefile.conf
986 echo
'ENABLE_TCL := 0' >> Makefile.conf
987 echo
'ENABLE_ABC := 0' >> Makefile.conf
988 echo
'ENABLE_PLUGINS := 0' >> Makefile.conf
989 echo
'ENABLE_READLINE := 0' >> Makefile.conf
990 echo
'ENABLE_ZLIB := 0' >> Makefile.conf
993 echo
'CONFIG := wasi' > Makefile.conf
994 echo
'ENABLE_TCL := 0' >> Makefile.conf
995 echo
'ENABLE_ABC := 0' >> Makefile.conf
996 echo
'ENABLE_PLUGINS := 0' >> Makefile.conf
997 echo
'ENABLE_READLINE := 0' >> Makefile.conf
998 echo
'ENABLE_ZLIB := 0' >> Makefile.conf
1001 echo
'CONFIG := mxe' > Makefile.conf
1002 echo
'ENABLE_PLUGINS := 0' >> Makefile.conf
1004 config-msys2-32
: clean
1005 echo
'CONFIG := msys2-32' > Makefile.conf
1006 echo
'ENABLE_PLUGINS := 0' >> Makefile.conf
1007 echo
"PREFIX := $(MINGW_PREFIX)" >> Makefile.conf
1009 config-msys2-64
: clean
1010 echo
'CONFIG := msys2-64' > Makefile.conf
1011 echo
'ENABLE_PLUGINS := 0' >> Makefile.conf
1012 echo
"PREFIX := $(MINGW_PREFIX)" >> Makefile.conf
1014 config-cygwin
: clean
1015 echo
'CONFIG := cygwin' > Makefile.conf
1018 echo
'CONFIG := gcc' > Makefile.conf
1019 echo
'ENABLE_GCOV := 1' >> Makefile.conf
1020 echo
'ENABLE_DEBUG := 1' >> Makefile.conf
1023 echo
'CONFIG := gcc' > Makefile.conf
1024 echo
'ENABLE_GPROF := 1' >> Makefile.conf
1027 echo
"INSTALL_SUDO := sudo" >> Makefile.conf
1030 @echo
"$(YOSYS_VER)"
1039 -include frontends
/*/*.d
1040 -include passes
/*/*.d
1041 -include backends
/*/*.d
1043 -include techlibs
/*/*.d
1045 .PHONY
: all top-all abc
test install install-abc manual
clean mrproper qtcreator coverage vcxsrc mxebin
1046 .PHONY
: config-clean config-clang config-gcc config-gcc-static config-gcc-4.8 config-afl-gcc config-gprof config-sudo