12 # features (the more the better)
28 # other configuration flags
37 # Needed for environments that can't run executables (i.e. emscripten, wasm)
39 # Needed for environments that don't have proper thread support (i.e. emscripten, wasm--for now)
40 DISABLE_ABC_THREADS
:= 0
46 # SANITIZER = undefined
51 OS
:= $(shell uname
-s
)
55 ifneq ($(wildcard Makefile.conf
),)
59 ifeq ($(ENABLE_PYOSYS
),1)
63 BINDIR
:= $(PREFIX
)/bin
64 LIBDIR
:= $(PREFIX
)/lib
/$(PROGRAM_PREFIX
)yosys
65 DATDIR
:= $(PREFIX
)/share
/$(PROGRAM_PREFIX
)yosys
72 TARGETS
= $(PROGRAM_PREFIX
)yosys
$(EXE
) $(PROGRAM_PREFIX
)yosys-config
78 UNITESTPATH
:= tests
/unit
82 YOSYS_SRC
:= $(dir $(firstword $(MAKEFILE_LIST
)))
85 CXXFLAGS
:= $(CXXFLAGS
) -Wall
-Wextra
-ggdb
-I.
-I
"$(YOSYS_SRC)" -MD
-D_YOSYS_
-fPIC
-I
$(PREFIX
)/include
86 LDLIBS
:= $(LDLIBS
) -lstdc
++ -lm
89 PKG_CONFIG ?
= pkg-config
96 PLUGIN_LDFLAGS
+= -undefined dynamic_lookup
98 # homebrew search paths
99 ifneq ($(shell :; command
-v brew
),)
100 BREW_PREFIX
:= $(shell brew
--prefix)/opt
101 $(info $$BREW_PREFIX is
[${BREW_PREFIX}])
102 ifeq ($(ENABLE_PYOSYS
),1)
103 CXXFLAGS
+= -I
$(BREW_PREFIX
)/boost
/include/boost
104 LDFLAGS
+= -L
$(BREW_PREFIX
)/boost
/lib
106 CXXFLAGS
+= -I
$(BREW_PREFIX
)/readline
/include
107 LDFLAGS
+= -L
$(BREW_PREFIX
)/readline
/lib
108 PKG_CONFIG_PATH
:= $(BREW_PREFIX
)/libffi
/lib
/pkgconfig
:$(PKG_CONFIG_PATH
)
109 PKG_CONFIG_PATH
:= $(BREW_PREFIX
)/tcl-tk
/lib
/pkgconfig
:$(PKG_CONFIG_PATH
)
110 export PATH
:= $(BREW_PREFIX
)/bison
/bin
:$(BREW_PREFIX
)/gettext
/bin
:$(BREW_PREFIX
)/flex
/bin
:$(PATH
)
112 # macports search paths
113 else ifneq ($(shell :; command
-v port
),)
114 PORT_PREFIX
:= $(patsubst %/bin
/port
,%,$(shell :; command
-v port
))
115 CXXFLAGS
+= -I
$(PORT_PREFIX
)/include
116 LDFLAGS
+= -L
$(PORT_PREFIX
)/lib
117 PKG_CONFIG_PATH
:= $(PORT_PREFIX
)/lib
/pkgconfig
:$(PKG_CONFIG_PATH
)
118 export PATH
:= $(PORT_PREFIX
)/bin
:$(PATH
)
126 YOSYS_VER
:= 0.9+2406
127 GIT_REV
:= $(shell cd
$(YOSYS_SRC
) && git rev-parse
--short HEAD
2> /dev
/null || echo UNKNOWN
)
128 OBJS
= kernel
/version_
$(GIT_REV
).o
131 sed
-i
"/^YOSYS_VER := / s/+[0-9][0-9]*$$/+`git log --oneline 8a4c6e6.. | wc -l`/;" Makefile
133 # set 'ABCREV = default' to use abc/ as it is
135 # Note: If you do ABC development, make sure that 'abc' in this directory
136 # is just a symlink to your actual ABC working directory, as 'make mrproper'
137 # will remove the 'abc' directory and you do not want to accidentally
138 # delete your work on ABC..
141 ABCURL ?
= https
://github.com
/YosysHQ
/abc
142 ABCMKARGS
= CC
="$(CXX)" CXX
="$(CXX)" ABC_USE_LIBSTDCXX
=1
144 # set ABCEXTERNAL = <abc-command> to use an external ABC instance
145 # Note: The in-tree ABC (yosys-abc) will not be installed when ABCEXTERNAL is set.
153 ifneq ($(wildcard Makefile.conf
),)
154 # don't echo Makefile.conf contents when invoked to print source versions
155 ifeq ($(findstring echo-
,$(MAKECMDGOALS
)),)
156 $(info $(subst $$--$$,$(newline
),$(shell sed
's,^,[Makefile.conf] ,; s,$$,$$--$$,;' < Makefile.conf | tr
-d
'\n' | sed
's,\$$--\$$$$,,')))
158 include Makefile.conf
161 PYTHON_EXECUTABLE
:= $(shell if python3
-c
""; then echo
"python3"; else echo
"python"; fi
)
162 ifeq ($(ENABLE_PYOSYS
),1)
163 PYTHON_VERSION_TESTCODE
:= "import sys;t='{v[0]}.{v[1]}'.format(v=list(sys.version_info[:2]));print(t)"
164 PYTHON_VERSION
:= $(shell $(PYTHON_EXECUTABLE
) -c
""$(PYTHON_VERSION_TESTCODE
)"")
165 PYTHON_MAJOR_VERSION
:= $(shell echo
$(PYTHON_VERSION
) | cut
-f1
-d.
)
167 ENABLE_PYTHON_CONFIG_EMBED ?
= $(shell $(PYTHON_EXECUTABLE
)-config
--embed
--libs
> /dev
/null
&& echo
1)
168 ifeq ($(ENABLE_PYTHON_CONFIG_EMBED
),1)
169 PYTHON_CONFIG
:= $(PYTHON_EXECUTABLE
)-config
--embed
171 PYTHON_CONFIG
:= $(PYTHON_EXECUTABLE
)-config
174 PYTHON_PREFIX
:= $(shell $(PYTHON_CONFIG
) --prefix)
175 PYTHON_DESTDIR
:= $(PYTHON_PREFIX
)/lib
/python
$(PYTHON_VERSION
)/site-packages
177 # Reload Makefile.conf to override python specific variables if defined
178 ifneq ($(wildcard Makefile.conf
),)
179 include Makefile.conf
184 ifeq ($(CONFIG
),clang
)
187 CXXFLAGS
+= -std
=c
++11 -Os
188 ABCMKARGS
+= ARCHFLAGS
="-DABC_USE_STDINT_H"
190 ifneq ($(SANITIZER
),)
191 $(info [Clang Sanitizer
] $(SANITIZER
))
192 CXXFLAGS
+= -g
-O1
-fno-omit-frame-pointer
-fno-optimize-sibling-calls
-fsanitize
=$(SANITIZER
)
193 LDFLAGS
+= -g
-fsanitize
=$(SANITIZER
)
194 ifeq ($(SANITIZER
),address
)
197 ifeq ($(SANITIZER
),memory
)
198 CXXFLAGS
+= -fPIE
-fsanitize-memory-track-origins
199 LDFLAGS
+= -fPIE
-fsanitize-memory-track-origins
201 ifeq ($(SANITIZER
),cfi
)
207 else ifeq ($(CONFIG
),gcc
)
210 CXXFLAGS
+= -std
=c
++11 -Os
211 ABCMKARGS
+= ARCHFLAGS
="-DABC_USE_STDINT_H"
213 else ifeq ($(CONFIG
),gcc-static
)
215 LDFLAGS
:= $(filter-out -rdynamic
,$(LDFLAGS
)) -static
216 LDLIBS
:= $(filter-out -lrt
,$(LDLIBS
))
217 CXXFLAGS
:= $(filter-out -fPIC
,$(CXXFLAGS
))
218 CXXFLAGS
+= -std
=c
++11 -Os
219 ABCMKARGS
= CC
="$(CC)" CXX
="$(CXX)" LD
="$(LD)" ABC_USE_LIBSTDCXX
=1 LIBS
="-lm -lpthread -static" OPTFLAGS
="-O" \
220 ARCHFLAGS
="-DABC_USE_STDINT_H -DABC_NO_DYNAMIC_LINKING=1 -Wno-unused-but-set-variable $(ARCHFLAGS)" ABC_USE_NO_READLINE
=1
221 ifeq ($(DISABLE_ABC_THREADS
),1)
222 ABCMKARGS
+= "ABC_USE_NO_PTHREADS=1"
225 else ifeq ($(CONFIG
),gcc-4.8
)
228 CXXFLAGS
+= -std
=c
++11 -Os
229 ABCMKARGS
+= ARCHFLAGS
="-DABC_USE_STDINT_H"
231 else ifeq ($(CONFIG
),afl-gcc
)
232 CXX
= AFL_QUIET
=1 AFL_HARDEN
=1 afl-gcc
233 LD
= AFL_QUIET
=1 AFL_HARDEN
=1 afl-gcc
234 CXXFLAGS
+= -std
=c
++11 -Os
235 ABCMKARGS
+= ARCHFLAGS
="-DABC_USE_STDINT_H"
237 else ifeq ($(CONFIG
),cygwin
)
240 CXXFLAGS
+= -std
=gnu
++11 -Os
241 ABCMKARGS
+= ARCHFLAGS
="-DABC_USE_STDINT_H"
243 else ifeq ($(CONFIG
),emcc
)
246 CXXFLAGS
:= -std
=c
++11 $(filter-out -fPIC
-ggdb
,$(CXXFLAGS
))
247 ABCMKARGS
+= ARCHFLAGS
="-DABC_USE_STDINT_H -DABC_MEMALIGN=8"
248 EMCCFLAGS
:= -Os
-Wno-warn-absolute-paths
249 EMCCFLAGS
+= --memory-init-file
0 --embed-file share
-s NO_EXIT_RUNTIME
=1
250 EMCCFLAGS
+= -s EXPORTED_FUNCTIONS
="['_main','_run','_prompt','_errmsg','_memset']"
251 EMCCFLAGS
+= -s TOTAL_MEMORY
=134217728
252 EMCCFLAGS
+= -s EXTRA_EXPORTED_RUNTIME_METHODS
='["ccall", "cwrap"]'
253 # https://github.com/kripken/emscripten/blob/master/src/settings.js
254 CXXFLAGS
+= $(EMCCFLAGS
)
255 LDFLAGS
+= $(EMCCFLAGS
)
261 TARGETS
:= $(filter-out $(PROGRAM_PREFIX
)yosys-config
,$(TARGETS
))
262 EXTRA_TARGETS
+= yosysjs-
$(YOSYS_VER
).zip
264 ifeq ($(ENABLE_ABC
),1)
266 DISABLE_ABC_THREADS
:= 1
270 wget
-O viz.js.part https
://github.com
/mdaines
/viz.js
/releases
/download
/0.0.3/viz.js
271 mv viz.js.part viz.js
273 yosysjs-
$(YOSYS_VER
).zip
: yosys.js yosys.wasm viz.js misc
/yosysjs
/*
274 rm -rf yosysjs-
$(YOSYS_VER
) yosysjs-
$(YOSYS_VER
).zip
275 mkdir
-p yosysjs-
$(YOSYS_VER
)
276 cp viz.js misc
/yosysjs
/* yosys.js yosys.wasm yosysjs-
$(YOSYS_VER
)/
277 zip
-r yosysjs-
$(YOSYS_VER
).zip yosysjs-
$(YOSYS_VER
)
279 yosys.html
: misc
/yosys.html
280 $(P
) cp misc
/yosys.html yosys.html
282 else ifeq ($(CONFIG
),wasi
)
288 WASIFLAGS
:= -target wasm32-wasi
--sysroot
$(WASI_SYSROOT
) $(WASIFLAGS
)
290 CXX
= $(WASI_SDK
)/bin
/clang
291 LD
= $(WASI_SDK
)/bin
/clang
++
292 AR
= $(WASI_SDK
)/bin
/ar
293 RANLIB
= $(WASI_SDK
)/bin
/ranlib
294 WASIFLAGS
:= --sysroot
$(WASI_SDK
)/share
/wasi-sysroot
$(WASIFLAGS
)
296 CXXFLAGS
:= $(WASIFLAGS
) -std
=c
++11 -Os
$(filter-out -fPIC
,$(CXXFLAGS
))
297 LDFLAGS
:= $(WASIFLAGS
) -Wl
,-z
,stack-size
=1048576 $(filter-out -rdynamic
,$(LDFLAGS
))
298 LDLIBS
:= $(filter-out -lrt
,$(LDLIBS
))
299 ABCMKARGS
+= AR
="$(AR)" RANLIB
="$(RANLIB)"
300 ABCMKARGS
+= ARCHFLAGS
="$(WASIFLAGS) -DABC_USE_STDINT_H -DABC_NO_DYNAMIC_LINKING"
301 ABCMKARGS
+= OPTFLAGS
="-Os"
306 ifeq ($(ENABLE_ABC
),1)
308 DISABLE_ABC_THREADS
:= 1
311 else ifeq ($(CONFIG
),mxe
)
312 PKG_CONFIG
= /usr
/local
/src
/mxe
/usr
/bin
/i686-w64-mingw32.static-pkg-config
313 CXX
= /usr
/local
/src
/mxe
/usr
/bin
/i686-w64-mingw32.static-g
++
314 LD
= /usr
/local
/src
/mxe
/usr
/bin
/i686-w64-mingw32.static-g
++
315 CXXFLAGS
+= -std
=c
++11 -Os
-D_POSIX_SOURCE
-DYOSYS_MXE_HACKS
-Wno-attributes
316 CXXFLAGS
:= $(filter-out -fPIC
,$(CXXFLAGS
))
317 LDFLAGS
:= $(filter-out -rdynamic
,$(LDFLAGS
)) -s
318 LDLIBS
:= $(filter-out -lrt
,$(LDLIBS
))
319 ABCMKARGS
+= ARCHFLAGS
="-DWIN32_NO_DLL -DHAVE_STRUCT_TIMESPEC -fpermissive -w"
320 # TODO: Try to solve pthread linking issue in more appropriate way
321 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"
324 else ifeq ($(CONFIG
),msys2
)
325 CXX
= i686-w64-mingw32-g
++
326 LD
= i686-w64-mingw32-g
++
327 CXXFLAGS
+= -std
=c
++11 -Os
-D_POSIX_SOURCE
-DYOSYS_WIN32_UNIX_DIR
328 CXXFLAGS
:= $(filter-out -fPIC
,$(CXXFLAGS
))
329 LDFLAGS
:= $(filter-out -rdynamic
,$(LDFLAGS
)) -s
330 LDLIBS
:= $(filter-out -lrt
,$(LDLIBS
))
331 ABCMKARGS
+= ARCHFLAGS
="-DABC_USE_STDINT_H -DWIN32_NO_DLL -DHAVE_STRUCT_TIMESPEC -fpermissive -w"
332 ABCMKARGS
+= LIBS
="-lpthread -s" ABC_USE_NO_READLINE
=0 CC
="i686-w64-mingw32-gcc" CXX
="$(CXX)"
335 else ifeq ($(CONFIG
),msys2-64
)
336 CXX
= x86_64-w64-mingw32-g
++
337 LD
= x86_64-w64-mingw32-g
++
338 CXXFLAGS
+= -std
=c
++11 -Os
-D_POSIX_SOURCE
-DYOSYS_WIN32_UNIX_DIR
339 CXXFLAGS
:= $(filter-out -fPIC
,$(CXXFLAGS
))
340 LDFLAGS
:= $(filter-out -rdynamic
,$(LDFLAGS
)) -s
341 LDLIBS
:= $(filter-out -lrt
,$(LDLIBS
))
342 ABCMKARGS
+= ARCHFLAGS
="-DABC_USE_STDINT_H -DWIN32_NO_DLL -DHAVE_STRUCT_TIMESPEC -fpermissive -w"
343 ABCMKARGS
+= LIBS
="-lpthread -s" ABC_USE_NO_READLINE
=0 CC
="x86_64-w64-mingw32-gcc" CXX
="$(CXX)"
346 else ifneq ($(CONFIG
),none
)
347 $(error Invalid CONFIG setting
'$(CONFIG)'. Valid values
: clang
, gcc
, gcc-4.8
, emcc
, mxe
, msys2
, msys2-64
)
350 ifeq ($(ENABLE_LIBYOSYS
),1)
351 TARGETS
+= libyosys.so
354 ifeq ($(ENABLE_PYOSYS
),1)
356 #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
358 BOOST_PYTHON_LIB ?
= $(shell \
359 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 \
360 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 \
361 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 \
362 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 \
363 echo
""; fi
; fi
; fi
; fi
;)
365 BOOST_PYTHON_LIB ?
= $(shell \
366 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 \
367 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 \
368 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 \
369 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 \
370 echo
""; fi
; fi
; fi
; fi
;)
373 ifeq ($(BOOST_PYTHON_LIB
),)
374 $(error BOOST_PYTHON_LIB could not be detected. Please
define manually
)
378 ifeq ($(PYTHON_MAJOR_VERSION
),3)
379 LDLIBS
+= $(shell $(PYTHON_CONFIG
) --ldflags) $(BOOST_PYTHON_LIB
) -lboost_system
-lboost_filesystem
380 CXXFLAGS
+= $(shell $(PYTHON_CONFIG
) --includes
) -DWITH_PYTHON
382 LDLIBS
+= $(shell $(PYTHON_CONFIG
) --ldflags) $(BOOST_PYTHON_LIB
) -lboost_system
-lboost_filesystem
383 CXXFLAGS
+= $(shell $(PYTHON_CONFIG
) --includes
) -DWITH_PYTHON
386 ifeq ($(PYTHON_MAJOR_VERSION
),3)
387 LDLIBS
+= $(shell $(PYTHON_CONFIG
) --libs
) $(BOOST_PYTHON_LIB
) -lboost_system
-lboost_filesystem
388 CXXFLAGS
+= $(shell $(PYTHON_CONFIG
) --includes
) -DWITH_PYTHON
390 LDLIBS
+= $(shell $(PYTHON_CONFIG
) --libs
) $(BOOST_PYTHON_LIB
) -lboost_system
-lboost_filesystem
391 CXXFLAGS
+= $(shell $(PYTHON_CONFIG
) --includes
) -DWITH_PYTHON
395 ifeq ($(ENABLE_PYOSYS
),1)
396 PY_WRAPPER_FILE
= kernel
/python_wrappers
397 OBJS
+= $(PY_WRAPPER_FILE
).o
398 PY_GEN_SCRIPT
= py_wrap_generator
399 PY_WRAP_INCLUDES
:= $(shell python
$(PYTHON_VERSION
) -c
"from misc import $(PY_GEN_SCRIPT); $(PY_GEN_SCRIPT).print_includes()")
403 ifeq ($(ENABLE_READLINE
),1)
404 CXXFLAGS
+= -DYOSYS_ENABLE_READLINE
405 ifeq ($(OS
), FreeBSD
)
406 CXXFLAGS
+= -I
/usr
/local
/include
409 ifeq ($(LINK_CURSES
),1)
411 ABCMKARGS
+= "ABC_READLINE_LIBRARIES=-lcurses -lreadline"
413 ifeq ($(LINK_TERMCAP
),1)
415 ABCMKARGS
+= "ABC_READLINE_LIBRARIES=-lreadline -ltermcap"
421 ifeq ($(ENABLE_EDITLINE
),1)
422 CXXFLAGS
+= -DYOSYS_ENABLE_EDITLINE
423 LDLIBS
+= -ledit
-ltinfo
-lbsd
425 ABCMKARGS
+= "ABC_USE_NO_READLINE=1"
429 ifeq ($(DISABLE_ABC_THREADS
),1)
430 ABCMKARGS
+= "ABC_USE_NO_PTHREADS=1"
433 ifeq ($(DISABLE_SPAWN
),1)
434 CXXFLAGS
+= -DYOSYS_DISABLE_SPAWN
437 ifeq ($(ENABLE_PLUGINS
),1)
438 CXXFLAGS
+= $(shell PKG_CONFIG_PATH
=$(PKG_CONFIG_PATH
) $(PKG_CONFIG
) --silence-errors
--cflags libffi
) -DYOSYS_ENABLE_PLUGINS
439 LDLIBS
+= $(shell PKG_CONFIG_PATH
=$(PKG_CONFIG_PATH
) $(PKG_CONFIG
) --silence-errors
--libs libffi || echo
-lffi
)
440 ifneq ($(OS
), FreeBSD
)
445 ifeq ($(ENABLE_GLOB
),1)
446 CXXFLAGS
+= -DYOSYS_ENABLE_GLOB
449 ifeq ($(ENABLE_ZLIB
),1)
450 CXXFLAGS
+= -DYOSYS_ENABLE_ZLIB
455 ifeq ($(ENABLE_TCL
),1)
456 TCL_VERSION ?
= tcl
$(shell bash
-c
"tclsh <(echo 'puts [info tclversion]')")
457 ifeq ($(OS
), FreeBSD
)
458 TCL_INCLUDE ?
= /usr
/local
/include/$(TCL_VERSION
)
460 TCL_INCLUDE ?
= /usr
/include/$(TCL_VERSION
)
464 CXXFLAGS
+= -DYOSYS_ENABLE_TCL
465 LDLIBS
+= -ltcl86
-lwsock32
-lws2_32
-lnetapi32
-lz
-luserenv
467 CXXFLAGS
+= $(shell PKG_CONFIG_PATH
=$(PKG_CONFIG_PATH
) $(PKG_CONFIG
) --silence-errors
--cflags tcl || echo
-I
$(TCL_INCLUDE
)) -DYOSYS_ENABLE_TCL
468 ifeq ($(OS
), FreeBSD
)
469 # FreeBSD uses tcl8.6, but lib is named "libtcl86"
470 LDLIBS
+= $(shell PKG_CONFIG_PATH
=$(PKG_CONFIG_PATH
) $(PKG_CONFIG
) --silence-errors
--libs tcl || echo
-l
$(TCL_VERSION
) | tr
-d
'.')
472 LDLIBS
+= $(shell PKG_CONFIG_PATH
=$(PKG_CONFIG_PATH
) $(PKG_CONFIG
) --silence-errors
--libs tcl || echo
-l
$(TCL_VERSION
))
477 ifeq ($(ENABLE_GCOV
),1)
478 CXXFLAGS
+= --coverage
479 LDFLAGS
+= --coverage
482 ifeq ($(ENABLE_GPROF
),1)
487 ifeq ($(ENABLE_NDEBUG
),1)
488 CXXFLAGS
:= -O3
-DNDEBUG
$(filter-out -Os
-ggdb
,$(CXXFLAGS
))
491 ifeq ($(ENABLE_DEBUG
),1)
492 ifeq ($(CONFIG
),clang
)
493 CXXFLAGS
:= -O0
-DDEBUG
$(filter-out -Os
,$(CXXFLAGS
))
495 CXXFLAGS
:= -Og
-DDEBUG
$(filter-out -Os
,$(CXXFLAGS
))
499 ifeq ($(ENABLE_ABC
),1)
500 CXXFLAGS
+= -DYOSYS_ENABLE_ABC
502 CXXFLAGS
+= -DYOSYS_LINK_ABC
503 ifeq ($(DISABLE_ABC_THREADS
),0)
507 ifeq ($(ABCEXTERNAL
),)
508 TARGETS
+= $(PROGRAM_PREFIX
)yosys-abc
$(EXE
)
513 ifeq ($(ENABLE_VERIFIC
),1)
514 VERIFIC_DIR ?
= /usr
/local
/src
/verific_lib
515 VERIFIC_COMPONENTS ?
= verilog vhdl database util containers hier_tree
516 CXXFLAGS
+= $(patsubst %,-I
$(VERIFIC_DIR
)/%,$(VERIFIC_COMPONENTS
)) -DYOSYS_ENABLE_VERIFIC
518 LDLIBS
+= $(patsubst %,$(VERIFIC_DIR
)/%/*-mac.a
,$(VERIFIC_COMPONENTS
)) -lz
520 LDLIBS
+= $(patsubst %,$(VERIFIC_DIR
)/%/*-linux.a
,$(VERIFIC_COMPONENTS
)) -lz
524 ifeq ($(ENABLE_PROTOBUF
),1)
525 LDLIBS
+= $(shell pkg-config
--cflags --libs protobuf
)
528 ifeq ($(ENABLE_COVER
),1)
529 CXXFLAGS
+= -DYOSYS_ENABLE_COVER
532 ifeq ($(ENABLE_CCACHE
),1)
536 define add_share_file
537 EXTRA_TARGETS
+= $(subst //,/,$(1)/$(notdir $(2)))
538 $(subst //,/,$(1)/$(notdir $(2))): $(2)
540 $$(Q
) cp
"$(YOSYS_SRC)"/$(2) $(subst //,/,$(1)/$(notdir $(2)))
543 define add_gen_share_file
544 EXTRA_TARGETS
+= $(subst //,/,$(1)/$(notdir $(2)))
545 $(subst //,/,$(1)/$(notdir $(2))): $(2)
547 $$(Q
) cp
$(2) $(subst //,/,$(1)/$(notdir $(2)))
550 define add_include_file
551 $(eval
$(call add_share_file
,$(dir share
/include/$(1)),$(1)))
554 define add_extra_objs
562 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; }'))
563 P_SHOW
= [$(shell $(AWK
) "BEGIN { N=$(words $(OBJS) $(PROGRAM_PREFIX)yosys$(EXE)); printf \"%3d\", $(P_OFFSET)+90*$(P_STATUS)/N; exit; }")%]
564 P
= @echo
"$(if $(findstring $@,$(TARGETS) $(EXTRA_TARGETS)),$(eval P_OFFSET = 10))$(call P_UPDATE)$(call P_SHOW) Building $@";
574 $(eval
$(call add_include_file
,kernel
/yosys.h
))
575 $(eval
$(call add_include_file
,kernel
/hashlib.h
))
576 $(eval
$(call add_include_file
,kernel
/log.h
))
577 $(eval
$(call add_include_file
,kernel
/rtlil.h
))
578 $(eval
$(call add_include_file
,kernel
/register.h
))
579 $(eval
$(call add_include_file
,kernel
/celltypes.h
))
580 $(eval
$(call add_include_file
,kernel
/celledges.h
))
581 $(eval
$(call add_include_file
,kernel
/consteval.h
))
582 $(eval
$(call add_include_file
,kernel
/constids.inc
))
583 $(eval
$(call add_include_file
,kernel
/sigtools.h
))
584 $(eval
$(call add_include_file
,kernel
/modtools.h
))
585 $(eval
$(call add_include_file
,kernel
/macc.h
))
586 $(eval
$(call add_include_file
,kernel
/utils.h
))
587 $(eval
$(call add_include_file
,kernel
/satgen.h
))
588 $(eval
$(call add_include_file
,libs
/ezsat
/ezsat.h
))
589 $(eval
$(call add_include_file
,libs
/ezsat
/ezminisat.h
))
590 $(eval
$(call add_include_file
,libs
/sha1
/sha1.h
))
591 $(eval
$(call add_include_file
,libs
/json11
/json11.hpp
))
592 $(eval
$(call add_include_file
,passes
/fsm
/fsmdata.h
))
593 $(eval
$(call add_include_file
,frontends
/ast
/ast.h
))
594 $(eval
$(call add_include_file
,backends
/ilang
/ilang_backend.h
))
595 $(eval
$(call add_include_file
,backends
/cxxrtl
/cxxrtl.h
))
596 $(eval
$(call add_include_file
,backends
/cxxrtl
/cxxrtl_vcd.h
))
597 $(eval
$(call add_include_file
,backends
/cxxrtl
/cxxrtl_capi.
cc))
598 $(eval
$(call add_include_file
,backends
/cxxrtl
/cxxrtl_capi.h
))
599 $(eval
$(call add_include_file
,backends
/cxxrtl
/cxxrtl_vcd_capi.
cc))
600 $(eval
$(call add_include_file
,backends
/cxxrtl
/cxxrtl_vcd_capi.h
))
602 OBJS
+= kernel
/driver.o kernel
/register.o kernel
/rtlil.o kernel
/log.o kernel
/calc.o kernel
/yosys.o
603 OBJS
+= kernel
/cellaigs.o kernel
/celledges.o kernel
/satgen.o
605 kernel
/log.o
: CXXFLAGS
+= -DYOSYS_SRC
='"$(YOSYS_SRC)"'
606 kernel
/yosys.o
: CXXFLAGS
+= -DYOSYS_DATDIR
='"$(DATDIR)"' -DYOSYS_PROGRAM_PREFIX
='"$(PROGRAM_PREFIX)"'
608 OBJS
+= libs
/bigint
/BigIntegerAlgorithms.o libs
/bigint
/BigInteger.o libs
/bigint
/BigIntegerUtils.o
609 OBJS
+= libs
/bigint
/BigUnsigned.o libs
/bigint
/BigUnsignedInABase.o
611 OBJS
+= libs
/sha1
/sha1.o
615 OBJS
+= libs
/json11
/json11.o
617 OBJS
+= libs
/subcircuit
/subcircuit.o
619 OBJS
+= libs
/ezsat
/ezsat.o
620 OBJS
+= libs
/ezsat
/ezminisat.o
622 OBJS
+= libs
/minisat
/Options.o
623 OBJS
+= libs
/minisat
/SimpSolver.o
624 OBJS
+= libs
/minisat
/Solver.o
625 OBJS
+= libs
/minisat
/System.o
627 include $(YOSYS_SRC
)/frontends
/*/Makefile.inc
628 include $(YOSYS_SRC
)/passes
/*/Makefile.inc
629 include $(YOSYS_SRC
)/backends
/*/Makefile.inc
630 include $(YOSYS_SRC
)/techlibs
/*/Makefile.inc
634 include $(YOSYS_SRC
)/frontends
/verilog
/Makefile.inc
635 include $(YOSYS_SRC
)/frontends
/ilang
/Makefile.inc
636 include $(YOSYS_SRC
)/frontends
/ast
/Makefile.inc
637 include $(YOSYS_SRC
)/frontends
/blif
/Makefile.inc
639 OBJS
+= passes
/hierarchy
/hierarchy.o
640 OBJS
+= passes
/cmds
/select.o
641 OBJS
+= passes
/cmds
/show.o
642 OBJS
+= passes
/cmds
/stat.o
643 OBJS
+= passes
/cmds
/cover.o
644 OBJS
+= passes
/cmds
/design.o
645 OBJS
+= passes
/cmds
/plugin.o
647 include $(YOSYS_SRC
)/passes
/proc
/Makefile.inc
648 include $(YOSYS_SRC
)/passes
/opt
/Makefile.inc
649 include $(YOSYS_SRC
)/passes
/techmap
/Makefile.inc
651 include $(YOSYS_SRC
)/backends
/verilog
/Makefile.inc
652 include $(YOSYS_SRC
)/backends
/ilang
/Makefile.inc
654 include $(YOSYS_SRC
)/techlibs
/common
/Makefile.inc
659 OBJS
+= $(PROGRAM_PREFIX
)yosys-libabc.a
662 top-all
: $(TARGETS
) $(EXTRA_TARGETS
)
664 @echo
" Build successful."
667 ifeq ($(CONFIG
),emcc
)
668 yosys.js
: $(filter-out yosysjs-
$(YOSYS_VER
).zip
,$(EXTRA_TARGETS
))
671 $(PROGRAM_PREFIX
)yosys
$(EXE
): $(OBJS
)
672 $(P
) $(LD
) -o
$(PROGRAM_PREFIX
)yosys
$(EXE
) $(LDFLAGS
) $(OBJS
) $(LDLIBS
)
674 libyosys.so
: $(filter-out kernel
/driver.o
,$(OBJS
))
676 $(P
) $(LD
) -o libyosys.so
-shared
-Wl
,-install_name
,$(DESTDIR
)$(LIBDIR
)/libyosys.so
$(LDFLAGS
) $^
$(LDLIBS
)
678 $(P
) $(LD
) -o libyosys.so
-shared
-Wl
,-soname
,$(DESTDIR
)$(LIBDIR
)/libyosys.so
$(LDFLAGS
) $^
$(LDLIBS
)
682 $(Q
) mkdir
-p
$(dir $@
)
683 $(P
) $(CXX
) -o
$@
-c
$(CPPFLAGS
) $(CXXFLAGS
) $<
686 $(Q
) mkdir
-p
$(dir $@
)
687 $(P
) cat
$< | grep
-E
-v
"#[ ]*(include|error)" |
$(LD
) -x c
++ -o
$@
-E
-P
-
689 ifeq ($(ENABLE_PYOSYS
),1)
690 $(PY_WRAPPER_FILE
).
cc: misc
/$(PY_GEN_SCRIPT
).py
$(PY_WRAP_INCLUDES
)
691 $(Q
) mkdir
-p
$(dir $@
)
692 $(P
) python
$(PYTHON_VERSION
) -c
"from misc import $(PY_GEN_SCRIPT); $(PY_GEN_SCRIPT).gen_wrappers(\"$(PY_WRAPPER_FILE).cc\")"
696 $(Q
) mkdir
-p
$(dir $@
)
697 $(P
) $(CXX
) -o
$@
-c
$(CPPFLAGS
) $(CXXFLAGS
) $<
699 YOSYS_VER_STR
:= Yosys
$(YOSYS_VER
) (git sha1
$(GIT_REV
), $(notdir $(CXX
)) $(shell \
700 $(CXX
) --version | tr
' ()' '\n' | grep
'^[0-9]' | head
-n1
) $(filter -f
% -m
% -O
% -DNDEBUG
,$(CXXFLAGS
)))
702 kernel
/version_
$(GIT_REV
).
cc: $(YOSYS_SRC
)/Makefile
703 $(P
) rm -f kernel
/version_
*.o kernel
/version_
*.d kernel
/version_
*.
cc
704 $(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
706 ifeq ($(ENABLE_VERIFIC
),1)
707 CXXFLAGS_NOVERIFIC
= $(foreach v
,$(CXXFLAGS
),$(if
$(findstring $(VERIFIC_DIR
),$(v
)),,$(v
)))
708 LDLIBS_NOVERIFIC
= $(foreach v
,$(LDLIBS
),$(if
$(findstring $(VERIFIC_DIR
),$(v
)),,$(v
)))
710 CXXFLAGS_NOVERIFIC
= $(CXXFLAGS
)
711 LDLIBS_NOVERIFIC
= $(LDLIBS
)
714 $(PROGRAM_PREFIX
)yosys-config
: misc
/yosys-config.in
715 $(P
) $(SED
) -e
's#@CXXFLAGS@#$(subst -I. -I"$(YOSYS_SRC)",-I"$(DATDIR)/include",$(strip $(CXXFLAGS_NOVERIFIC)))#;' \
716 -e
's#@CXX@#$(strip $(CXX))#;' -e
's#@LDFLAGS@#$(strip $(LDFLAGS) $(PLUGIN_LDFLAGS))#;' -e
's#@LDLIBS@#$(strip $(LDLIBS_NOVERIFIC))#;' \
717 -e
's#@BINDIR@#$(strip $(BINDIR))#;' -e
's#@DATDIR@#$(strip $(DATDIR))#;' < $< > $(PROGRAM_PREFIX
)yosys-config
718 $(Q
) chmod
+x
$(PROGRAM_PREFIX
)yosys-config
720 abc
/abc-
$(ABCREV
)$(EXE
) abc
/libabc-
$(ABCREV
).a
:
722 ifneq ($(ABCREV
),default
)
723 $(Q
) if
test -d abc
/.hg
; then \
724 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
; \
726 $(Q
) if
( cd abc
2> /dev
/null
&& ! git diff-index
--quiet HEAD
; ); then \
727 echo
'REEBE: NOP pbagnvaf ybpny zbqvsvpngvbaf! Frg NOPERI=qrsnhyg va Lbflf Znxrsvyr!' | tr
'A-Za-z' 'N-ZA-Mn-za-m'; false
; \
729 # set a variable so the test fails if git fails to run - when comparing outputs directly, empty string would match empty string
730 $(Q
) if
! (cd abc
2> /dev
/null
&& rev
="`git rev-parse $(ABCREV)`" && test "`git rev-parse HEAD`" == "$$rev"); then \
731 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; }; \
732 echo
"Pulling ABC from $(ABCURL):"; set
-x
; \
733 test -d abc || git clone
$(ABCURL
) abc
; \
734 cd abc
&& $(MAKE
) DEP
= clean && git fetch
$(ABCURL
) && git checkout
$(ABCREV
); \
737 $(Q
) rm -f abc
/abc-
[0-9a-f
]*
738 $(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
)
740 ifeq ($(ABCREV
),default
)
741 .PHONY
: abc
/abc-
$(ABCREV
)$(EXE
)
742 .PHONY
: abc
/libabc-
$(ABCREV
).a
745 $(PROGRAM_PREFIX
)yosys-abc
$(EXE
): abc
/abc-
$(ABCREV
)$(EXE
)
746 $(P
) cp abc
/abc-
$(ABCREV
)$(EXE
) $(PROGRAM_PREFIX
)yosys-abc
$(EXE
)
748 $(PROGRAM_PREFIX
)yosys-libabc.a
: abc
/libabc-
$(ABCREV
).a
749 $(P
) cp abc
/libabc-
$(ABCREV
).a
$(PROGRAM_PREFIX
)yosys-libabc.a
757 ifneq ($(ABCEXTERNAL
),)
758 ABCOPT
="-A $(ABCEXTERNAL)"
763 test: $(TARGETS
) $(EXTRA_TARGETS
)
764 +cd tests
/simple
&& bash run-test.sh
$(SEEDOPT
)
765 +cd tests
/simple_abc9
&& bash run-test.sh
$(SEEDOPT
)
766 +cd tests
/hana
&& bash run-test.sh
$(SEEDOPT
)
767 +cd tests
/asicworld
&& bash run-test.sh
$(SEEDOPT
)
768 # +cd tests/realmath && bash run-test.sh $(SEEDOPT)
769 +cd tests
/share
&& bash run-test.sh
$(SEEDOPT
)
770 +cd tests
/opt_share
&& bash run-test.sh
$(SEEDOPT
)
771 +cd tests
/fsm
&& bash run-test.sh
$(SEEDOPT
)
772 +cd tests
/techmap
&& bash run-test.sh
773 +cd tests
/memories
&& bash run-test.sh
$(ABCOPT
) $(SEEDOPT
)
774 +cd tests
/bram
&& bash run-test.sh
$(SEEDOPT
)
775 +cd tests
/various
&& bash run-test.sh
776 +cd tests
/select
&& bash run-test.sh
777 +cd tests
/sat
&& bash run-test.sh
778 +cd tests
/svinterfaces
&& bash run-test.sh
$(SEEDOPT
)
779 +cd tests
/svtypes
&& bash run-test.sh
$(SEEDOPT
)
780 +cd tests
/proc
&& bash run-test.sh
781 +cd tests
/opt
&& bash run-test.sh
782 +cd tests
/aiger
&& bash run-test.sh
$(ABCOPT
)
783 +cd tests
/arch
&& bash run-test.sh
784 +cd tests
/arch
/ice40
&& bash run-test.sh
$(SEEDOPT
)
785 +cd tests
/arch
/xilinx
&& bash run-test.sh
$(SEEDOPT
)
786 +cd tests
/arch
/ecp5
&& bash run-test.sh
$(SEEDOPT
)
787 +cd tests
/arch
/efinix
&& bash run-test.sh
$(SEEDOPT
)
788 +cd tests
/arch
/anlogic
&& bash run-test.sh
$(SEEDOPT
)
789 +cd tests
/arch
/gowin
&& bash run-test.sh
$(SEEDOPT
)
790 +cd tests
/arch
/intel_alm
&& bash run-test.sh
$(SEEDOPT
)
791 +cd tests
/rpc
&& bash run-test.sh
792 +cd tests
/memfile
&& bash run-test.sh
793 +cd tests
/verilog
&& bash run-test.sh
795 @echo
" Passed \"make test\"."
798 VALGRIND ?
= valgrind
--error-exitcode
=1 --leak-check
=full
--show-reachable
=yes
--errors-for-leak-kinds
=all
800 vgtest
: $(TARGETS
) $(EXTRA_TARGETS
)
801 $(VALGRIND
) .
/yosys
-p
'setattr -mod -unset top; synth' $$( ls tests
/simple
/*.v | grep
-v repwhile.v
)
803 @echo
" Passed \"make vgtest\"."
806 vloghtb
: $(TARGETS
) $(EXTRA_TARGETS
)
807 +cd tests
/vloghtb
&& bash run-test.sh
809 @echo
" Passed \"make vloghtb\"."
812 ystests
: $(TARGETS
) $(EXTRA_TARGETS
)
814 git clone https
://github.com
/YosysHQ
/yosys-tests.git tests
/ystests
815 +$(MAKE
) PATH
="$$PWD:$$PATH" -C tests
/ystests
817 @echo
" Finished \"make ystests\"."
821 unit-test
: libyosys.so
822 @
$(MAKE
) -C
$(UNITESTPATH
) CXX
="$(CXX)" CPPFLAGS
="$(CPPFLAGS)" \
823 CXXFLAGS
="$(CXXFLAGS)" LDLIBS
="$(LDLIBS)" ROOTPATH
="$(CURDIR)"
826 @
$(MAKE
) -C
$(UNITESTPATH
) clean
828 install: $(TARGETS
) $(EXTRA_TARGETS
)
829 $(INSTALL_SUDO
) mkdir
-p
$(DESTDIR
)$(BINDIR
)
830 $(INSTALL_SUDO
) cp
$(filter-out libyosys.so
,$(TARGETS
)) $(DESTDIR
)$(BINDIR
)
831 ifneq ($(filter $(PROGRAM_PREFIX
)yosys
,$(TARGETS
)),)
832 $(INSTALL_SUDO
) $(STRIP
) -S
$(DESTDIR
)$(BINDIR
)/$(PROGRAM_PREFIX
)yosys
834 ifneq ($(filter $(PROGRAM_PREFIX
)yosys-abc
,$(TARGETS
)),)
835 $(INSTALL_SUDO
) $(STRIP
) $(DESTDIR
)$(BINDIR
)/$(PROGRAM_PREFIX
)yosys-abc
837 ifneq ($(filter $(PROGRAM_PREFIX
)yosys-filterlib
,$(TARGETS
)),)
838 $(INSTALL_SUDO
) $(STRIP
) $(DESTDIR
)$(BINDIR
)/$(PROGRAM_PREFIX
)yosys-filterlib
840 $(INSTALL_SUDO
) mkdir
-p
$(DESTDIR
)$(DATDIR
)
841 $(INSTALL_SUDO
) cp
-r share
/.
$(DESTDIR
)$(DATDIR
)/.
842 ifeq ($(ENABLE_LIBYOSYS
),1)
843 $(INSTALL_SUDO
) mkdir
-p
$(DESTDIR
)$(LIBDIR
)
844 $(INSTALL_SUDO
) cp libyosys.so
$(DESTDIR
)$(LIBDIR
)/
845 $(INSTALL_SUDO
) $(STRIP
) -S
$(DESTDIR
)$(LIBDIR
)/libyosys.so
846 ifeq ($(ENABLE_PYOSYS
),1)
847 $(INSTALL_SUDO
) mkdir
-p
$(PYTHON_DESTDIR
)/$(subst -,_
,$(PROGRAM_PREFIX
))pyosys
848 $(INSTALL_SUDO
) cp libyosys.so
$(PYTHON_DESTDIR
)/$(subst -,_
,$(PROGRAM_PREFIX
))pyosys
/libyosys.so
849 $(INSTALL_SUDO
) cp misc
/__init__.py
$(PYTHON_DESTDIR
)/$(subst -,_
,$(PROGRAM_PREFIX
))pyosys
/
854 $(INSTALL_SUDO
) rm -vf
$(addprefix $(DESTDIR
)$(BINDIR
)/,$(notdir $(TARGETS
)))
855 $(INSTALL_SUDO
) rm -rvf
$(DESTDIR
)$(DATDIR
)
856 ifeq ($(ENABLE_LIBYOSYS
),1)
857 $(INSTALL_SUDO
) rm -vf
$(DESTDIR
)$(LIBDIR
)/libyosys.so
858 ifeq ($(ENABLE_PYOSYS
),1)
859 $(INSTALL_SUDO
) rm -vf
$(PYTHON_DESTDIR
)/$(subst -,_
,$(PROGRAM_PREFIX
))pyosys
/libyosys.so
860 $(INSTALL_SUDO
) rm -vf
$(PYTHON_DESTDIR
)/$(subst -,_
,$(PROGRAM_PREFIX
))pyosys
/__init__.py
861 $(INSTALL_SUDO
) rmdir
$(PYTHON_DESTDIR
)/$(subst -,_
,$(PROGRAM_PREFIX
))pyosys
865 update-manual
: $(TARGETS
) $(EXTRA_TARGETS
)
866 cd manual
&& ..
/$(PROGRAM_PREFIX
)yosys
-p
'help -write-tex-command-reference-manual'
868 manual
: $(TARGETS
) $(EXTRA_TARGETS
)
869 cd manual
&& bash appnotes.sh
870 cd manual
&& bash presentation.sh
871 cd manual
&& bash manual.sh
876 if
test -d manual
; then cd manual
&& sh
clean.sh
; fi
877 rm -f
$(OBJS
) $(GENFILES
) $(TARGETS
) $(EXTRA_TARGETS
) $(EXTRA_OBJS
) $(PY_WRAP_INCLUDES
) $(PY_WRAPPER_FILE
).
cc
878 rm -f kernel
/version_
*.o kernel
/version_
*.
cc
879 rm -f libs
/*/*.d frontends
/*/*.d passes
/*/*.d backends
/*/*.d kernel
/*.d techlibs
/*/*.d
880 rm -rf tests
/asicworld
/*.out tests
/asicworld
/*.log
881 rm -rf tests
/hana
/*.out tests
/hana
/*.log
882 rm -rf tests
/simple
/*.out tests
/simple
/*.log
883 rm -rf tests
/memories
/*.out tests
/memories
/*.log tests
/memories
/*.dmp
884 rm -rf tests
/sat
/*.log tests
/techmap
/*.log tests
/various
/*.log
885 rm -rf tests
/bram
/temp tests
/fsm
/temp tests
/realmath
/temp tests
/share
/temp tests
/smv
/temp
886 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_
*
887 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
888 rm -f tests
/tools
/cmp_tbdata
891 $(MAKE
) -C abc DEP
= clean
892 rm -f
$(PROGRAM_PREFIX
)yosys-abc
$(EXE
) $(PROGRAM_PREFIX
)yosys-libabc.a abc
/abc-
[0-9a-f
]* abc
/libabc-
[0-9a-f
]*.a
898 .
/$(PROGRAM_PREFIX
)yosys
-qp
'help; help -all'
899 rm -rf coverage.
info coverage_html
900 lcov
--capture
-d .
--no-external
-o coverage.
info
901 genhtml coverage.
info --output-directory coverage_html
904 { for file in
$(basename $(OBJS
)); do \
905 for
prefix in
cc y l
; do if
[ -f
$${file}.
$${prefix} ]; then echo
$$file.
$${prefix}; fi
; done \
906 done
; find backends frontends kernel libs passes
-type f \
( -name
'*.h' -o
-name
'*.hh' \
); } > qtcreator.files
907 { echo .
; find backends frontends kernel libs passes
-type f \
( -name
'*.h' -o
-name
'*.hh' \
) -printf
'%h\n' |
sort -u
; } > qtcreator.includes
908 touch qtcreator.config qtcreator.creator
910 vcxsrc
: $(GENFILES
) $(EXTRA_TARGETS
)
911 rm -rf yosys-win32-vcxsrc-
$(YOSYS_VER
){,.zip
}
912 set
-e
; for f in
`ls $(filter %.cc %.cpp,$(GENFILES)) $(addsuffix .cc,$(basename $(OBJS))) $(addsuffix .cpp,$(basename $(OBJS))) 2> /dev/null`; do \
913 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
914 bash misc
/create_vcxsrc.sh yosys-win32-vcxsrc
$(YOSYS_VER
) $(GIT_REV
)
915 echo
"namespace Yosys { extern const char *yosys_version_str; const char *yosys_version_str=\"Yosys (Version Information Unavailable)\"; }" > kernel
/version.
cc
916 zip yosys-win32-vcxsrc-
$(YOSYS_VER
)/genfiles.zip
$(GENFILES
) kernel
/version.
cc
917 zip
-r yosys-win32-vcxsrc-
$(YOSYS_VER
).zip yosys-win32-vcxsrc-
$(YOSYS_VER
)/
918 rm -f srcfiles.txt kernel
/version.
cc
921 mxebin
: $(TARGETS
) $(EXTRA_TARGETS
)
922 rm -rf yosys-win32-mxebin-
$(YOSYS_VER
){,.zip
}
923 mkdir
-p yosys-win32-mxebin-
$(YOSYS_VER
)
924 cp
-r
$(PROGRAM_PREFIX
)yosys.exe share
/ yosys-win32-mxebin-
$(YOSYS_VER
)/
925 ifeq ($(ENABLE_ABC
),1)
926 cp
-r
$(PROGRAM_PREFIX
)yosys-abc.exe abc
/lib
/x86
/pthreadVC2.dll yosys-win32-mxebin-
$(YOSYS_VER
)/
928 echo
-en
'This is Yosys $(YOSYS_VER) for Win32.\r\n' > yosys-win32-mxebin-
$(YOSYS_VER
)/readme.txt
929 echo
-en
'Documentation at http://www.clifford.at/yosys/.\r\n' >> yosys-win32-mxebin-
$(YOSYS_VER
)/readme.txt
930 zip
-r yosys-win32-mxebin-
$(YOSYS_VER
).zip yosys-win32-mxebin-
$(YOSYS_VER
)/
937 echo
'CONFIG := clang' > Makefile.conf
940 echo
'CONFIG := gcc' > Makefile.conf
942 config-gcc-static
: clean
943 echo
'CONFIG := gcc-static' > Makefile.conf
944 echo
'ENABLE_PLUGINS := 0' >> Makefile.conf
945 echo
'ENABLE_READLINE := 0' >> Makefile.conf
946 echo
'ENABLE_TCL := 0' >> Makefile.conf
948 config-gcc-4.8
: clean
949 echo
'CONFIG := gcc-4.8' > Makefile.conf
951 config-afl-gcc
: clean
952 echo
'CONFIG := afl-gcc' > Makefile.conf
955 echo
'CONFIG := emcc' > Makefile.conf
956 echo
'ENABLE_TCL := 0' >> Makefile.conf
957 echo
'ENABLE_ABC := 0' >> Makefile.conf
958 echo
'ENABLE_PLUGINS := 0' >> Makefile.conf
959 echo
'ENABLE_READLINE := 0' >> Makefile.conf
960 echo
'ENABLE_ZLIB := 0' >> Makefile.conf
963 echo
'CONFIG := wasi' > Makefile.conf
964 echo
'ENABLE_TCL := 0' >> Makefile.conf
965 echo
'ENABLE_ABC := 0' >> Makefile.conf
966 echo
'ENABLE_PLUGINS := 0' >> Makefile.conf
967 echo
'ENABLE_READLINE := 0' >> Makefile.conf
968 echo
'ENABLE_ZLIB := 0' >> Makefile.conf
971 echo
'CONFIG := mxe' > Makefile.conf
972 echo
'ENABLE_PLUGINS := 0' >> Makefile.conf
975 echo
'CONFIG := msys2' > Makefile.conf
976 echo
'ENABLE_PLUGINS := 0' >> Makefile.conf
978 config-msys2-64
: clean
979 echo
'CONFIG := msys2-64' > Makefile.conf
980 echo
'ENABLE_PLUGINS := 0' >> Makefile.conf
983 echo
'CONFIG := cygwin' > Makefile.conf
986 echo
'CONFIG := gcc' > Makefile.conf
987 echo
'ENABLE_GCOV := 1' >> Makefile.conf
988 echo
'ENABLE_DEBUG := 1' >> Makefile.conf
991 echo
'CONFIG := gcc' > Makefile.conf
992 echo
'ENABLE_GPROF := 1' >> Makefile.conf
995 echo
"INSTALL_SUDO := sudo" >> Makefile.conf
1007 -include frontends
/*/*.d
1008 -include passes
/*/*.d
1009 -include backends
/*/*.d
1011 -include techlibs
/*/*.d
1013 .PHONY
: all top-all abc
test install install-abc manual
clean mrproper qtcreator coverage vcxsrc mxebin
1014 .PHONY
: config-clean config-clang config-gcc config-gcc-static config-gcc-4.8 config-afl-gcc config-gprof config-sudo