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+3475
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
,kernel
/ff.h
))
589 $(eval
$(call add_include_file
,kernel
/ffinit.h
))
590 $(eval
$(call add_include_file
,libs
/ezsat
/ezsat.h
))
591 $(eval
$(call add_include_file
,libs
/ezsat
/ezminisat.h
))
592 $(eval
$(call add_include_file
,libs
/sha1
/sha1.h
))
593 $(eval
$(call add_include_file
,libs
/json11
/json11.hpp
))
594 $(eval
$(call add_include_file
,passes
/fsm
/fsmdata.h
))
595 $(eval
$(call add_include_file
,frontends
/ast
/ast.h
))
596 $(eval
$(call add_include_file
,backends
/ilang
/ilang_backend.h
))
597 $(eval
$(call add_include_file
,backends
/cxxrtl
/cxxrtl.h
))
598 $(eval
$(call add_include_file
,backends
/cxxrtl
/cxxrtl_vcd.h
))
599 $(eval
$(call add_include_file
,backends
/cxxrtl
/cxxrtl_capi.
cc))
600 $(eval
$(call add_include_file
,backends
/cxxrtl
/cxxrtl_capi.h
))
601 $(eval
$(call add_include_file
,backends
/cxxrtl
/cxxrtl_vcd_capi.
cc))
602 $(eval
$(call add_include_file
,backends
/cxxrtl
/cxxrtl_vcd_capi.h
))
604 OBJS
+= kernel
/driver.o kernel
/register.o kernel
/rtlil.o kernel
/log.o kernel
/calc.o kernel
/yosys.o
605 OBJS
+= kernel
/cellaigs.o kernel
/celledges.o kernel
/satgen.o
607 kernel
/log.o
: CXXFLAGS
+= -DYOSYS_SRC
='"$(YOSYS_SRC)"'
608 kernel
/yosys.o
: CXXFLAGS
+= -DYOSYS_DATDIR
='"$(DATDIR)"' -DYOSYS_PROGRAM_PREFIX
='"$(PROGRAM_PREFIX)"'
610 OBJS
+= libs
/bigint
/BigIntegerAlgorithms.o libs
/bigint
/BigInteger.o libs
/bigint
/BigIntegerUtils.o
611 OBJS
+= libs
/bigint
/BigUnsigned.o libs
/bigint
/BigUnsignedInABase.o
613 OBJS
+= libs
/sha1
/sha1.o
617 OBJS
+= libs
/json11
/json11.o
619 OBJS
+= libs
/subcircuit
/subcircuit.o
621 OBJS
+= libs
/ezsat
/ezsat.o
622 OBJS
+= libs
/ezsat
/ezminisat.o
624 OBJS
+= libs
/minisat
/Options.o
625 OBJS
+= libs
/minisat
/SimpSolver.o
626 OBJS
+= libs
/minisat
/Solver.o
627 OBJS
+= libs
/minisat
/System.o
629 include $(YOSYS_SRC
)/frontends
/*/Makefile.inc
630 include $(YOSYS_SRC
)/passes
/*/Makefile.inc
631 include $(YOSYS_SRC
)/backends
/*/Makefile.inc
632 include $(YOSYS_SRC
)/techlibs
/*/Makefile.inc
636 include $(YOSYS_SRC
)/frontends
/verilog
/Makefile.inc
637 include $(YOSYS_SRC
)/frontends
/ilang
/Makefile.inc
638 include $(YOSYS_SRC
)/frontends
/ast
/Makefile.inc
639 include $(YOSYS_SRC
)/frontends
/blif
/Makefile.inc
641 OBJS
+= passes
/hierarchy
/hierarchy.o
642 OBJS
+= passes
/cmds
/select.o
643 OBJS
+= passes
/cmds
/show.o
644 OBJS
+= passes
/cmds
/stat.o
645 OBJS
+= passes
/cmds
/cover.o
646 OBJS
+= passes
/cmds
/design.o
647 OBJS
+= passes
/cmds
/plugin.o
649 include $(YOSYS_SRC
)/passes
/proc
/Makefile.inc
650 include $(YOSYS_SRC
)/passes
/opt
/Makefile.inc
651 include $(YOSYS_SRC
)/passes
/techmap
/Makefile.inc
653 include $(YOSYS_SRC
)/backends
/verilog
/Makefile.inc
654 include $(YOSYS_SRC
)/backends
/ilang
/Makefile.inc
656 include $(YOSYS_SRC
)/techlibs
/common
/Makefile.inc
661 OBJS
+= $(PROGRAM_PREFIX
)yosys-libabc.a
664 top-all
: $(TARGETS
) $(EXTRA_TARGETS
)
666 @echo
" Build successful."
669 ifeq ($(CONFIG
),emcc
)
670 yosys.js
: $(filter-out yosysjs-
$(YOSYS_VER
).zip
,$(EXTRA_TARGETS
))
673 $(PROGRAM_PREFIX
)yosys
$(EXE
): $(OBJS
)
674 $(P
) $(LD
) -o
$(PROGRAM_PREFIX
)yosys
$(EXE
) $(LDFLAGS
) $(OBJS
) $(LDLIBS
)
676 libyosys.so
: $(filter-out kernel
/driver.o
,$(OBJS
))
678 $(P
) $(LD
) -o libyosys.so
-shared
-Wl
,-install_name
,$(DESTDIR
)$(LIBDIR
)/libyosys.so
$(LDFLAGS
) $^
$(LDLIBS
)
680 $(P
) $(LD
) -o libyosys.so
-shared
-Wl
,-soname
,$(DESTDIR
)$(LIBDIR
)/libyosys.so
$(LDFLAGS
) $^
$(LDLIBS
)
684 $(Q
) mkdir
-p
$(dir $@
)
685 $(P
) $(CXX
) -o
$@
-c
$(CPPFLAGS
) $(CXXFLAGS
) $<
688 $(Q
) mkdir
-p
$(dir $@
)
689 $(P
) cat
$< | grep
-E
-v
"#[ ]*(include|error)" |
$(LD
) -x c
++ -o
$@
-E
-P
-
691 ifeq ($(ENABLE_PYOSYS
),1)
692 $(PY_WRAPPER_FILE
).
cc: misc
/$(PY_GEN_SCRIPT
).py
$(PY_WRAP_INCLUDES
)
693 $(Q
) mkdir
-p
$(dir $@
)
694 $(P
) python
$(PYTHON_VERSION
) -c
"from misc import $(PY_GEN_SCRIPT); $(PY_GEN_SCRIPT).gen_wrappers(\"$(PY_WRAPPER_FILE).cc\")"
698 $(Q
) mkdir
-p
$(dir $@
)
699 $(P
) $(CXX
) -o
$@
-c
$(CPPFLAGS
) $(CXXFLAGS
) $<
701 YOSYS_VER_STR
:= Yosys
$(YOSYS_VER
) (git sha1
$(GIT_REV
), $(notdir $(CXX
)) $(shell \
702 $(CXX
) --version | tr
' ()' '\n' | grep
'^[0-9]' | head
-n1
) $(filter -f
% -m
% -O
% -DNDEBUG
,$(CXXFLAGS
)))
704 kernel
/version_
$(GIT_REV
).
cc: $(YOSYS_SRC
)/Makefile
705 $(P
) rm -f kernel
/version_
*.o kernel
/version_
*.d kernel
/version_
*.
cc
706 $(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
708 ifeq ($(ENABLE_VERIFIC
),1)
709 CXXFLAGS_NOVERIFIC
= $(foreach v
,$(CXXFLAGS
),$(if
$(findstring $(VERIFIC_DIR
),$(v
)),,$(v
)))
710 LDLIBS_NOVERIFIC
= $(foreach v
,$(LDLIBS
),$(if
$(findstring $(VERIFIC_DIR
),$(v
)),,$(v
)))
712 CXXFLAGS_NOVERIFIC
= $(CXXFLAGS
)
713 LDLIBS_NOVERIFIC
= $(LDLIBS
)
716 $(PROGRAM_PREFIX
)yosys-config
: misc
/yosys-config.in
717 $(P
) $(SED
) -e
's#@CXXFLAGS@#$(subst -I. -I"$(YOSYS_SRC)",-I"$(DATDIR)/include",$(strip $(CXXFLAGS_NOVERIFIC)))#;' \
718 -e
's#@CXX@#$(strip $(CXX))#;' -e
's#@LDFLAGS@#$(strip $(LDFLAGS) $(PLUGIN_LDFLAGS))#;' -e
's#@LDLIBS@#$(strip $(LDLIBS_NOVERIFIC))#;' \
719 -e
's#@BINDIR@#$(strip $(BINDIR))#;' -e
's#@DATDIR@#$(strip $(DATDIR))#;' < $< > $(PROGRAM_PREFIX
)yosys-config
720 $(Q
) chmod
+x
$(PROGRAM_PREFIX
)yosys-config
722 abc
/abc-
$(ABCREV
)$(EXE
) abc
/libabc-
$(ABCREV
).a
:
724 ifneq ($(ABCREV
),default
)
725 $(Q
) if
test -d abc
/.hg
; then \
726 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
; \
728 $(Q
) if
( cd abc
2> /dev
/null
&& ! git diff-index
--quiet HEAD
; ); then \
729 echo
'REEBE: NOP pbagnvaf ybpny zbqvsvpngvbaf! Frg NOPERI=qrsnhyg va Lbflf Znxrsvyr!' | tr
'A-Za-z' 'N-ZA-Mn-za-m'; false
; \
731 # set a variable so the test fails if git fails to run - when comparing outputs directly, empty string would match empty string
732 $(Q
) if
! (cd abc
2> /dev
/null
&& rev
="`git rev-parse $(ABCREV)`" && test "`git rev-parse HEAD`" == "$$rev"); then \
733 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; }; \
734 echo
"Pulling ABC from $(ABCURL):"; set
-x
; \
735 test -d abc || git clone
$(ABCURL
) abc
; \
736 cd abc
&& $(MAKE
) DEP
= clean && git fetch
$(ABCURL
) && git checkout
$(ABCREV
); \
739 $(Q
) rm -f abc
/abc-
[0-9a-f
]*
740 $(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
)
742 ifeq ($(ABCREV
),default
)
743 .PHONY
: abc
/abc-
$(ABCREV
)$(EXE
)
744 .PHONY
: abc
/libabc-
$(ABCREV
).a
747 $(PROGRAM_PREFIX
)yosys-abc
$(EXE
): abc
/abc-
$(ABCREV
)$(EXE
)
748 $(P
) cp abc
/abc-
$(ABCREV
)$(EXE
) $(PROGRAM_PREFIX
)yosys-abc
$(EXE
)
750 $(PROGRAM_PREFIX
)yosys-libabc.a
: abc
/libabc-
$(ABCREV
).a
751 $(P
) cp abc
/libabc-
$(ABCREV
).a
$(PROGRAM_PREFIX
)yosys-libabc.a
759 ifneq ($(ABCEXTERNAL
),)
760 ABCOPT
="-A $(ABCEXTERNAL)"
765 test: $(TARGETS
) $(EXTRA_TARGETS
)
766 +cd tests
/simple
&& bash run-test.sh
$(SEEDOPT
)
767 +cd tests
/simple_abc9
&& bash run-test.sh
$(SEEDOPT
)
768 +cd tests
/hana
&& bash run-test.sh
$(SEEDOPT
)
769 +cd tests
/asicworld
&& bash run-test.sh
$(SEEDOPT
)
770 # +cd tests/realmath && bash run-test.sh $(SEEDOPT)
771 +cd tests
/share
&& bash run-test.sh
$(SEEDOPT
)
772 +cd tests
/opt_share
&& bash run-test.sh
$(SEEDOPT
)
773 +cd tests
/fsm
&& bash run-test.sh
$(SEEDOPT
)
774 +cd tests
/techmap
&& bash run-test.sh
775 +cd tests
/memories
&& bash run-test.sh
$(ABCOPT
) $(SEEDOPT
)
776 +cd tests
/bram
&& bash run-test.sh
$(SEEDOPT
)
777 +cd tests
/various
&& bash run-test.sh
778 +cd tests
/select
&& bash run-test.sh
779 +cd tests
/sat
&& bash run-test.sh
780 +cd tests
/svinterfaces
&& bash run-test.sh
$(SEEDOPT
)
781 +cd tests
/svtypes
&& bash run-test.sh
$(SEEDOPT
)
782 +cd tests
/proc
&& bash run-test.sh
783 +cd tests
/opt
&& bash run-test.sh
784 +cd tests
/aiger
&& bash run-test.sh
$(ABCOPT
)
785 +cd tests
/arch
&& bash run-test.sh
786 +cd tests
/arch
/ice40
&& bash run-test.sh
$(SEEDOPT
)
787 +cd tests
/arch
/xilinx
&& bash run-test.sh
$(SEEDOPT
)
788 +cd tests
/arch
/ecp5
&& bash run-test.sh
$(SEEDOPT
)
789 +cd tests
/arch
/efinix
&& bash run-test.sh
$(SEEDOPT
)
790 +cd tests
/arch
/anlogic
&& bash run-test.sh
$(SEEDOPT
)
791 +cd tests
/arch
/gowin
&& bash run-test.sh
$(SEEDOPT
)
792 +cd tests
/arch
/intel_alm
&& bash run-test.sh
$(SEEDOPT
)
793 +cd tests
/rpc
&& bash run-test.sh
794 +cd tests
/memfile
&& bash run-test.sh
795 +cd tests
/verilog
&& bash run-test.sh
797 @echo
" Passed \"make test\"."
800 VALGRIND ?
= valgrind
--error-exitcode
=1 --leak-check
=full
--show-reachable
=yes
--errors-for-leak-kinds
=all
802 vgtest
: $(TARGETS
) $(EXTRA_TARGETS
)
803 $(VALGRIND
) .
/yosys
-p
'setattr -mod -unset top; synth' $$( ls tests
/simple
/*.v | grep
-v repwhile.v
)
805 @echo
" Passed \"make vgtest\"."
808 vloghtb
: $(TARGETS
) $(EXTRA_TARGETS
)
809 +cd tests
/vloghtb
&& bash run-test.sh
811 @echo
" Passed \"make vloghtb\"."
814 ystests
: $(TARGETS
) $(EXTRA_TARGETS
)
816 git clone https
://github.com
/YosysHQ
/yosys-tests.git tests
/ystests
817 +$(MAKE
) PATH
="$$PWD:$$PATH" -C tests
/ystests
819 @echo
" Finished \"make ystests\"."
823 unit-test
: libyosys.so
824 @
$(MAKE
) -C
$(UNITESTPATH
) CXX
="$(CXX)" CPPFLAGS
="$(CPPFLAGS)" \
825 CXXFLAGS
="$(CXXFLAGS)" LDLIBS
="$(LDLIBS)" ROOTPATH
="$(CURDIR)"
828 @
$(MAKE
) -C
$(UNITESTPATH
) clean
830 install: $(TARGETS
) $(EXTRA_TARGETS
)
831 $(INSTALL_SUDO
) mkdir
-p
$(DESTDIR
)$(BINDIR
)
832 $(INSTALL_SUDO
) cp
$(filter-out libyosys.so
,$(TARGETS
)) $(DESTDIR
)$(BINDIR
)
833 ifneq ($(filter $(PROGRAM_PREFIX
)yosys
,$(TARGETS
)),)
834 $(INSTALL_SUDO
) $(STRIP
) -S
$(DESTDIR
)$(BINDIR
)/$(PROGRAM_PREFIX
)yosys
836 ifneq ($(filter $(PROGRAM_PREFIX
)yosys-abc
,$(TARGETS
)),)
837 $(INSTALL_SUDO
) $(STRIP
) $(DESTDIR
)$(BINDIR
)/$(PROGRAM_PREFIX
)yosys-abc
839 ifneq ($(filter $(PROGRAM_PREFIX
)yosys-filterlib
,$(TARGETS
)),)
840 $(INSTALL_SUDO
) $(STRIP
) $(DESTDIR
)$(BINDIR
)/$(PROGRAM_PREFIX
)yosys-filterlib
842 $(INSTALL_SUDO
) mkdir
-p
$(DESTDIR
)$(DATDIR
)
843 $(INSTALL_SUDO
) cp
-r share
/.
$(DESTDIR
)$(DATDIR
)/.
844 ifeq ($(ENABLE_LIBYOSYS
),1)
845 $(INSTALL_SUDO
) mkdir
-p
$(DESTDIR
)$(LIBDIR
)
846 $(INSTALL_SUDO
) cp libyosys.so
$(DESTDIR
)$(LIBDIR
)/
847 $(INSTALL_SUDO
) $(STRIP
) -S
$(DESTDIR
)$(LIBDIR
)/libyosys.so
848 ifeq ($(ENABLE_PYOSYS
),1)
849 $(INSTALL_SUDO
) mkdir
-p
$(PYTHON_DESTDIR
)/$(subst -,_
,$(PROGRAM_PREFIX
))pyosys
850 $(INSTALL_SUDO
) cp libyosys.so
$(PYTHON_DESTDIR
)/$(subst -,_
,$(PROGRAM_PREFIX
))pyosys
/libyosys.so
851 $(INSTALL_SUDO
) cp misc
/__init__.py
$(PYTHON_DESTDIR
)/$(subst -,_
,$(PROGRAM_PREFIX
))pyosys
/
856 $(INSTALL_SUDO
) rm -vf
$(addprefix $(DESTDIR
)$(BINDIR
)/,$(notdir $(TARGETS
)))
857 $(INSTALL_SUDO
) rm -rvf
$(DESTDIR
)$(DATDIR
)
858 ifeq ($(ENABLE_LIBYOSYS
),1)
859 $(INSTALL_SUDO
) rm -vf
$(DESTDIR
)$(LIBDIR
)/libyosys.so
860 ifeq ($(ENABLE_PYOSYS
),1)
861 $(INSTALL_SUDO
) rm -vf
$(PYTHON_DESTDIR
)/$(subst -,_
,$(PROGRAM_PREFIX
))pyosys
/libyosys.so
862 $(INSTALL_SUDO
) rm -vf
$(PYTHON_DESTDIR
)/$(subst -,_
,$(PROGRAM_PREFIX
))pyosys
/__init__.py
863 $(INSTALL_SUDO
) rmdir
$(PYTHON_DESTDIR
)/$(subst -,_
,$(PROGRAM_PREFIX
))pyosys
867 update-manual
: $(TARGETS
) $(EXTRA_TARGETS
)
868 cd manual
&& ..
/$(PROGRAM_PREFIX
)yosys
-p
'help -write-tex-command-reference-manual'
870 manual
: $(TARGETS
) $(EXTRA_TARGETS
)
871 cd manual
&& bash appnotes.sh
872 cd manual
&& bash presentation.sh
873 cd manual
&& bash manual.sh
878 if
test -d manual
; then cd manual
&& sh
clean.sh
; fi
879 rm -f
$(OBJS
) $(GENFILES
) $(TARGETS
) $(EXTRA_TARGETS
) $(EXTRA_OBJS
) $(PY_WRAP_INCLUDES
) $(PY_WRAPPER_FILE
).
cc
880 rm -f kernel
/version_
*.o kernel
/version_
*.
cc
881 rm -f libs
/*/*.d frontends
/*/*.d passes
/*/*.d backends
/*/*.d kernel
/*.d techlibs
/*/*.d
882 rm -rf tests
/asicworld
/*.out tests
/asicworld
/*.log
883 rm -rf tests
/hana
/*.out tests
/hana
/*.log
884 rm -rf tests
/simple
/*.out tests
/simple
/*.log
885 rm -rf tests
/memories
/*.out tests
/memories
/*.log tests
/memories
/*.dmp
886 rm -rf tests
/sat
/*.log tests
/techmap
/*.log tests
/various
/*.log
887 rm -rf tests
/bram
/temp tests
/fsm
/temp tests
/realmath
/temp tests
/share
/temp tests
/smv
/temp
888 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_
*
889 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
890 rm -f tests
/tools
/cmp_tbdata
893 $(MAKE
) -C abc DEP
= clean
894 rm -f
$(PROGRAM_PREFIX
)yosys-abc
$(EXE
) $(PROGRAM_PREFIX
)yosys-libabc.a abc
/abc-
[0-9a-f
]* abc
/libabc-
[0-9a-f
]*.a
900 .
/$(PROGRAM_PREFIX
)yosys
-qp
'help; help -all'
901 rm -rf coverage.
info coverage_html
902 lcov
--capture
-d .
--no-external
-o coverage.
info
903 genhtml coverage.
info --output-directory coverage_html
906 { for file in
$(basename $(OBJS
)); do \
907 for
prefix in
cc y l
; do if
[ -f
$${file}.
$${prefix} ]; then echo
$$file.
$${prefix}; fi
; done \
908 done
; find backends frontends kernel libs passes
-type f \
( -name
'*.h' -o
-name
'*.hh' \
); } > qtcreator.files
909 { echo .
; find backends frontends kernel libs passes
-type f \
( -name
'*.h' -o
-name
'*.hh' \
) -printf
'%h\n' |
sort -u
; } > qtcreator.includes
910 touch qtcreator.config qtcreator.creator
912 vcxsrc
: $(GENFILES
) $(EXTRA_TARGETS
)
913 rm -rf yosys-win32-vcxsrc-
$(YOSYS_VER
){,.zip
}
914 set
-e
; for f in
`ls $(filter %.cc %.cpp,$(GENFILES)) $(addsuffix .cc,$(basename $(OBJS))) $(addsuffix .cpp,$(basename $(OBJS))) 2> /dev/null`; do \
915 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
916 bash misc
/create_vcxsrc.sh yosys-win32-vcxsrc
$(YOSYS_VER
) $(GIT_REV
)
917 echo
"namespace Yosys { extern const char *yosys_version_str; const char *yosys_version_str=\"Yosys (Version Information Unavailable)\"; }" > kernel
/version.
cc
918 zip yosys-win32-vcxsrc-
$(YOSYS_VER
)/genfiles.zip
$(GENFILES
) kernel
/version.
cc
919 zip
-r yosys-win32-vcxsrc-
$(YOSYS_VER
).zip yosys-win32-vcxsrc-
$(YOSYS_VER
)/
920 rm -f srcfiles.txt kernel
/version.
cc
923 mxebin
: $(TARGETS
) $(EXTRA_TARGETS
)
924 rm -rf yosys-win32-mxebin-
$(YOSYS_VER
){,.zip
}
925 mkdir
-p yosys-win32-mxebin-
$(YOSYS_VER
)
926 cp
-r
$(PROGRAM_PREFIX
)yosys.exe share
/ yosys-win32-mxebin-
$(YOSYS_VER
)/
927 ifeq ($(ENABLE_ABC
),1)
928 cp
-r
$(PROGRAM_PREFIX
)yosys-abc.exe abc
/lib
/x86
/pthreadVC2.dll yosys-win32-mxebin-
$(YOSYS_VER
)/
930 echo
-en
'This is Yosys $(YOSYS_VER) for Win32.\r\n' > yosys-win32-mxebin-
$(YOSYS_VER
)/readme.txt
931 echo
-en
'Documentation at http://www.clifford.at/yosys/.\r\n' >> yosys-win32-mxebin-
$(YOSYS_VER
)/readme.txt
932 zip
-r yosys-win32-mxebin-
$(YOSYS_VER
).zip yosys-win32-mxebin-
$(YOSYS_VER
)/
939 echo
'CONFIG := clang' > Makefile.conf
942 echo
'CONFIG := gcc' > Makefile.conf
944 config-gcc-static
: clean
945 echo
'CONFIG := gcc-static' > Makefile.conf
946 echo
'ENABLE_PLUGINS := 0' >> Makefile.conf
947 echo
'ENABLE_READLINE := 0' >> Makefile.conf
948 echo
'ENABLE_TCL := 0' >> Makefile.conf
950 config-gcc-4.8
: clean
951 echo
'CONFIG := gcc-4.8' > Makefile.conf
953 config-afl-gcc
: clean
954 echo
'CONFIG := afl-gcc' > Makefile.conf
957 echo
'CONFIG := emcc' > Makefile.conf
958 echo
'ENABLE_TCL := 0' >> Makefile.conf
959 echo
'ENABLE_ABC := 0' >> Makefile.conf
960 echo
'ENABLE_PLUGINS := 0' >> Makefile.conf
961 echo
'ENABLE_READLINE := 0' >> Makefile.conf
962 echo
'ENABLE_ZLIB := 0' >> Makefile.conf
965 echo
'CONFIG := wasi' > Makefile.conf
966 echo
'ENABLE_TCL := 0' >> Makefile.conf
967 echo
'ENABLE_ABC := 0' >> Makefile.conf
968 echo
'ENABLE_PLUGINS := 0' >> Makefile.conf
969 echo
'ENABLE_READLINE := 0' >> Makefile.conf
970 echo
'ENABLE_ZLIB := 0' >> Makefile.conf
973 echo
'CONFIG := mxe' > Makefile.conf
974 echo
'ENABLE_PLUGINS := 0' >> Makefile.conf
977 echo
'CONFIG := msys2' > Makefile.conf
978 echo
'ENABLE_PLUGINS := 0' >> Makefile.conf
980 config-msys2-64
: clean
981 echo
'CONFIG := msys2-64' > Makefile.conf
982 echo
'ENABLE_PLUGINS := 0' >> Makefile.conf
985 echo
'CONFIG := cygwin' > Makefile.conf
988 echo
'CONFIG := gcc' > Makefile.conf
989 echo
'ENABLE_GCOV := 1' >> Makefile.conf
990 echo
'ENABLE_DEBUG := 1' >> Makefile.conf
993 echo
'CONFIG := gcc' > Makefile.conf
994 echo
'ENABLE_GPROF := 1' >> Makefile.conf
997 echo
"INSTALL_SUDO := sudo" >> Makefile.conf
1000 @echo
"$(YOSYS_VER)"
1009 -include frontends
/*/*.d
1010 -include passes
/*/*.d
1011 -include backends
/*/*.d
1013 -include techlibs
/*/*.d
1015 .PHONY
: all top-all abc
test install install-abc manual
clean mrproper qtcreator coverage vcxsrc mxebin
1016 .PHONY
: config-clean config-clang config-gcc config-gcc-static config-gcc-4.8 config-afl-gcc config-gprof config-sudo