10 # features (the more the better)
21 # other configuration flags
29 # Needed for environments that don't have proper thread support (i.e. emscripten)
30 DISABLE_ABC_THREADS
:= 0
36 # SANITIZER = undefined
40 OS
:= $(shell uname
-s
)
44 BINDIR
:= $(PREFIX
)/bin
45 LIBDIR
:= $(PREFIX
)/lib
46 DATDIR
:= $(PREFIX
)/share
/yosys
53 TARGETS
= yosys
$(EXE
) yosys-config
59 UNITESTPATH
:= tests
/unit
63 YOSYS_SRC
:= $(dir $(firstword $(MAKEFILE_LIST
)))
66 CXXFLAGS
:= $(CXXFLAGS
) -Wall
-Wextra
-ggdb
-I.
-I
"$(YOSYS_SRC)" -MD
-D_YOSYS_
-fPIC
-I
$(PREFIX
)/include
67 LDFLAGS
:= $(LDFLAGS
) -L
$(LIBDIR
)
68 LDLIBS
:= $(LDLIBS
) -lstdc
++ -lm
71 PKG_CONFIG ?
= pkg-config
77 PLUGIN_LDFLAGS
+= -undefined dynamic_lookup
79 # homebrew search paths
80 ifneq ($(shell which brew
),)
81 BREW_PREFIX
:= $(shell brew
--prefix)/opt
82 CXXFLAGS
+= -I
$(BREW_PREFIX
)/readline
/include
83 LDFLAGS
+= -L
$(BREW_PREFIX
)/readline
/lib
84 PKG_CONFIG_PATH
:= $(BREW_PREFIX
)/libffi
/lib
/pkgconfig
:$(PKG_CONFIG_PATH
)
85 PKG_CONFIG_PATH
:= $(BREW_PREFIX
)/tcl-tk
/lib
/pkgconfig
:$(PKG_CONFIG_PATH
)
86 export PATH
:= $(BREW_PREFIX
)/bison
/bin
:$(BREW_PREFIX
)/gettext
/bin
:$(BREW_PREFIX
)/flex
/bin
:$(PATH
)
88 # macports search paths
89 else ifneq ($(shell which port
),)
90 PORT_PREFIX
:= $(patsubst %/bin
/port
,%,$(shell which port
))
91 CXXFLAGS
+= -I
$(PORT_PREFIX
)/include
92 LDFLAGS
+= -L
$(PORT_PREFIX
)/lib
93 PKG_CONFIG_PATH
:= $(PORT_PREFIX
)/lib
/pkgconfig
:$(PKG_CONFIG_PATH
)
94 export PATH
:= $(PORT_PREFIX
)/bin
:$(PATH
)
102 YOSYS_VER
:= 0.8+$(shell cd
$(YOSYS_SRC
) && test -e .git
&& { git log
--author
=clifford@clifford.at
--oneline
4d4665b.. | wc
-l
; })
103 GIT_REV
:= $(shell cd
$(YOSYS_SRC
) && git rev-parse
--short HEAD
2> /dev
/null || echo UNKNOWN
)
104 OBJS
= kernel
/version_
$(GIT_REV
).o
106 # set 'ABCREV = default' to use abc/ as it is
108 # Note: If you do ABC development, make sure that 'abc' in this directory
109 # is just a symlink to your actual ABC working directory, as 'make mrproper'
110 # will remove the 'abc' directory and you do not want to accidentally
111 # delete your work on ABC..
114 ABCURL ?
= https
://github.com
/berkeley-abc
/abc
115 ABCMKARGS
= CC
="$(CXX)" CXX
="$(CXX)" ABC_USE_LIBSTDCXX
=1
117 # set ABCEXTERNAL = <abc-command> to use an external ABC instance
118 # Note: The in-tree ABC (yosys-abc) will not be installed when ABCEXTERNAL is set.
126 ifneq ($(wildcard Makefile.conf
),)
127 $(info $(subst $$--$$,$(newline
),$(shell sed
's,^,[Makefile.conf] ,; s,$$,$$--$$,;' < Makefile.conf | tr
-d
'\n' | sed
's,\$$--\$$$$,,')))
128 include Makefile.conf
131 ifeq ($(CONFIG
),clang
)
134 CXXFLAGS
+= -std
=c
++11 -Os
135 ABCMKARGS
+= ARCHFLAGS
="-DABC_USE_STDINT_H"
137 ifneq ($(SANITIZER
),)
138 $(info [Clang Sanitizer
] $(SANITIZER
))
139 CXXFLAGS
+= -g
-O1
-fno-omit-frame-pointer
-fno-optimize-sibling-calls
-fsanitize
=$(SANITIZER
)
140 LDFLAGS
+= -g
-fsanitize
=$(SANITIZER
)
141 ifeq ($(SANITIZER
),address
)
144 ifeq ($(SANITIZER
),memory
)
145 CXXFLAGS
+= -fPIE
-fsanitize-memory-track-origins
146 LDFLAGS
+= -fPIE
-fsanitize-memory-track-origins
148 ifeq ($(SANITIZER
),cfi
)
154 else ifeq ($(CONFIG
),gcc
)
157 CXXFLAGS
+= -std
=c
++11 -Os
158 ABCMKARGS
+= ARCHFLAGS
="-DABC_USE_STDINT_H"
160 else ifeq ($(CONFIG
),gcc-static
)
162 LDFLAGS
:= $(filter-out -rdynamic
,$(LDFLAGS
)) -static
163 LDLIBS
:= $(filter-out -lrt
,$(LDLIBS
))
164 CXXFLAGS
:= $(filter-out -fPIC
,$(CXXFLAGS
))
165 CXXFLAGS
+= -std
=c
++11 -Os
166 ABCMKARGS
= CC
="$(CC)" CXX
="$(CXX)" LD
="$(LD)" ABC_USE_LIBSTDCXX
=1 LIBS
="-lm -lpthread -static" OPTFLAGS
="-O" \
167 ARCHFLAGS
="-DABC_USE_STDINT_H -DABC_NO_DYNAMIC_LINKING=1 -Wno-unused-but-set-variable $(ARCHFLAGS)" ABC_USE_NO_READLINE
=1
168 ifeq ($(DISABLE_ABC_THREADS
),1)
169 ABCMKARGS
+= "ABC_USE_NO_PTHREADS=1"
172 else ifeq ($(CONFIG
),gcc-4.8
)
175 CXXFLAGS
+= -std
=c
++11 -Os
176 ABCMKARGS
+= ARCHFLAGS
="-DABC_USE_STDINT_H"
178 else ifeq ($(CONFIG
),cygwin
)
181 CXXFLAGS
+= -std
=gnu
++11 -Os
182 ABCMKARGS
+= ARCHFLAGS
="-DABC_USE_STDINT_H"
184 else ifeq ($(CONFIG
),emcc
)
187 CXXFLAGS
:= -std
=c
++11 $(filter-out -fPIC
-ggdb
,$(CXXFLAGS
))
188 ABCMKARGS
+= ARCHFLAGS
="-DABC_USE_STDINT_H -DABC_MEMALIGN=8"
189 EMCCFLAGS
:= -Os
-Wno-warn-absolute-paths
190 EMCCFLAGS
+= --memory-init-file
0 --embed-file share
-s NO_EXIT_RUNTIME
=1
191 EMCCFLAGS
+= -s EXPORTED_FUNCTIONS
="['_main','_run','_prompt','_errmsg']"
192 EMCCFLAGS
+= -s TOTAL_MEMORY
=128*1024*1024
193 # https://github.com/kripken/emscripten/blob/master/src/settings.js
194 CXXFLAGS
+= $(EMCCFLAGS
)
195 LDFLAGS
+= $(EMCCFLAGS
)
199 TARGETS
:= $(filter-out yosys-config
,$(TARGETS
))
200 EXTRA_TARGETS
+= yosysjs-
$(YOSYS_VER
).zip
202 ifeq ($(ENABLE_ABC
),1)
204 DISABLE_ABC_THREADS
:= 1
208 wget
-O viz.js.part https
://github.com
/mdaines
/viz.js
/releases
/download
/0.0.3/viz.js
209 mv viz.js.part viz.js
211 yosysjs-
$(YOSYS_VER
).zip
: yosys.js viz.js misc
/yosysjs
/*
212 rm -rf yosysjs-
$(YOSYS_VER
) yosysjs-
$(YOSYS_VER
).zip
213 mkdir
-p yosysjs-
$(YOSYS_VER
)
214 cp viz.js misc
/yosysjs
/* yosys.js yosysjs-
$(YOSYS_VER
)/
215 zip
-r yosysjs-
$(YOSYS_VER
).zip yosysjs-
$(YOSYS_VER
)
217 yosys.html
: misc
/yosys.html
218 $(P
) cp misc
/yosys.html yosys.html
220 else ifeq ($(CONFIG
),mxe
)
221 PKG_CONFIG
= /usr
/local
/src
/mxe
/usr
/bin
/i686-w64-mingw32.static-pkg-config
222 CXX
= /usr
/local
/src
/mxe
/usr
/bin
/i686-w64-mingw32.static-g
++
223 LD
= /usr
/local
/src
/mxe
/usr
/bin
/i686-w64-mingw32.static-g
++
224 CXXFLAGS
+= -std
=c
++11 -Os
-D_POSIX_SOURCE
-DYOSYS_MXE_HACKS
-Wno-attributes
225 CXXFLAGS
:= $(filter-out -fPIC
,$(CXXFLAGS
))
226 LDFLAGS
:= $(filter-out -rdynamic
,$(LDFLAGS
)) -s
227 LDLIBS
:= $(filter-out -lrt
,$(LDLIBS
))
228 ABCMKARGS
+= ARCHFLAGS
="-DWIN32_NO_DLL -DHAVE_STRUCT_TIMESPEC -fpermissive -w"
229 ABCMKARGS
+= LIBS
="lib/x86/pthreadVC2.lib -s" ABC_USE_NO_READLINE
=1 CC
="/usr/local/src/mxe/usr/bin/i686-w64-mingw32.static-gcc"
232 else ifeq ($(CONFIG
),msys2
)
233 CXX
= i686-w64-mingw32-g
++
234 LD
= i686-w64-mingw32-g
++
235 CXXFLAGS
+= -std
=c
++11 -Os
-D_POSIX_SOURCE
-DYOSYS_WIN32_UNIX_DIR
236 CXXFLAGS
:= $(filter-out -fPIC
,$(CXXFLAGS
))
237 LDFLAGS
:= $(filter-out -rdynamic
,$(LDFLAGS
)) -s
238 LDLIBS
:= $(filter-out -lrt
,$(LDLIBS
))
239 ABCMKARGS
+= ARCHFLAGS
="-DABC_USE_STDINT_H -DWIN32_NO_DLL -DHAVE_STRUCT_TIMESPEC -fpermissive -w"
240 ABCMKARGS
+= LIBS
="-lpthread -s" ABC_USE_NO_READLINE
=0 CC
="i686-w64-mingw32-gcc" CXX
="$(CXX)"
243 else ifeq ($(CONFIG
),msys2-64
)
244 CXX
= x86_64-w64-mingw32-g
++
245 LD
= x86_64-w64-mingw32-g
++
246 CXXFLAGS
+= -std
=c
++11 -Os
-D_POSIX_SOURCE
-DYOSYS_WIN32_UNIX_DIR
247 CXXFLAGS
:= $(filter-out -fPIC
,$(CXXFLAGS
))
248 LDFLAGS
:= $(filter-out -rdynamic
,$(LDFLAGS
)) -s
249 LDLIBS
:= $(filter-out -lrt
,$(LDLIBS
))
250 ABCMKARGS
+= ARCHFLAGS
="-DABC_USE_STDINT_H -DWIN32_NO_DLL -DHAVE_STRUCT_TIMESPEC -fpermissive -w"
251 ABCMKARGS
+= LIBS
="-lpthread -s" ABC_USE_NO_READLINE
=0 CC
="x86_64-w64-mingw32-gcc" CXX
="$(CXX)"
254 else ifneq ($(CONFIG
),none
)
255 $(error Invalid CONFIG setting
'$(CONFIG)'. Valid values
: clang
, gcc
, gcc-4.8
, emcc
, mxe
, msys2
, msys2-64
)
258 ifeq ($(ENABLE_LIBYOSYS
),1)
259 TARGETS
+= libyosys.so
262 ifeq ($(ENABLE_READLINE
),1)
263 CXXFLAGS
+= -DYOSYS_ENABLE_READLINE
264 ifeq ($(OS
), FreeBSD
)
265 CXXFLAGS
+= -I
/usr
/local
/include
268 ifeq ($(LINK_CURSES
),1)
270 ABCMKARGS
+= "ABC_READLINE_LIBRARIES=-lcurses -lreadline"
272 ifeq ($(LINK_TERMCAP
),1)
274 ABCMKARGS
+= "ABC_READLINE_LIBRARIES=-lreadline -ltermcap"
280 ifeq ($(ENABLE_EDITLINE
),1)
281 CXXFLAGS
+= -DYOSYS_ENABLE_EDITLINE
282 LDLIBS
+= -ledit
-ltinfo
-lbsd
284 ABCMKARGS
+= "ABC_USE_NO_READLINE=1"
288 ifeq ($(DISABLE_ABC_THREADS
),1)
289 ABCMKARGS
+= "ABC_USE_NO_PTHREADS=1"
292 ifeq ($(ENABLE_PLUGINS
),1)
293 CXXFLAGS
+= $(shell PKG_CONFIG_PATH
=$(PKG_CONFIG_PATH
) $(PKG_CONFIG
) --silence-errors
--cflags libffi
) -DYOSYS_ENABLE_PLUGINS
294 LDLIBS
+= $(shell PKG_CONFIG_PATH
=$(PKG_CONFIG_PATH
) $(PKG_CONFIG
) --silence-errors
--libs libffi || echo
-lffi
)
295 ifneq ($(OS
), FreeBSD
)
300 ifeq ($(ENABLE_TCL
),1)
301 TCL_VERSION ?
= tcl
$(shell bash
-c
"tclsh <(echo 'puts [info tclversion]')")
302 ifeq ($(OS
), FreeBSD
)
303 TCL_INCLUDE ?
= /usr
/local
/include/$(TCL_VERSION
)
305 TCL_INCLUDE ?
= /usr
/include/$(TCL_VERSION
)
309 CXXFLAGS
+= -DYOSYS_ENABLE_TCL
310 LDLIBS
+= -ltcl86
-lwsock32
-lws2_32
-lnetapi32
-lz
312 CXXFLAGS
+= $(shell PKG_CONFIG_PATH
=$(PKG_CONFIG_PATH
) $(PKG_CONFIG
) --silence-errors
--cflags tcl || echo
-I
$(TCL_INCLUDE
)) -DYOSYS_ENABLE_TCL
313 ifeq ($(OS
), FreeBSD
)
314 # FreeBSD uses tcl8.6, but lib is named "libtcl86"
315 LDLIBS
+= $(shell PKG_CONFIG_PATH
=$(PKG_CONFIG_PATH
) $(PKG_CONFIG
) --silence-errors
--libs tcl || echo
-l
$(TCL_VERSION
) | tr
-d
'.')
317 LDLIBS
+= $(shell PKG_CONFIG_PATH
=$(PKG_CONFIG_PATH
) $(PKG_CONFIG
) --silence-errors
--libs tcl || echo
-l
$(TCL_VERSION
))
322 ifeq ($(ENABLE_GCOV
),1)
323 CXXFLAGS
+= --coverage
324 LDFLAGS
+= --coverage
327 ifeq ($(ENABLE_GPROF
),1)
332 ifeq ($(ENABLE_NDEBUG
),1)
333 CXXFLAGS
:= -O3
-DNDEBUG
$(filter-out -Os
-ggdb
,$(CXXFLAGS
))
336 ifeq ($(ENABLE_DEBUG
),1)
337 ifeq ($(CONFIG
),clang
)
338 CXXFLAGS
:= -O0
-DDEBUG
$(filter-out -Os
,$(CXXFLAGS
))
340 CXXFLAGS
:= -Og
-DDEBUG
$(filter-out -Os
,$(CXXFLAGS
))
344 ifeq ($(ENABLE_ABC
),1)
345 CXXFLAGS
+= -DYOSYS_ENABLE_ABC
347 CXXFLAGS
+= -DYOSYS_LINK_ABC
348 ifeq ($(DISABLE_ABC_THREADS
),0)
352 ifeq ($(ABCEXTERNAL
),)
353 TARGETS
+= yosys-abc
$(EXE
)
358 ifeq ($(ENABLE_VERIFIC
),1)
359 VERIFIC_DIR ?
= /usr
/local
/src
/verific_lib_eval
360 VERIFIC_COMPONENTS ?
= verilog vhdl database util containers sdf hier_tree
361 CXXFLAGS
+= $(patsubst %,-I
$(VERIFIC_DIR
)/%,$(VERIFIC_COMPONENTS
)) -DYOSYS_ENABLE_VERIFIC
363 LDLIBS
+= $(patsubst %,$(VERIFIC_DIR
)/%/*-mac.a
,$(VERIFIC_COMPONENTS
)) -lz
365 LDLIBS
+= $(patsubst %,$(VERIFIC_DIR
)/%/*-linux.a
,$(VERIFIC_COMPONENTS
)) -lz
369 ifeq ($(ENABLE_PROTOBUF
),1)
370 LDLIBS
+= $(shell pkg-config
--cflags --libs protobuf
)
373 ifeq ($(ENABLE_COVER
),1)
374 CXXFLAGS
+= -DYOSYS_ENABLE_COVER
377 define add_share_file
378 EXTRA_TARGETS
+= $(subst //,/,$(1)/$(notdir $(2)))
379 $(subst //,/,$(1)/$(notdir $(2))): $(2)
381 $$(Q
) cp
"$(YOSYS_SRC)"/$(2) $(subst //,/,$(1)/$(notdir $(2)))
384 define add_gen_share_file
385 EXTRA_TARGETS
+= $(subst //,/,$(1)/$(notdir $(2)))
386 $(subst //,/,$(1)/$(notdir $(2))): $(2)
388 $$(Q
) cp
$(2) $(subst //,/,$(1)/$(notdir $(2)))
391 define add_include_file
392 $(eval
$(call add_share_file
,$(dir share
/include/$(1)),$(1)))
398 P_UPDATE
= $(eval P_STATUS
=$(shell echo
$(OBJS
) yosys
$(EXE
) | gawk
'BEGIN { RS = " "; I = $(P_STATUS)+0; } $$1 == "$@" && NR > I { I = NR; } END { print I; }'))
399 P_SHOW
= [$(shell gawk
"BEGIN { N=$(words $(OBJS) yosys$(EXE)); printf \"%3d\", $(P_OFFSET)+90*$(P_STATUS)/N; exit; }")%]
400 P
= @echo
"$(if $(findstring $@,$(TARGETS) $(EXTRA_TARGETS)),$(eval P_OFFSET = 10))$(call P_UPDATE)$(call P_SHOW) Building $@";
410 $(eval
$(call add_include_file
,kernel
/yosys.h
))
411 $(eval
$(call add_include_file
,kernel
/hashlib.h
))
412 $(eval
$(call add_include_file
,kernel
/log.h
))
413 $(eval
$(call add_include_file
,kernel
/rtlil.h
))
414 $(eval
$(call add_include_file
,kernel
/register.h
))
415 $(eval
$(call add_include_file
,kernel
/celltypes.h
))
416 $(eval
$(call add_include_file
,kernel
/celledges.h
))
417 $(eval
$(call add_include_file
,kernel
/consteval.h
))
418 $(eval
$(call add_include_file
,kernel
/sigtools.h
))
419 $(eval
$(call add_include_file
,kernel
/modtools.h
))
420 $(eval
$(call add_include_file
,kernel
/macc.h
))
421 $(eval
$(call add_include_file
,kernel
/utils.h
))
422 $(eval
$(call add_include_file
,kernel
/satgen.h
))
423 $(eval
$(call add_include_file
,libs
/ezsat
/ezsat.h
))
424 $(eval
$(call add_include_file
,libs
/ezsat
/ezminisat.h
))
425 $(eval
$(call add_include_file
,libs
/sha1
/sha1.h
))
426 $(eval
$(call add_include_file
,passes
/fsm
/fsmdata.h
))
427 $(eval
$(call add_include_file
,frontends
/ast
/ast.h
))
428 $(eval
$(call add_include_file
,backends
/ilang
/ilang_backend.h
))
430 OBJS
+= kernel
/driver.o kernel
/register.o kernel
/rtlil.o kernel
/log.o kernel
/calc.o kernel
/yosys.o
431 OBJS
+= kernel
/cellaigs.o kernel
/celledges.o
433 kernel
/log.o
: CXXFLAGS
+= -DYOSYS_SRC
='"$(YOSYS_SRC)"'
434 kernel
/yosys.o
: CXXFLAGS
+= -DYOSYS_DATDIR
='"$(DATDIR)"'
436 OBJS
+= libs
/bigint
/BigIntegerAlgorithms.o libs
/bigint
/BigInteger.o libs
/bigint
/BigIntegerUtils.o
437 OBJS
+= libs
/bigint
/BigUnsigned.o libs
/bigint
/BigUnsignedInABase.o
439 OBJS
+= libs
/sha1
/sha1.o
443 OBJS
+= libs
/subcircuit
/subcircuit.o
445 OBJS
+= libs
/ezsat
/ezsat.o
446 OBJS
+= libs
/ezsat
/ezminisat.o
448 OBJS
+= libs
/minisat
/Options.o
449 OBJS
+= libs
/minisat
/SimpSolver.o
450 OBJS
+= libs
/minisat
/Solver.o
451 OBJS
+= libs
/minisat
/System.o
453 include $(YOSYS_SRC
)/frontends
/*/Makefile.inc
454 include $(YOSYS_SRC
)/passes
/*/Makefile.inc
455 include $(YOSYS_SRC
)/backends
/*/Makefile.inc
456 include $(YOSYS_SRC
)/techlibs
/*/Makefile.inc
460 include frontends
/verilog
/Makefile.inc
461 include frontends
/ilang
/Makefile.inc
462 include frontends
/ast
/Makefile.inc
463 include frontends
/blif
/Makefile.inc
465 OBJS
+= passes
/hierarchy
/hierarchy.o
466 OBJS
+= passes
/cmds
/select.o
467 OBJS
+= passes
/cmds
/show.o
468 OBJS
+= passes
/cmds
/stat.o
469 OBJS
+= passes
/cmds
/cover.o
470 OBJS
+= passes
/cmds
/design.o
471 OBJS
+= passes
/cmds
/plugin.o
473 include passes
/proc
/Makefile.inc
474 include passes
/opt
/Makefile.inc
475 include passes
/techmap
/Makefile.inc
477 include backends
/verilog
/Makefile.inc
478 include backends
/ilang
/Makefile.inc
480 include techlibs
/common
/Makefile.inc
485 OBJS
+= yosys-libabc.a
488 top-all
: $(TARGETS
) $(EXTRA_TARGETS
)
490 @echo
" Build successful."
493 ifeq ($(CONFIG
),emcc
)
494 yosys.js
: $(filter-out yosysjs-
$(YOSYS_VER
).zip
,$(EXTRA_TARGETS
))
498 $(P
) $(LD
) -o yosys
$(EXE
) $(LDFLAGS
) $(OBJS
) $(LDLIBS
)
500 libyosys.so
: $(filter-out kernel
/driver.o
,$(OBJS
))
501 $(P
) $(LD
) -o libyosys.so
-shared
-Wl
,-soname
,libyosys.so
$(LDFLAGS
) $^
$(LDLIBS
)
504 $(Q
) mkdir
-p
$(dir $@
)
505 $(P
) $(CXX
) -o
$@
-c
$(CPPFLAGS
) $(CXXFLAGS
) $<
508 $(Q
) mkdir
-p
$(dir $@
)
509 $(P
) $(CXX
) -o
$@
-c
$(CPPFLAGS
) $(CXXFLAGS
) $<
511 YOSYS_VER_STR
:= Yosys
$(YOSYS_VER
) (git sha1
$(GIT_REV
), $(notdir $(CXX
)) $(shell \
512 $(CXX
) --version | tr
' ()' '\n' | grep
'^[0-9]' | head
-n1
) $(filter -f
% -m
% -O
% -DNDEBUG
,$(CXXFLAGS
)))
514 kernel
/version_
$(GIT_REV
).
cc: $(YOSYS_SRC
)/Makefile
515 $(P
) rm -f kernel
/version_
*.o kernel
/version_
*.d kernel
/version_
*.
cc
516 $(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
518 ifeq ($(ENABLE_VERIFIC
),1)
519 CXXFLAGS_NOVERIFIC
= $(foreach v
,$(CXXFLAGS
),$(if
$(findstring $(VERIFIC_DIR
),$(v
)),,$(v
)))
520 LDLIBS_NOVERIFIC
= $(foreach v
,$(LDLIBS
),$(if
$(findstring $(VERIFIC_DIR
),$(v
)),,$(v
)))
522 CXXFLAGS_NOVERIFIC
= $(CXXFLAGS
)
523 LDLIBS_NOVERIFIC
= $(LDLIBS
)
526 yosys-config
: misc
/yosys-config.in
527 $(P
) $(SED
) -e
's#@CXXFLAGS@#$(subst -I. -I"$(YOSYS_SRC)",-I"$(DATDIR)/include",$(strip $(CXXFLAGS_NOVERIFIC)))#;' \
528 -e
's#@CXX@#$(strip $(CXX))#;' -e
's#@LDFLAGS@#$(strip $(LDFLAGS) $(PLUGIN_LDFLAGS))#;' -e
's#@LDLIBS@#$(strip $(LDLIBS_NOVERIFIC))#;' \
529 -e
's#@BINDIR@#$(strip $(BINDIR))#;' -e
's#@DATDIR@#$(strip $(DATDIR))#;' < $< > yosys-config
530 $(Q
) chmod
+x yosys-config
532 abc
/abc-
$(ABCREV
)$(EXE
) abc
/libabc-
$(ABCREV
).a
:
534 ifneq ($(ABCREV
),default
)
535 $(Q
) if
test -d abc
/.hg
; then \
536 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
; \
538 $(Q
) if
( cd abc
2> /dev
/null
&& ! git diff-index
--quiet HEAD
; ); then \
539 echo
'REEBE: NOP pbagnvaf ybpny zbqvsvpngvbaf! Frg NOPERI=qrsnhyg va Lbflf Znxrsvyr!' | tr
'A-Za-z' 'N-ZA-Mn-za-m'; false
; \
541 $(Q
) if
test "`cd abc 2> /dev/null && git rev-parse --short HEAD`" != "$(ABCREV)"; then \
542 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; }; \
543 echo
"Pulling ABC from $(ABCURL):"; set
-x
; \
544 test -d abc || git clone
$(ABCURL
) abc
; \
545 cd abc
&& $(MAKE
) DEP
= clean && git fetch
origin master
&& git checkout
$(ABCREV
); \
548 $(Q
) rm -f abc
/abc-
[0-9a-f
]*
549 $(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
)
551 ifeq ($(ABCREV
),default
)
552 .PHONY
: abc
/abc-
$(ABCREV
)$(EXE
)
553 .PHONY
: abc
/libabc-
$(ABCREV
).a
556 yosys-abc
$(EXE
): abc
/abc-
$(ABCREV
)$(EXE
)
557 $(P
) cp abc
/abc-
$(ABCREV
)$(EXE
) yosys-abc
$(EXE
)
559 yosys-libabc.a
: abc
/libabc-
$(ABCREV
).a
560 $(P
) cp abc
/libabc-
$(ABCREV
).a yosys-libabc.a
568 test: $(TARGETS
) $(EXTRA_TARGETS
)
569 +cd tests
/simple
&& bash run-test.sh
$(SEEDOPT
)
570 +cd tests
/hana
&& bash run-test.sh
$(SEEDOPT
)
571 +cd tests
/asicworld
&& bash run-test.sh
$(SEEDOPT
)
572 +cd tests
/realmath
&& bash run-test.sh
$(SEEDOPT
)
573 +cd tests
/share
&& bash run-test.sh
$(SEEDOPT
)
574 +cd tests
/fsm
&& bash run-test.sh
$(SEEDOPT
)
575 +cd tests
/techmap
&& bash run-test.sh
576 +cd tests
/memories
&& bash run-test.sh
$(SEEDOPT
)
577 +cd tests
/bram
&& bash run-test.sh
$(SEEDOPT
)
578 +cd tests
/various
&& bash run-test.sh
579 +cd tests
/sat
&& bash run-test.sh
580 +cd tests
/svinterfaces
&& bash run-test.sh
$(SEEDOPT
)
582 @echo
" Passed \"make test\"."
585 VALGRIND ?
= valgrind
--error-exitcode
=1 --leak-check
=full
--show-reachable
=yes
--errors-for-leak-kinds
=all
587 vgtest
: $(TARGETS
) $(EXTRA_TARGETS
)
588 $(VALGRIND
) .
/yosys
-p
'setattr -mod -unset top; synth' $$( ls tests
/simple
/*.v | grep
-v repwhile.v
)
590 @echo
" Passed \"make vgtest\"."
593 vloghtb
: $(TARGETS
) $(EXTRA_TARGETS
)
594 +cd tests
/vloghtb
&& bash run-test.sh
596 @echo
" Passed \"make vloghtb\"."
599 ystests
: $(TARGETS
) $(EXTRA_TARGETS
)
601 git clone https
://github.com
/YosysHQ
/yosys-tests.git tests
/ystests
602 +$(MAKE
) PATH
="$$PWD:$$PATH" -C tests
/ystests
604 @echo
" Finished \"make ystests\"."
608 unit-test
: libyosys.so
609 @
$(MAKE
) -C
$(UNITESTPATH
) CXX
="$(CXX)" CPPFLAGS
="$(CPPFLAGS)" \
610 CXXFLAGS
="$(CXXFLAGS)" LDLIBS
="$(LDLIBS)" ROOTPATH
="$(CURDIR)"
613 @
$(MAKE
) -C
$(UNITESTPATH
) clean
615 install: $(TARGETS
) $(EXTRA_TARGETS
)
616 $(INSTALL_SUDO
) mkdir
-p
$(DESTDIR
)$(BINDIR
)
617 $(INSTALL_SUDO
) cp
$(TARGETS
) $(DESTDIR
)$(BINDIR
)
618 ifneq ($(filter yosys
,$(TARGETS
)),)
619 $(INSTALL_SUDO
) $(STRIP
) -S
$(DESTDIR
)$(BINDIR
)/yosys
621 ifneq ($(filter yosys-abc
,$(TARGETS
)),)
622 $(INSTALL_SUDO
) $(STRIP
) $(DESTDIR
)$(BINDIR
)/yosys-abc
624 ifneq ($(filter yosys-filterlib
,$(TARGETS
)),)
625 $(INSTALL_SUDO
) $(STRIP
) $(DESTDIR
)$(BINDIR
)/yosys-filterlib
627 $(INSTALL_SUDO
) mkdir
-p
$(DESTDIR
)$(DATDIR
)
628 $(INSTALL_SUDO
) cp
-r share
/.
$(DESTDIR
)$(DATDIR
)/.
629 ifeq ($(ENABLE_LIBYOSYS
),1)
630 $(INSTALL_SUDO
) cp libyosys.so
$(DESTDIR
)$(LIBDIR
)
631 $(INSTALL_SUDO
) $(STRIP
) -S
$(DESTDIR
)$(LIBDIR
)/libyosys.so
632 $(INSTALL_SUDO
) ldconfig
636 $(INSTALL_SUDO
) rm -vf
$(addprefix $(DESTDIR
)$(BINDIR
)/,$(notdir $(TARGETS
)))
637 $(INSTALL_SUDO
) rm -rvf
$(DESTDIR
)$(DATDIR
)
638 ifeq ($(ENABLE_LIBYOSYS
),1)
639 $(INSTALL_SUDO
) rm -vf
$(DESTDIR
)$(LIBDIR
)/libyosys.so
642 update-manual
: $(TARGETS
) $(EXTRA_TARGETS
)
643 cd manual
&& ..
/yosys
-p
'help -write-tex-command-reference-manual'
645 manual
: $(TARGETS
) $(EXTRA_TARGETS
)
646 cd manual
&& bash appnotes.sh
647 cd manual
&& bash presentation.sh
648 cd manual
&& bash manual.sh
652 if
test -d manual
; then cd manual
&& sh
clean.sh
; fi
653 rm -f
$(OBJS
) $(GENFILES
) $(TARGETS
) $(EXTRA_TARGETS
) $(EXTRA_OBJS
)
654 rm -f kernel
/version_
*.o kernel
/version_
*.
cc abc
/abc-
[0-9a-f
]* abc
/libabc-
[0-9a-f
]*.a
655 rm -f libs
/*/*.d frontends
/*/*.d passes
/*/*.d backends
/*/*.d kernel
/*.d techlibs
/*/*.d
656 rm -rf tests
/asicworld
/*.out tests
/asicworld
/*.log
657 rm -rf tests
/hana
/*.out tests
/hana
/*.log
658 rm -rf tests
/simple
/*.out tests
/simple
/*.log
659 rm -rf tests
/memories
/*.out tests
/memories
/*.log tests
/memories
/*.dmp
660 rm -rf tests
/sat
/*.log tests
/techmap
/*.log tests
/various
/*.log
661 rm -rf tests
/bram
/temp tests
/fsm
/temp tests
/realmath
/temp tests
/share
/temp tests
/smv
/temp
662 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_
*
663 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
664 rm -f tests
/tools
/cmp_tbdata
667 $(MAKE
) -C abc DEP
= clean
668 rm -f yosys-abc
$(EXE
) yosys-libabc.a abc
/abc-
[0-9a-f
]* abc
/libabc-
[0-9a-f
]*.a
674 .
/yosys
-qp
'help; help -all'
675 rm -rf coverage.
info coverage_html
676 lcov
--capture
-d .
--no-external
-o coverage.
info
677 genhtml coverage.
info --output-directory coverage_html
680 { for file in
$(basename $(OBJS
)); do \
681 for
prefix in
cc y l
; do if
[ -f
$${file}.
$${prefix} ]; then echo
$$file.
$${prefix}; fi
; done \
682 done
; find backends frontends kernel libs passes
-type f \
( -name
'*.h' -o
-name
'*.hh' \
); } > qtcreator.files
683 { echo .
; find backends frontends kernel libs passes
-type f \
( -name
'*.h' -o
-name
'*.hh' \
) -printf
'%h\n' |
sort -u
; } > qtcreator.includes
684 touch qtcreator.config qtcreator.creator
686 vcxsrc
: $(GENFILES
) $(EXTRA_TARGETS
)
687 rm -rf yosys-win32-vcxsrc-
$(YOSYS_VER
){,.zip
}
688 set
-e
; for f in
`ls $(filter %.cc %.cpp,$(GENFILES)) $(addsuffix .cc,$(basename $(OBJS))) $(addsuffix .cpp,$(basename $(OBJS))) 2> /dev/null`; do \
689 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
690 bash misc
/create_vcxsrc.sh yosys-win32-vcxsrc
$(YOSYS_VER
) $(GIT_REV
)
691 echo
"namespace Yosys { extern const char *yosys_version_str; const char *yosys_version_str=\"Yosys (Version Information Unavailable)\"; }" > kernel
/version.
cc
692 zip yosys-win32-vcxsrc-
$(YOSYS_VER
)/genfiles.zip
$(GENFILES
) kernel
/version.
cc
693 zip
-r yosys-win32-vcxsrc-
$(YOSYS_VER
).zip yosys-win32-vcxsrc-
$(YOSYS_VER
)/
694 rm -f srcfiles.txt kernel
/version.
cc
697 mxebin
: $(TARGETS
) $(EXTRA_TARGETS
)
698 rm -rf yosys-win32-mxebin-
$(YOSYS_VER
){,.zip
}
699 mkdir
-p yosys-win32-mxebin-
$(YOSYS_VER
)
700 cp
-r yosys.exe share
/ yosys-win32-mxebin-
$(YOSYS_VER
)/
701 ifeq ($(ENABLE_ABC
),1)
702 cp
-r yosys-abc.exe abc
/lib
/x86
/pthreadVC2.dll yosys-win32-mxebin-
$(YOSYS_VER
)/
704 echo
-en
'This is Yosys $(YOSYS_VER) for Win32.\r\n' > yosys-win32-mxebin-
$(YOSYS_VER
)/readme.txt
705 echo
-en
'Documentation at http://www.clifford.at/yosys/.\r\n' >> yosys-win32-mxebin-
$(YOSYS_VER
)/readme.txt
706 zip
-r yosys-win32-mxebin-
$(YOSYS_VER
).zip yosys-win32-mxebin-
$(YOSYS_VER
)/
713 echo
'CONFIG := clang' > Makefile.conf
716 echo
'CONFIG := gcc' > Makefile.conf
718 config-gcc-static
: clean
719 echo
'CONFIG := gcc-static' > Makefile.conf
720 echo
'ENABLE_PLUGINS := 0' >> Makefile.conf
721 echo
'ENABLE_READLINE := 0' >> Makefile.conf
722 echo
'ENABLE_TCL := 0' >> Makefile.conf
724 config-gcc-4.8
: clean
725 echo
'CONFIG := gcc-4.8' > Makefile.conf
728 echo
'CONFIG := emcc' > Makefile.conf
729 echo
'ENABLE_TCL := 0' >> Makefile.conf
730 echo
'ENABLE_ABC := 0' >> Makefile.conf
731 echo
'ENABLE_PLUGINS := 0' >> Makefile.conf
732 echo
'ENABLE_READLINE := 0' >> Makefile.conf
735 echo
'CONFIG := mxe' > Makefile.conf
736 echo
'ENABLE_PLUGINS := 0' >> Makefile.conf
739 echo
'CONFIG := msys2' > Makefile.conf
741 config-msys2-64
: clean
742 echo
'CONFIG := msys2-64' > Makefile.conf
745 echo
'CONFIG := cygwin' > Makefile.conf
748 echo
'CONFIG := gcc' > Makefile.conf
749 echo
'ENABLE_GCOV := 1' >> Makefile.conf
750 echo
'ENABLE_DEBUG := 1' >> Makefile.conf
753 echo
'CONFIG := gcc' > Makefile.conf
754 echo
'ENABLE_GPROF := 1' >> Makefile.conf
757 echo
"INSTALL_SUDO := sudo" >> Makefile.conf
766 -include frontends
/*/*.d
767 -include passes
/*/*.d
768 -include backends
/*/*.d
770 -include techlibs
/*/*.d
772 .PHONY
: all top-all abc
test install install-abc manual
clean mrproper qtcreator coverage vcxsrc mxebin
773 .PHONY
: config-clean config-clang config-gcc config-gcc-static config-gcc-4.8 config-gprof config-sudo