10 # features (the more the better)
22 # other configuration flags
30 # Needed for environments that don't have proper thread support (i.e. emscripten)
31 DISABLE_ABC_THREADS
:= 0
37 # SANITIZER = undefined
41 OS
:= $(shell uname
-s
)
45 BINDIR
:= $(PREFIX
)/bin
46 LIBDIR
:= $(PREFIX
)/lib
47 DATDIR
:= $(PREFIX
)/share
/yosys
54 TARGETS
= yosys
$(EXE
) yosys-config
60 UNITESTPATH
:= tests
/unit
64 YOSYS_SRC
:= $(dir $(firstword $(MAKEFILE_LIST
)))
67 CXXFLAGS
:= $(CXXFLAGS
) -Wall
-Wextra
-ggdb
-I.
-I
"$(YOSYS_SRC)" -MD
-D_YOSYS_
-fPIC
-I
$(PREFIX
)/include
68 LDFLAGS
:= $(LDFLAGS
) -L
$(LIBDIR
)
69 LDLIBS
:= $(LDLIBS
) -lstdc
++ -lm
72 PKG_CONFIG ?
= pkg-config
79 PLUGIN_LDFLAGS
+= -undefined dynamic_lookup
81 # homebrew search paths
82 ifneq ($(shell which brew
),)
83 BREW_PREFIX
:= $(shell brew
--prefix)/opt
84 CXXFLAGS
+= -I
$(BREW_PREFIX
)/readline
/include
85 LDFLAGS
+= -L
$(BREW_PREFIX
)/readline
/lib
86 PKG_CONFIG_PATH
:= $(BREW_PREFIX
)/libffi
/lib
/pkgconfig
:$(PKG_CONFIG_PATH
)
87 PKG_CONFIG_PATH
:= $(BREW_PREFIX
)/tcl-tk
/lib
/pkgconfig
:$(PKG_CONFIG_PATH
)
88 export PATH
:= $(BREW_PREFIX
)/bison
/bin
:$(BREW_PREFIX
)/gettext
/bin
:$(BREW_PREFIX
)/flex
/bin
:$(PATH
)
90 # macports search paths
91 else ifneq ($(shell which port
),)
92 PORT_PREFIX
:= $(patsubst %/bin
/port
,%,$(shell which port
))
93 CXXFLAGS
+= -I
$(PORT_PREFIX
)/include
94 LDFLAGS
+= -L
$(PORT_PREFIX
)/lib
95 PKG_CONFIG_PATH
:= $(PORT_PREFIX
)/lib
/pkgconfig
:$(PKG_CONFIG_PATH
)
96 export PATH
:= $(PORT_PREFIX
)/bin
:$(PATH
)
104 YOSYS_VER
:= 0.8+$(shell cd
$(YOSYS_SRC
) && test -e .git
&& { git log
--author
=clifford@clifford.at
--oneline
4d4665b..
2> /dev
/null | wc
-l
; })
105 GIT_REV
:= $(shell cd
$(YOSYS_SRC
) && git rev-parse
--short HEAD
2> /dev
/null || echo UNKNOWN
)
106 OBJS
= kernel
/version_
$(GIT_REV
).o
108 # set 'ABCREV = default' to use abc/ as it is
110 # Note: If you do ABC development, make sure that 'abc' in this directory
111 # is just a symlink to your actual ABC working directory, as 'make mrproper'
112 # will remove the 'abc' directory and you do not want to accidentally
113 # delete your work on ABC..
116 ABCURL ?
= https
://github.com
/berkeley-abc
/abc
117 ABCMKARGS
= CC
="$(CXX)" CXX
="$(CXX)" ABC_USE_LIBSTDCXX
=1
119 # set ABCEXTERNAL = <abc-command> to use an external ABC instance
120 # Note: The in-tree ABC (yosys-abc) will not be installed when ABCEXTERNAL is set.
128 ifneq ($(wildcard Makefile.conf
),)
129 $(info $(subst $$--$$,$(newline
),$(shell sed
's,^,[Makefile.conf] ,; s,$$,$$--$$,;' < Makefile.conf | tr
-d
'\n' | sed
's,\$$--\$$$$,,')))
130 include Makefile.conf
133 ifeq ($(CONFIG
),clang
)
136 CXXFLAGS
+= -std
=c
++11 -Os
137 ABCMKARGS
+= ARCHFLAGS
="-DABC_USE_STDINT_H"
139 ifneq ($(SANITIZER
),)
140 $(info [Clang Sanitizer
] $(SANITIZER
))
141 CXXFLAGS
+= -g
-O1
-fno-omit-frame-pointer
-fno-optimize-sibling-calls
-fsanitize
=$(SANITIZER
)
142 LDFLAGS
+= -g
-fsanitize
=$(SANITIZER
)
143 ifeq ($(SANITIZER
),address
)
146 ifeq ($(SANITIZER
),memory
)
147 CXXFLAGS
+= -fPIE
-fsanitize-memory-track-origins
148 LDFLAGS
+= -fPIE
-fsanitize-memory-track-origins
150 ifeq ($(SANITIZER
),cfi
)
156 else ifeq ($(CONFIG
),gcc
)
159 CXXFLAGS
+= -std
=c
++11 -Os
160 ABCMKARGS
+= ARCHFLAGS
="-DABC_USE_STDINT_H"
162 else ifeq ($(CONFIG
),gcc-static
)
164 LDFLAGS
:= $(filter-out -rdynamic
,$(LDFLAGS
)) -static
165 LDLIBS
:= $(filter-out -lrt
,$(LDLIBS
))
166 CXXFLAGS
:= $(filter-out -fPIC
,$(CXXFLAGS
))
167 CXXFLAGS
+= -std
=c
++11 -Os
168 ABCMKARGS
= CC
="$(CC)" CXX
="$(CXX)" LD
="$(LD)" ABC_USE_LIBSTDCXX
=1 LIBS
="-lm -lpthread -static" OPTFLAGS
="-O" \
169 ARCHFLAGS
="-DABC_USE_STDINT_H -DABC_NO_DYNAMIC_LINKING=1 -Wno-unused-but-set-variable $(ARCHFLAGS)" ABC_USE_NO_READLINE
=1
170 ifeq ($(DISABLE_ABC_THREADS
),1)
171 ABCMKARGS
+= "ABC_USE_NO_PTHREADS=1"
174 else ifeq ($(CONFIG
),gcc-4.8
)
177 CXXFLAGS
+= -std
=c
++11 -Os
178 ABCMKARGS
+= ARCHFLAGS
="-DABC_USE_STDINT_H"
180 else ifeq ($(CONFIG
),cygwin
)
183 CXXFLAGS
+= -std
=gnu
++11 -Os
184 ABCMKARGS
+= ARCHFLAGS
="-DABC_USE_STDINT_H"
186 else ifeq ($(CONFIG
),emcc
)
189 CXXFLAGS
:= -std
=c
++11 $(filter-out -fPIC
-ggdb
,$(CXXFLAGS
))
190 ABCMKARGS
+= ARCHFLAGS
="-DABC_USE_STDINT_H -DABC_MEMALIGN=8"
191 EMCCFLAGS
:= -Os
-Wno-warn-absolute-paths
192 EMCCFLAGS
+= --memory-init-file
0 --embed-file share
-s NO_EXIT_RUNTIME
=1
193 EMCCFLAGS
+= -s EXPORTED_FUNCTIONS
="['_main','_run','_prompt','_errmsg']"
194 EMCCFLAGS
+= -s TOTAL_MEMORY
=128*1024*1024
195 # https://github.com/kripken/emscripten/blob/master/src/settings.js
196 CXXFLAGS
+= $(EMCCFLAGS
)
197 LDFLAGS
+= $(EMCCFLAGS
)
201 TARGETS
:= $(filter-out yosys-config
,$(TARGETS
))
202 EXTRA_TARGETS
+= yosysjs-
$(YOSYS_VER
).zip
204 ifeq ($(ENABLE_ABC
),1)
206 DISABLE_ABC_THREADS
:= 1
210 wget
-O viz.js.part https
://github.com
/mdaines
/viz.js
/releases
/download
/0.0.3/viz.js
211 mv viz.js.part viz.js
213 yosysjs-
$(YOSYS_VER
).zip
: yosys.js viz.js misc
/yosysjs
/*
214 rm -rf yosysjs-
$(YOSYS_VER
) yosysjs-
$(YOSYS_VER
).zip
215 mkdir
-p yosysjs-
$(YOSYS_VER
)
216 cp viz.js misc
/yosysjs
/* yosys.js yosysjs-
$(YOSYS_VER
)/
217 zip
-r yosysjs-
$(YOSYS_VER
).zip yosysjs-
$(YOSYS_VER
)
219 yosys.html
: misc
/yosys.html
220 $(P
) cp misc
/yosys.html yosys.html
222 else ifeq ($(CONFIG
),mxe
)
223 PKG_CONFIG
= /usr
/local
/src
/mxe
/usr
/bin
/i686-w64-mingw32.static-pkg-config
224 CXX
= /usr
/local
/src
/mxe
/usr
/bin
/i686-w64-mingw32.static-g
++
225 LD
= /usr
/local
/src
/mxe
/usr
/bin
/i686-w64-mingw32.static-g
++
226 CXXFLAGS
+= -std
=c
++11 -Os
-D_POSIX_SOURCE
-DYOSYS_MXE_HACKS
-Wno-attributes
227 CXXFLAGS
:= $(filter-out -fPIC
,$(CXXFLAGS
))
228 LDFLAGS
:= $(filter-out -rdynamic
,$(LDFLAGS
)) -s
229 LDLIBS
:= $(filter-out -lrt
,$(LDLIBS
))
230 ABCMKARGS
+= ARCHFLAGS
="-DWIN32_NO_DLL -DHAVE_STRUCT_TIMESPEC -fpermissive -w"
231 ABCMKARGS
+= LIBS
="lib/x86/pthreadVC2.lib -s" ABC_USE_NO_READLINE
=1 CC
="/usr/local/src/mxe/usr/bin/i686-w64-mingw32.static-gcc"
234 else ifeq ($(CONFIG
),msys2
)
235 CXX
= i686-w64-mingw32-g
++
236 LD
= i686-w64-mingw32-g
++
237 CXXFLAGS
+= -std
=c
++11 -Os
-D_POSIX_SOURCE
-DYOSYS_WIN32_UNIX_DIR
238 CXXFLAGS
:= $(filter-out -fPIC
,$(CXXFLAGS
))
239 LDFLAGS
:= $(filter-out -rdynamic
,$(LDFLAGS
)) -s
240 LDLIBS
:= $(filter-out -lrt
,$(LDLIBS
))
241 ABCMKARGS
+= ARCHFLAGS
="-DABC_USE_STDINT_H -DWIN32_NO_DLL -DHAVE_STRUCT_TIMESPEC -fpermissive -w"
242 ABCMKARGS
+= LIBS
="-lpthread -s" ABC_USE_NO_READLINE
=0 CC
="i686-w64-mingw32-gcc" CXX
="$(CXX)"
245 else ifeq ($(CONFIG
),msys2-64
)
246 CXX
= x86_64-w64-mingw32-g
++
247 LD
= x86_64-w64-mingw32-g
++
248 CXXFLAGS
+= -std
=c
++11 -Os
-D_POSIX_SOURCE
-DYOSYS_WIN32_UNIX_DIR
249 CXXFLAGS
:= $(filter-out -fPIC
,$(CXXFLAGS
))
250 LDFLAGS
:= $(filter-out -rdynamic
,$(LDFLAGS
)) -s
251 LDLIBS
:= $(filter-out -lrt
,$(LDLIBS
))
252 ABCMKARGS
+= ARCHFLAGS
="-DABC_USE_STDINT_H -DWIN32_NO_DLL -DHAVE_STRUCT_TIMESPEC -fpermissive -w"
253 ABCMKARGS
+= LIBS
="-lpthread -s" ABC_USE_NO_READLINE
=0 CC
="x86_64-w64-mingw32-gcc" CXX
="$(CXX)"
256 else ifneq ($(CONFIG
),none
)
257 $(error Invalid CONFIG setting
'$(CONFIG)'. Valid values
: clang
, gcc
, gcc-4.8
, emcc
, mxe
, msys2
, msys2-64
)
260 ifeq ($(ENABLE_LIBYOSYS
),1)
261 TARGETS
+= libyosys.so
264 ifeq ($(ENABLE_READLINE
),1)
265 CXXFLAGS
+= -DYOSYS_ENABLE_READLINE
266 ifeq ($(OS
), FreeBSD
)
267 CXXFLAGS
+= -I
/usr
/local
/include
270 ifeq ($(LINK_CURSES
),1)
272 ABCMKARGS
+= "ABC_READLINE_LIBRARIES=-lcurses -lreadline"
274 ifeq ($(LINK_TERMCAP
),1)
276 ABCMKARGS
+= "ABC_READLINE_LIBRARIES=-lreadline -ltermcap"
282 ifeq ($(ENABLE_EDITLINE
),1)
283 CXXFLAGS
+= -DYOSYS_ENABLE_EDITLINE
284 LDLIBS
+= -ledit
-ltinfo
-lbsd
286 ABCMKARGS
+= "ABC_USE_NO_READLINE=1"
290 ifeq ($(DISABLE_ABC_THREADS
),1)
291 ABCMKARGS
+= "ABC_USE_NO_PTHREADS=1"
294 ifeq ($(ENABLE_PLUGINS
),1)
295 CXXFLAGS
+= $(shell PKG_CONFIG_PATH
=$(PKG_CONFIG_PATH
) $(PKG_CONFIG
) --silence-errors
--cflags libffi
) -DYOSYS_ENABLE_PLUGINS
296 LDLIBS
+= $(shell PKG_CONFIG_PATH
=$(PKG_CONFIG_PATH
) $(PKG_CONFIG
) --silence-errors
--libs libffi || echo
-lffi
)
297 ifneq ($(OS
), FreeBSD
)
302 ifeq ($(ENABLE_GLOB
),1)
303 CXXFLAGS
+= -DYOSYS_ENABLE_GLOB
306 ifeq ($(ENABLE_TCL
),1)
307 TCL_VERSION ?
= tcl
$(shell bash
-c
"tclsh <(echo 'puts [info tclversion]')")
308 ifeq ($(OS
), FreeBSD
)
309 TCL_INCLUDE ?
= /usr
/local
/include/$(TCL_VERSION
)
311 TCL_INCLUDE ?
= /usr
/include/$(TCL_VERSION
)
315 CXXFLAGS
+= -DYOSYS_ENABLE_TCL
316 LDLIBS
+= -ltcl86
-lwsock32
-lws2_32
-lnetapi32
-lz
318 CXXFLAGS
+= $(shell PKG_CONFIG_PATH
=$(PKG_CONFIG_PATH
) $(PKG_CONFIG
) --silence-errors
--cflags tcl || echo
-I
$(TCL_INCLUDE
)) -DYOSYS_ENABLE_TCL
319 ifeq ($(OS
), FreeBSD
)
320 # FreeBSD uses tcl8.6, but lib is named "libtcl86"
321 LDLIBS
+= $(shell PKG_CONFIG_PATH
=$(PKG_CONFIG_PATH
) $(PKG_CONFIG
) --silence-errors
--libs tcl || echo
-l
$(TCL_VERSION
) | tr
-d
'.')
323 LDLIBS
+= $(shell PKG_CONFIG_PATH
=$(PKG_CONFIG_PATH
) $(PKG_CONFIG
) --silence-errors
--libs tcl || echo
-l
$(TCL_VERSION
))
328 ifeq ($(ENABLE_GCOV
),1)
329 CXXFLAGS
+= --coverage
330 LDFLAGS
+= --coverage
333 ifeq ($(ENABLE_GPROF
),1)
338 ifeq ($(ENABLE_NDEBUG
),1)
339 CXXFLAGS
:= -O3
-DNDEBUG
$(filter-out -Os
-ggdb
,$(CXXFLAGS
))
342 ifeq ($(ENABLE_DEBUG
),1)
343 ifeq ($(CONFIG
),clang
)
344 CXXFLAGS
:= -O0
-DDEBUG
$(filter-out -Os
,$(CXXFLAGS
))
346 CXXFLAGS
:= -Og
-DDEBUG
$(filter-out -Os
,$(CXXFLAGS
))
350 ifeq ($(ENABLE_ABC
),1)
351 CXXFLAGS
+= -DYOSYS_ENABLE_ABC
353 CXXFLAGS
+= -DYOSYS_LINK_ABC
354 ifeq ($(DISABLE_ABC_THREADS
),0)
358 ifeq ($(ABCEXTERNAL
),)
359 TARGETS
+= yosys-abc
$(EXE
)
364 ifeq ($(ENABLE_VERIFIC
),1)
365 VERIFIC_DIR ?
= /usr
/local
/src
/verific_lib
366 VERIFIC_COMPONENTS ?
= verilog vhdl database util containers hier_tree
367 CXXFLAGS
+= $(patsubst %,-I
$(VERIFIC_DIR
)/%,$(VERIFIC_COMPONENTS
)) -DYOSYS_ENABLE_VERIFIC
369 LDLIBS
+= $(patsubst %,$(VERIFIC_DIR
)/%/*-mac.a
,$(VERIFIC_COMPONENTS
)) -lz
371 LDLIBS
+= $(patsubst %,$(VERIFIC_DIR
)/%/*-linux.a
,$(VERIFIC_COMPONENTS
)) -lz
375 ifeq ($(ENABLE_PROTOBUF
),1)
376 LDLIBS
+= $(shell pkg-config
--cflags --libs protobuf
)
379 ifeq ($(ENABLE_COVER
),1)
380 CXXFLAGS
+= -DYOSYS_ENABLE_COVER
383 define add_share_file
384 EXTRA_TARGETS
+= $(subst //,/,$(1)/$(notdir $(2)))
385 $(subst //,/,$(1)/$(notdir $(2))): $(2)
387 $$(Q
) cp
"$(YOSYS_SRC)"/$(2) $(subst //,/,$(1)/$(notdir $(2)))
390 define add_gen_share_file
391 EXTRA_TARGETS
+= $(subst //,/,$(1)/$(notdir $(2)))
392 $(subst //,/,$(1)/$(notdir $(2))): $(2)
394 $$(Q
) cp
$(2) $(subst //,/,$(1)/$(notdir $(2)))
397 define add_include_file
398 $(eval
$(call add_share_file
,$(dir share
/include/$(1)),$(1)))
404 P_UPDATE
= $(eval P_STATUS
=$(shell echo
$(OBJS
) yosys
$(EXE
) |
$(AWK
) 'BEGIN { RS = " "; I = $(P_STATUS)+0; } $$1 == "$@" && NR > I { I = NR; } END { print I; }'))
405 P_SHOW
= [$(shell $(AWK
) "BEGIN { N=$(words $(OBJS) yosys$(EXE)); printf \"%3d\", $(P_OFFSET)+90*$(P_STATUS)/N; exit; }")%]
406 P
= @echo
"$(if $(findstring $@,$(TARGETS) $(EXTRA_TARGETS)),$(eval P_OFFSET = 10))$(call P_UPDATE)$(call P_SHOW) Building $@";
416 $(eval
$(call add_include_file
,kernel
/yosys.h
))
417 $(eval
$(call add_include_file
,kernel
/hashlib.h
))
418 $(eval
$(call add_include_file
,kernel
/log.h
))
419 $(eval
$(call add_include_file
,kernel
/rtlil.h
))
420 $(eval
$(call add_include_file
,kernel
/register.h
))
421 $(eval
$(call add_include_file
,kernel
/celltypes.h
))
422 $(eval
$(call add_include_file
,kernel
/celledges.h
))
423 $(eval
$(call add_include_file
,kernel
/consteval.h
))
424 $(eval
$(call add_include_file
,kernel
/sigtools.h
))
425 $(eval
$(call add_include_file
,kernel
/modtools.h
))
426 $(eval
$(call add_include_file
,kernel
/macc.h
))
427 $(eval
$(call add_include_file
,kernel
/utils.h
))
428 $(eval
$(call add_include_file
,kernel
/satgen.h
))
429 $(eval
$(call add_include_file
,libs
/ezsat
/ezsat.h
))
430 $(eval
$(call add_include_file
,libs
/ezsat
/ezminisat.h
))
431 $(eval
$(call add_include_file
,libs
/sha1
/sha1.h
))
432 $(eval
$(call add_include_file
,passes
/fsm
/fsmdata.h
))
433 $(eval
$(call add_include_file
,frontends
/ast
/ast.h
))
434 $(eval
$(call add_include_file
,backends
/ilang
/ilang_backend.h
))
436 OBJS
+= kernel
/driver.o kernel
/register.o kernel
/rtlil.o kernel
/log.o kernel
/calc.o kernel
/yosys.o
437 OBJS
+= kernel
/cellaigs.o kernel
/celledges.o
439 kernel
/log.o
: CXXFLAGS
+= -DYOSYS_SRC
='"$(YOSYS_SRC)"'
440 kernel
/yosys.o
: CXXFLAGS
+= -DYOSYS_DATDIR
='"$(DATDIR)"'
442 OBJS
+= libs
/bigint
/BigIntegerAlgorithms.o libs
/bigint
/BigInteger.o libs
/bigint
/BigIntegerUtils.o
443 OBJS
+= libs
/bigint
/BigUnsigned.o libs
/bigint
/BigUnsignedInABase.o
445 OBJS
+= libs
/sha1
/sha1.o
449 OBJS
+= libs
/subcircuit
/subcircuit.o
451 OBJS
+= libs
/ezsat
/ezsat.o
452 OBJS
+= libs
/ezsat
/ezminisat.o
454 OBJS
+= libs
/minisat
/Options.o
455 OBJS
+= libs
/minisat
/SimpSolver.o
456 OBJS
+= libs
/minisat
/Solver.o
457 OBJS
+= libs
/minisat
/System.o
459 include $(YOSYS_SRC
)/frontends
/*/Makefile.inc
460 include $(YOSYS_SRC
)/passes
/*/Makefile.inc
461 include $(YOSYS_SRC
)/backends
/*/Makefile.inc
462 include $(YOSYS_SRC
)/techlibs
/*/Makefile.inc
466 include frontends
/verilog
/Makefile.inc
467 include frontends
/ilang
/Makefile.inc
468 include frontends
/ast
/Makefile.inc
469 include frontends
/blif
/Makefile.inc
471 OBJS
+= passes
/hierarchy
/hierarchy.o
472 OBJS
+= passes
/cmds
/select.o
473 OBJS
+= passes
/cmds
/show.o
474 OBJS
+= passes
/cmds
/stat.o
475 OBJS
+= passes
/cmds
/cover.o
476 OBJS
+= passes
/cmds
/design.o
477 OBJS
+= passes
/cmds
/plugin.o
479 include passes
/proc
/Makefile.inc
480 include passes
/opt
/Makefile.inc
481 include passes
/techmap
/Makefile.inc
483 include backends
/verilog
/Makefile.inc
484 include backends
/ilang
/Makefile.inc
486 include techlibs
/common
/Makefile.inc
491 OBJS
+= yosys-libabc.a
494 top-all
: $(TARGETS
) $(EXTRA_TARGETS
)
496 @echo
" Build successful."
499 ifeq ($(CONFIG
),emcc
)
500 yosys.js
: $(filter-out yosysjs-
$(YOSYS_VER
).zip
,$(EXTRA_TARGETS
))
504 $(P
) $(LD
) -o yosys
$(EXE
) $(LDFLAGS
) $(OBJS
) $(LDLIBS
)
506 libyosys.so
: $(filter-out kernel
/driver.o
,$(OBJS
))
507 $(P
) $(LD
) -o libyosys.so
-shared
-Wl
,-soname
,libyosys.so
$(LDFLAGS
) $^
$(LDLIBS
)
510 $(Q
) mkdir
-p
$(dir $@
)
511 $(P
) $(CXX
) -o
$@
-c
$(CPPFLAGS
) $(CXXFLAGS
) $<
514 $(Q
) mkdir
-p
$(dir $@
)
515 $(P
) $(CXX
) -o
$@
-c
$(CPPFLAGS
) $(CXXFLAGS
) $<
517 YOSYS_VER_STR
:= Yosys
$(YOSYS_VER
) (git sha1
$(GIT_REV
), $(notdir $(CXX
)) $(shell \
518 $(CXX
) --version | tr
' ()' '\n' | grep
'^[0-9]' | head
-n1
) $(filter -f
% -m
% -O
% -DNDEBUG
,$(CXXFLAGS
)))
520 kernel
/version_
$(GIT_REV
).
cc: $(YOSYS_SRC
)/Makefile
521 $(P
) rm -f kernel
/version_
*.o kernel
/version_
*.d kernel
/version_
*.
cc
522 $(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
524 ifeq ($(ENABLE_VERIFIC
),1)
525 CXXFLAGS_NOVERIFIC
= $(foreach v
,$(CXXFLAGS
),$(if
$(findstring $(VERIFIC_DIR
),$(v
)),,$(v
)))
526 LDLIBS_NOVERIFIC
= $(foreach v
,$(LDLIBS
),$(if
$(findstring $(VERIFIC_DIR
),$(v
)),,$(v
)))
528 CXXFLAGS_NOVERIFIC
= $(CXXFLAGS
)
529 LDLIBS_NOVERIFIC
= $(LDLIBS
)
532 yosys-config
: misc
/yosys-config.in
533 $(P
) $(SED
) -e
's#@CXXFLAGS@#$(subst -I. -I"$(YOSYS_SRC)",-I"$(DATDIR)/include",$(strip $(CXXFLAGS_NOVERIFIC)))#;' \
534 -e
's#@CXX@#$(strip $(CXX))#;' -e
's#@LDFLAGS@#$(strip $(LDFLAGS) $(PLUGIN_LDFLAGS))#;' -e
's#@LDLIBS@#$(strip $(LDLIBS_NOVERIFIC))#;' \
535 -e
's#@BINDIR@#$(strip $(BINDIR))#;' -e
's#@DATDIR@#$(strip $(DATDIR))#;' < $< > yosys-config
536 $(Q
) chmod
+x yosys-config
538 abc
/abc-
$(ABCREV
)$(EXE
) abc
/libabc-
$(ABCREV
).a
:
540 ifneq ($(ABCREV
),default
)
541 $(Q
) if
test -d abc
/.hg
; then \
542 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
; \
544 $(Q
) if
( cd abc
2> /dev
/null
&& ! git diff-index
--quiet HEAD
; ); then \
545 echo
'REEBE: NOP pbagnvaf ybpny zbqvsvpngvbaf! Frg NOPERI=qrsnhyg va Lbflf Znxrsvyr!' | tr
'A-Za-z' 'N-ZA-Mn-za-m'; false
; \
547 $(Q
) if
test "`cd abc 2> /dev/null && git rev-parse --short HEAD`" != "$(ABCREV)"; then \
548 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; }; \
549 echo
"Pulling ABC from $(ABCURL):"; set
-x
; \
550 test -d abc || git clone
$(ABCURL
) abc
; \
551 cd abc
&& $(MAKE
) DEP
= clean && git fetch
origin master
&& git checkout
$(ABCREV
); \
554 $(Q
) rm -f abc
/abc-
[0-9a-f
]*
555 $(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
)
557 ifeq ($(ABCREV
),default
)
558 .PHONY
: abc
/abc-
$(ABCREV
)$(EXE
)
559 .PHONY
: abc
/libabc-
$(ABCREV
).a
562 yosys-abc
$(EXE
): abc
/abc-
$(ABCREV
)$(EXE
)
563 $(P
) cp abc
/abc-
$(ABCREV
)$(EXE
) yosys-abc
$(EXE
)
565 yosys-libabc.a
: abc
/libabc-
$(ABCREV
).a
566 $(P
) cp abc
/libabc-
$(ABCREV
).a yosys-libabc.a
574 test: $(TARGETS
) $(EXTRA_TARGETS
)
575 +cd tests
/simple
&& bash run-test.sh
$(SEEDOPT
)
576 +cd tests
/hana
&& bash run-test.sh
$(SEEDOPT
)
577 +cd tests
/asicworld
&& bash run-test.sh
$(SEEDOPT
)
578 +cd tests
/realmath
&& bash run-test.sh
$(SEEDOPT
)
579 +cd tests
/share
&& bash run-test.sh
$(SEEDOPT
)
580 +cd tests
/fsm
&& bash run-test.sh
$(SEEDOPT
)
581 +cd tests
/techmap
&& bash run-test.sh
582 +cd tests
/memories
&& bash run-test.sh
$(SEEDOPT
)
583 +cd tests
/bram
&& bash run-test.sh
$(SEEDOPT
)
584 +cd tests
/various
&& bash run-test.sh
585 +cd tests
/sat
&& bash run-test.sh
586 +cd tests
/svinterfaces
&& bash run-test.sh
$(SEEDOPT
)
587 +cd tests
/opt
&& bash run-test.sh
589 @echo
" Passed \"make test\"."
592 VALGRIND ?
= valgrind
--error-exitcode
=1 --leak-check
=full
--show-reachable
=yes
--errors-for-leak-kinds
=all
594 vgtest
: $(TARGETS
) $(EXTRA_TARGETS
)
595 $(VALGRIND
) .
/yosys
-p
'setattr -mod -unset top; synth' $$( ls tests
/simple
/*.v | grep
-v repwhile.v
)
597 @echo
" Passed \"make vgtest\"."
600 vloghtb
: $(TARGETS
) $(EXTRA_TARGETS
)
601 +cd tests
/vloghtb
&& bash run-test.sh
603 @echo
" Passed \"make vloghtb\"."
606 ystests
: $(TARGETS
) $(EXTRA_TARGETS
)
608 git clone https
://github.com
/YosysHQ
/yosys-tests.git tests
/ystests
609 +$(MAKE
) PATH
="$$PWD:$$PATH" -C tests
/ystests
611 @echo
" Finished \"make ystests\"."
615 unit-test
: libyosys.so
616 @
$(MAKE
) -C
$(UNITESTPATH
) CXX
="$(CXX)" CPPFLAGS
="$(CPPFLAGS)" \
617 CXXFLAGS
="$(CXXFLAGS)" LDLIBS
="$(LDLIBS)" ROOTPATH
="$(CURDIR)"
620 @
$(MAKE
) -C
$(UNITESTPATH
) clean
622 install: $(TARGETS
) $(EXTRA_TARGETS
)
623 $(INSTALL_SUDO
) mkdir
-p
$(DESTDIR
)$(BINDIR
)
624 $(INSTALL_SUDO
) cp
$(TARGETS
) $(DESTDIR
)$(BINDIR
)
625 ifneq ($(filter yosys
,$(TARGETS
)),)
626 $(INSTALL_SUDO
) $(STRIP
) -S
$(DESTDIR
)$(BINDIR
)/yosys
628 ifneq ($(filter yosys-abc
,$(TARGETS
)),)
629 $(INSTALL_SUDO
) $(STRIP
) $(DESTDIR
)$(BINDIR
)/yosys-abc
631 ifneq ($(filter yosys-filterlib
,$(TARGETS
)),)
632 $(INSTALL_SUDO
) $(STRIP
) $(DESTDIR
)$(BINDIR
)/yosys-filterlib
634 $(INSTALL_SUDO
) mkdir
-p
$(DESTDIR
)$(DATDIR
)
635 $(INSTALL_SUDO
) cp
-r share
/.
$(DESTDIR
)$(DATDIR
)/.
636 ifeq ($(ENABLE_LIBYOSYS
),1)
637 $(INSTALL_SUDO
) cp libyosys.so
$(DESTDIR
)$(LIBDIR
)
638 $(INSTALL_SUDO
) $(STRIP
) -S
$(DESTDIR
)$(LIBDIR
)/libyosys.so
639 $(INSTALL_SUDO
) ldconfig
643 $(INSTALL_SUDO
) rm -vf
$(addprefix $(DESTDIR
)$(BINDIR
)/,$(notdir $(TARGETS
)))
644 $(INSTALL_SUDO
) rm -rvf
$(DESTDIR
)$(DATDIR
)
645 ifeq ($(ENABLE_LIBYOSYS
),1)
646 $(INSTALL_SUDO
) rm -vf
$(DESTDIR
)$(LIBDIR
)/libyosys.so
649 update-manual
: $(TARGETS
) $(EXTRA_TARGETS
)
650 cd manual
&& ..
/yosys
-p
'help -write-tex-command-reference-manual'
652 manual
: $(TARGETS
) $(EXTRA_TARGETS
)
653 cd manual
&& bash appnotes.sh
654 cd manual
&& bash presentation.sh
655 cd manual
&& bash manual.sh
659 if
test -d manual
; then cd manual
&& sh
clean.sh
; fi
660 rm -f
$(OBJS
) $(GENFILES
) $(TARGETS
) $(EXTRA_TARGETS
) $(EXTRA_OBJS
)
661 rm -f kernel
/version_
*.o kernel
/version_
*.
cc abc
/abc-
[0-9a-f
]* abc
/libabc-
[0-9a-f
]*.a
662 rm -f libs
/*/*.d frontends
/*/*.d passes
/*/*.d backends
/*/*.d kernel
/*.d techlibs
/*/*.d
663 rm -rf tests
/asicworld
/*.out tests
/asicworld
/*.log
664 rm -rf tests
/hana
/*.out tests
/hana
/*.log
665 rm -rf tests
/simple
/*.out tests
/simple
/*.log
666 rm -rf tests
/memories
/*.out tests
/memories
/*.log tests
/memories
/*.dmp
667 rm -rf tests
/sat
/*.log tests
/techmap
/*.log tests
/various
/*.log
668 rm -rf tests
/bram
/temp tests
/fsm
/temp tests
/realmath
/temp tests
/share
/temp tests
/smv
/temp
669 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_
*
670 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
671 rm -f tests
/tools
/cmp_tbdata
674 $(MAKE
) -C abc DEP
= clean
675 rm -f yosys-abc
$(EXE
) yosys-libabc.a abc
/abc-
[0-9a-f
]* abc
/libabc-
[0-9a-f
]*.a
681 .
/yosys
-qp
'help; help -all'
682 rm -rf coverage.
info coverage_html
683 lcov
--capture
-d .
--no-external
-o coverage.
info
684 genhtml coverage.
info --output-directory coverage_html
687 { for file in
$(basename $(OBJS
)); do \
688 for
prefix in
cc y l
; do if
[ -f
$${file}.
$${prefix} ]; then echo
$$file.
$${prefix}; fi
; done \
689 done
; find backends frontends kernel libs passes
-type f \
( -name
'*.h' -o
-name
'*.hh' \
); } > qtcreator.files
690 { echo .
; find backends frontends kernel libs passes
-type f \
( -name
'*.h' -o
-name
'*.hh' \
) -printf
'%h\n' |
sort -u
; } > qtcreator.includes
691 touch qtcreator.config qtcreator.creator
693 vcxsrc
: $(GENFILES
) $(EXTRA_TARGETS
)
694 rm -rf yosys-win32-vcxsrc-
$(YOSYS_VER
){,.zip
}
695 set
-e
; for f in
`ls $(filter %.cc %.cpp,$(GENFILES)) $(addsuffix .cc,$(basename $(OBJS))) $(addsuffix .cpp,$(basename $(OBJS))) 2> /dev/null`; do \
696 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
697 bash misc
/create_vcxsrc.sh yosys-win32-vcxsrc
$(YOSYS_VER
) $(GIT_REV
)
698 echo
"namespace Yosys { extern const char *yosys_version_str; const char *yosys_version_str=\"Yosys (Version Information Unavailable)\"; }" > kernel
/version.
cc
699 zip yosys-win32-vcxsrc-
$(YOSYS_VER
)/genfiles.zip
$(GENFILES
) kernel
/version.
cc
700 zip
-r yosys-win32-vcxsrc-
$(YOSYS_VER
).zip yosys-win32-vcxsrc-
$(YOSYS_VER
)/
701 rm -f srcfiles.txt kernel
/version.
cc
704 mxebin
: $(TARGETS
) $(EXTRA_TARGETS
)
705 rm -rf yosys-win32-mxebin-
$(YOSYS_VER
){,.zip
}
706 mkdir
-p yosys-win32-mxebin-
$(YOSYS_VER
)
707 cp
-r yosys.exe share
/ yosys-win32-mxebin-
$(YOSYS_VER
)/
708 ifeq ($(ENABLE_ABC
),1)
709 cp
-r yosys-abc.exe abc
/lib
/x86
/pthreadVC2.dll yosys-win32-mxebin-
$(YOSYS_VER
)/
711 echo
-en
'This is Yosys $(YOSYS_VER) for Win32.\r\n' > yosys-win32-mxebin-
$(YOSYS_VER
)/readme.txt
712 echo
-en
'Documentation at http://www.clifford.at/yosys/.\r\n' >> yosys-win32-mxebin-
$(YOSYS_VER
)/readme.txt
713 zip
-r yosys-win32-mxebin-
$(YOSYS_VER
).zip yosys-win32-mxebin-
$(YOSYS_VER
)/
720 echo
'CONFIG := clang' > Makefile.conf
723 echo
'CONFIG := gcc' > Makefile.conf
725 config-gcc-static
: clean
726 echo
'CONFIG := gcc-static' > Makefile.conf
727 echo
'ENABLE_PLUGINS := 0' >> Makefile.conf
728 echo
'ENABLE_READLINE := 0' >> Makefile.conf
729 echo
'ENABLE_TCL := 0' >> Makefile.conf
731 config-gcc-4.8
: clean
732 echo
'CONFIG := gcc-4.8' > Makefile.conf
735 echo
'CONFIG := emcc' > Makefile.conf
736 echo
'ENABLE_TCL := 0' >> Makefile.conf
737 echo
'ENABLE_ABC := 0' >> Makefile.conf
738 echo
'ENABLE_PLUGINS := 0' >> Makefile.conf
739 echo
'ENABLE_READLINE := 0' >> Makefile.conf
742 echo
'CONFIG := mxe' > Makefile.conf
743 echo
'ENABLE_PLUGINS := 0' >> Makefile.conf
746 echo
'CONFIG := msys2' > Makefile.conf
748 config-msys2-64
: clean
749 echo
'CONFIG := msys2-64' > Makefile.conf
752 echo
'CONFIG := cygwin' > Makefile.conf
755 echo
'CONFIG := gcc' > Makefile.conf
756 echo
'ENABLE_GCOV := 1' >> Makefile.conf
757 echo
'ENABLE_DEBUG := 1' >> Makefile.conf
760 echo
'CONFIG := gcc' > Makefile.conf
761 echo
'ENABLE_GPROF := 1' >> Makefile.conf
764 echo
"INSTALL_SUDO := sudo" >> Makefile.conf
773 -include frontends
/*/*.d
774 -include passes
/*/*.d
775 -include backends
/*/*.d
777 -include techlibs
/*/*.d
779 .PHONY
: all top-all abc
test install install-abc manual
clean mrproper qtcreator coverage vcxsrc mxebin
780 .PHONY
: config-clean config-clang config-gcc config-gcc-static config-gcc-4.8 config-gprof config-sudo