9 # features (the more the better)
24 # other configuration flags
31 # Needed for environments that don't have proper thread support (i.e. emscripten)
32 DISABLE_ABC_THREADS
:= 0
38 # SANITIZER = undefined
42 OS
:= $(shell uname
-s
)
46 BINDIR
:= $(PREFIX
)/bin
47 LIBDIR
:= $(PREFIX
)/lib
48 DATDIR
:= $(PREFIX
)/share
/yosys
55 TARGETS
= yosys
$(EXE
) yosys-config
61 UNITESTPATH
:= tests
/unit
65 YOSYS_SRC
:= $(dir $(firstword $(MAKEFILE_LIST
)))
68 CXXFLAGS
:= $(CXXFLAGS
) -Wall
-Wextra
-ggdb
-I.
-I
"$(YOSYS_SRC)" -MD
-D_YOSYS_
-fPIC
-I
$(PREFIX
)/include
69 LDFLAGS
:= $(LDFLAGS
) -L
$(LIBDIR
)
70 LDLIBS
:= $(LDLIBS
) -lstdc
++ -lm
73 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.7+$(shell cd
$(YOSYS_SRC
) && test -e .git
&& { git log
--author
=clifford@clifford.at
--oneline
61f6811.. | 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-4.8
)
165 CXXFLAGS
+= -std
=c
++11 -Os
166 ABCMKARGS
+= ARCHFLAGS
="-DABC_USE_STDINT_H"
168 else ifeq ($(CONFIG
),emcc
)
171 CXXFLAGS
:= -std
=c
++11 $(filter-out -fPIC
-ggdb
,$(CXXFLAGS
))
172 ABCMKARGS
+= ARCHFLAGS
="-DABC_USE_STDINT_H -DABC_MEMALIGN=8"
173 EMCCFLAGS
:= -Os
-Wno-warn-absolute-paths
174 EMCCFLAGS
+= --memory-init-file
0 --embed-file share
-s NO_EXIT_RUNTIME
=1
175 EMCCFLAGS
+= -s EXPORTED_FUNCTIONS
="['_main','_run','_prompt','_errmsg']"
176 EMCCFLAGS
+= -s TOTAL_MEMORY
=128*1024*1024
177 # https://github.com/kripken/emscripten/blob/master/src/settings.js
178 CXXFLAGS
+= $(EMCCFLAGS
)
179 LDFLAGS
+= $(EMCCFLAGS
)
183 TARGETS
:= $(filter-out yosys-config
,$(TARGETS
))
184 EXTRA_TARGETS
+= yosysjs-
$(YOSYS_VER
).zip
186 ifeq ($(ENABLE_ABC
),1)
188 DISABLE_ABC_THREADS
:= 1
192 wget
-O viz.js.part https
://github.com
/mdaines
/viz.js
/releases
/download
/0.0.3/viz.js
193 mv viz.js.part viz.js
195 yosysjs-
$(YOSYS_VER
).zip
: yosys.js viz.js misc
/yosysjs
/*
196 rm -rf yosysjs-
$(YOSYS_VER
) yosysjs-
$(YOSYS_VER
).zip
197 mkdir
-p yosysjs-
$(YOSYS_VER
)
198 cp viz.js misc
/yosysjs
/* yosys.js yosysjs-
$(YOSYS_VER
)/
199 zip
-r yosysjs-
$(YOSYS_VER
).zip yosysjs-
$(YOSYS_VER
)
201 yosys.html
: misc
/yosys.html
202 $(P
) cp misc
/yosys.html yosys.html
204 else ifeq ($(CONFIG
),mxe
)
205 PKG_CONFIG
= /usr
/local
/src
/mxe
/usr
/bin
/i686-w64-mingw32.static-pkg-config
206 CXX
= /usr
/local
/src
/mxe
/usr
/bin
/i686-w64-mingw32.static-gcc
207 LD
= /usr
/local
/src
/mxe
/usr
/bin
/i686-w64-mingw32.static-gcc
208 CXXFLAGS
+= -std
=c
++11 -Os
-D_POSIX_SOURCE
-DYOSYS_MXE_HACKS
-Wno-attributes
209 CXXFLAGS
:= $(filter-out -fPIC
,$(CXXFLAGS
))
210 LDFLAGS
:= $(filter-out -rdynamic
,$(LDFLAGS
)) -s
211 LDLIBS
:= $(filter-out -lrt
,$(LDLIBS
))
212 ABCMKARGS
+= ARCHFLAGS
="-DABC_USE_STDINT_H -DWIN32_NO_DLL -DHAVE_STRUCT_TIMESPEC -fpermissive -w"
213 ABCMKARGS
+= LIBS
="lib/x86/pthreadVC2.lib -s" ABC_USE_NO_READLINE
=1
216 else ifeq ($(CONFIG
),msys2
)
217 CXX
= i686-w64-mingw32-g
++
218 LD
= i686-w64-mingw32-g
++
219 CXXFLAGS
+= -std
=c
++11 -Os
-D_POSIX_SOURCE
-DYOSYS_WIN32_UNIX_DIR
220 CXXFLAGS
:= $(filter-out -fPIC
,$(CXXFLAGS
))
221 LDFLAGS
:= $(filter-out -rdynamic
,$(LDFLAGS
)) -s
222 LDLIBS
:= $(filter-out -lrt
,$(LDLIBS
))
223 ABCMKARGS
+= ARCHFLAGS
="-DABC_USE_STDINT_H -DWIN32_NO_DLL -DHAVE_STRUCT_TIMESPEC -fpermissive -w"
224 ABCMKARGS
+= LIBS
="lib/x86/pthreadVC2.lib -s" ABC_USE_NO_READLINE
=0
227 else ifneq ($(CONFIG
),none
)
228 $(error Invalid CONFIG setting
'$(CONFIG)'. Valid values
: clang
, gcc
, gcc-4.8
, emcc
, mxe
, msys2
)
231 ifeq ($(ENABLE_LIBYOSYS
),1)
232 TARGETS
+= libyosys.so
235 ifeq ($(ENABLE_PYTHON
),1)
236 LDLIBS
+= -lpython
$(PYTHON_VERSION
)m
-lboost_python-py
$(subst .
,,$(PYTHON_VERSION
)) -lboost_system
237 CXXFLAGS
+= -I
/usr
/include/python
$(PYTHON_VERSION
) -D WITH_PYTHON
238 OBJS
+= kernel
/python_wrappers.o
241 ifeq ($(ENABLE_READLINE
),1)
242 CXXFLAGS
+= -DYOSYS_ENABLE_READLINE
243 ifeq ($(OS
), FreeBSD
)
244 CXXFLAGS
+= -I
/usr
/local
/include
247 ifeq ($(LINK_CURSES
),1)
249 ABCMKARGS
+= "ABC_READLINE_LIBRARIES=-lcurses -lreadline"
251 ifeq ($(LINK_TERMCAP
),1)
253 ABCMKARGS
+= "ABC_READLINE_LIBRARIES=-lreadline -ltermcap"
259 ifeq ($(ENABLE_EDITLINE
),1)
260 CXXFLAGS
+= -DYOSYS_ENABLE_EDITLINE
261 LDLIBS
+= -ledit
-ltinfo
-lbsd
263 ABCMKARGS
+= "ABC_USE_NO_READLINE=1"
267 ifeq ($(DISABLE_ABC_THREADS
),1)
268 ABCMKARGS
+= "ABC_USE_NO_PTHREADS=1"
271 ifeq ($(ENABLE_PLUGINS
),1)
272 CXXFLAGS
+= $(shell PKG_CONFIG_PATH
=$(PKG_CONFIG_PATH
) $(PKG_CONFIG
) --silence-errors
--cflags libffi
) -DYOSYS_ENABLE_PLUGINS
273 LDLIBS
+= $(shell PKG_CONFIG_PATH
=$(PKG_CONFIG_PATH
) $(PKG_CONFIG
) --silence-errors
--libs libffi || echo
-lffi
)
274 ifneq ($(OS
), FreeBSD
)
279 ifeq ($(ENABLE_TCL
),1)
280 TCL_VERSION ?
= tcl
$(shell bash
-c
"tclsh <(echo 'puts [info tclversion]')")
281 ifeq ($(OS
), FreeBSD
)
282 TCL_INCLUDE ?
= /usr
/local
/include/$(TCL_VERSION
)
284 TCL_INCLUDE ?
= /usr
/include/$(TCL_VERSION
)
288 CXXFLAGS
+= -DYOSYS_ENABLE_TCL
289 LDLIBS
+= -ltcl86
-lwsock32
-lws2_32
-lnetapi32
291 CXXFLAGS
+= $(shell PKG_CONFIG_PATH
=$(PKG_CONFIG_PATH
) $(PKG_CONFIG
) --silence-errors
--cflags tcl || echo
-I
$(TCL_INCLUDE
)) -DYOSYS_ENABLE_TCL
292 ifeq ($(OS
), FreeBSD
)
293 # FreeBSD uses tcl8.6, but lib is named "libtcl86"
294 LDLIBS
+= $(shell PKG_CONFIG_PATH
=$(PKG_CONFIG_PATH
) $(PKG_CONFIG
) --silence-errors
--libs tcl || echo
-l
$(TCL_VERSION
) | tr
-d
'.')
296 LDLIBS
+= $(shell PKG_CONFIG_PATH
=$(PKG_CONFIG_PATH
) $(PKG_CONFIG
) --silence-errors
--libs tcl || echo
-l
$(TCL_VERSION
))
301 ifeq ($(ENABLE_GPROF
),1)
306 ifeq ($(ENABLE_NDEBUG
),1)
307 CXXFLAGS
:= -O3
-DNDEBUG
$(filter-out -Os
-ggdb
,$(CXXFLAGS
))
310 ifeq ($(ENABLE_DEBUG
),1)
311 ifeq ($(CONFIG
),clang
)
312 CXXFLAGS
:= -O0
-DDEBUG
$(filter-out -Os
,$(CXXFLAGS
))
314 CXXFLAGS
:= -Og
-DDEBUG
$(filter-out -Os
,$(CXXFLAGS
))
318 ifeq ($(ENABLE_ABC
),1)
319 CXXFLAGS
+= -DYOSYS_ENABLE_ABC
321 CXXFLAGS
+= -DYOSYS_LINK_ABC
322 ifeq ($(DISABLE_ABC_THREADS
),0)
326 ifeq ($(ABCEXTERNAL
),)
327 TARGETS
+= yosys-abc
$(EXE
)
332 ifeq ($(ENABLE_VERIFIC
),1)
333 VERIFIC_DIR ?
= /usr
/local
/src
/verific_lib_eval
334 VERIFIC_COMPONENTS ?
= verilog vhdl database util containers sdf hier_tree
335 CXXFLAGS
+= $(patsubst %,-I
$(VERIFIC_DIR
)/%,$(VERIFIC_COMPONENTS
)) -DYOSYS_ENABLE_VERIFIC
336 LDLIBS
+= $(patsubst %,$(VERIFIC_DIR
)/%/*-linux.a
,$(VERIFIC_COMPONENTS
)) -lz
339 ifeq ($(ENABLE_PROTOBUF
),1)
340 LDLIBS
+= $(shell pkg-config
--cflags --libs protobuf
)
343 ifeq ($(ENABLE_COVER
),1)
344 CXXFLAGS
+= -DYOSYS_ENABLE_COVER
347 define add_share_file
348 EXTRA_TARGETS
+= $(subst //,/,$(1)/$(notdir $(2)))
349 $(subst //,/,$(1)/$(notdir $(2))): $(2)
351 $$(Q
) cp
"$(YOSYS_SRC)"/$(2) $(subst //,/,$(1)/$(notdir $(2)))
354 define add_gen_share_file
355 EXTRA_TARGETS
+= $(subst //,/,$(1)/$(notdir $(2)))
356 $(subst //,/,$(1)/$(notdir $(2))): $(2)
358 $$(Q
) cp
$(2) $(subst //,/,$(1)/$(notdir $(2)))
361 define add_include_file
362 $(eval
$(call add_share_file
,$(dir share
/include/$(1)),$(1)))
368 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; }'))
369 P_SHOW
= [$(shell gawk
"BEGIN { N=$(words $(OBJS) yosys$(EXE)); printf \"%3d\", $(P_OFFSET)+90*$(P_STATUS)/N; exit; }")%]
370 P
= @echo
"$(if $(findstring $@,$(TARGETS) $(EXTRA_TARGETS)),$(eval P_OFFSET = 10))$(call P_UPDATE)$(call P_SHOW) Building $@";
380 $(eval
$(call add_include_file
,kernel
/yosys.h
))
381 $(eval
$(call add_include_file
,kernel
/hashlib.h
))
382 $(eval
$(call add_include_file
,kernel
/log.h
))
383 $(eval
$(call add_include_file
,kernel
/rtlil.h
))
384 $(eval
$(call add_include_file
,kernel
/register.h
))
385 $(eval
$(call add_include_file
,kernel
/celltypes.h
))
386 $(eval
$(call add_include_file
,kernel
/celledges.h
))
387 $(eval
$(call add_include_file
,kernel
/consteval.h
))
388 $(eval
$(call add_include_file
,kernel
/sigtools.h
))
389 $(eval
$(call add_include_file
,kernel
/modtools.h
))
390 $(eval
$(call add_include_file
,kernel
/macc.h
))
391 $(eval
$(call add_include_file
,kernel
/utils.h
))
392 $(eval
$(call add_include_file
,kernel
/satgen.h
))
393 $(eval
$(call add_include_file
,libs
/ezsat
/ezsat.h
))
394 $(eval
$(call add_include_file
,libs
/ezsat
/ezminisat.h
))
395 $(eval
$(call add_include_file
,libs
/sha1
/sha1.h
))
396 $(eval
$(call add_include_file
,passes
/fsm
/fsmdata.h
))
397 $(eval
$(call add_include_file
,frontends
/ast
/ast.h
))
398 $(eval
$(call add_include_file
,backends
/ilang
/ilang_backend.h
))
400 OBJS
+= kernel
/driver.o kernel
/register.o kernel
/rtlil.o kernel
/log.o kernel
/calc.o kernel
/yosys.o
401 OBJS
+= kernel
/cellaigs.o kernel
/celledges.o
403 kernel
/log.o
: CXXFLAGS
+= -DYOSYS_SRC
='"$(YOSYS_SRC)"'
404 kernel
/yosys.o
: CXXFLAGS
+= -DYOSYS_DATDIR
='"$(DATDIR)"'
406 OBJS
+= libs
/bigint
/BigIntegerAlgorithms.o libs
/bigint
/BigInteger.o libs
/bigint
/BigIntegerUtils.o
407 OBJS
+= libs
/bigint
/BigUnsigned.o libs
/bigint
/BigUnsignedInABase.o
409 OBJS
+= libs
/sha1
/sha1.o
413 OBJS
+= libs
/subcircuit
/subcircuit.o
415 OBJS
+= libs
/ezsat
/ezsat.o
416 OBJS
+= libs
/ezsat
/ezminisat.o
418 OBJS
+= libs
/minisat
/Options.o
419 OBJS
+= libs
/minisat
/SimpSolver.o
420 OBJS
+= libs
/minisat
/Solver.o
421 OBJS
+= libs
/minisat
/System.o
423 include $(YOSYS_SRC
)/frontends
/*/Makefile.inc
424 include $(YOSYS_SRC
)/passes
/*/Makefile.inc
425 include $(YOSYS_SRC
)/backends
/*/Makefile.inc
426 include $(YOSYS_SRC
)/techlibs
/*/Makefile.inc
430 include frontends
/verilog
/Makefile.inc
431 include frontends
/ilang
/Makefile.inc
432 include frontends
/ast
/Makefile.inc
433 include frontends
/blif
/Makefile.inc
435 OBJS
+= passes
/hierarchy
/hierarchy.o
436 OBJS
+= passes
/cmds
/select.o
437 OBJS
+= passes
/cmds
/show.o
438 OBJS
+= passes
/cmds
/stat.o
439 OBJS
+= passes
/cmds
/cover.o
440 OBJS
+= passes
/cmds
/design.o
441 OBJS
+= passes
/cmds
/plugin.o
443 include passes
/proc
/Makefile.inc
444 include passes
/opt
/Makefile.inc
445 include passes
/techmap
/Makefile.inc
447 include backends
/verilog
/Makefile.inc
448 include backends
/ilang
/Makefile.inc
450 include techlibs
/common
/Makefile.inc
455 OBJS
+= yosys-libabc.a
458 top-all
: $(TARGETS
) $(EXTRA_TARGETS
)
460 @echo
" Build successful."
463 ifeq ($(CONFIG
),emcc
)
464 yosys.js
: $(filter-out yosysjs-
$(YOSYS_VER
).zip
,$(EXTRA_TARGETS
))
468 $(P
) $(LD
) -o yosys
$(EXE
) $(LDFLAGS
) $(OBJS
) $(LDLIBS
)
470 libyosys.so
: $(filter-out kernel
/driver.o
,$(OBJS
))
471 $(P
) $(LD
) -o libyosys.so
-shared
-Wl
,-soname
,libyosys.so
$(LDFLAGS
) $^
$(LDLIBS
)
474 $(Q
) mkdir
-p
$(dir $@
)
475 $(P
) $(CXX
) -o
$@
-c
$(CPPFLAGS
) $(CXXFLAGS
) $<
478 $(Q
) mkdir
-p
$(dir $@
)
479 $(P
) $(CXX
) -o
$@
-c
$(CPPFLAGS
) $(CXXFLAGS
) $<
481 YOSYS_VER_STR
:= Yosys
$(YOSYS_VER
) (git sha1
$(GIT_REV
), $(notdir $(CXX
)) $(shell \
482 $(CXX
) --version | tr
' ()' '\n' | grep
'^[0-9]' | head
-n1
) $(filter -f
% -m
% -O
% -DNDEBUG
,$(CXXFLAGS
)))
484 kernel
/version_
$(GIT_REV
).
cc: $(YOSYS_SRC
)/Makefile
485 $(P
) rm -f kernel
/version_
*.o kernel
/version_
*.d kernel
/version_
*.
cc
486 $(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
488 ifeq ($(ENABLE_VERIFIC
),1)
489 CXXFLAGS_NOVERIFIC
= $(foreach v
,$(CXXFLAGS
),$(if
$(findstring $(VERIFIC_DIR
),$(v
)),,$(v
)))
490 LDLIBS_NOVERIFIC
= $(foreach v
,$(LDLIBS
),$(if
$(findstring $(VERIFIC_DIR
),$(v
)),,$(v
)))
492 CXXFLAGS_NOVERIFIC
= $(CXXFLAGS
)
493 LDLIBS_NOVERIFIC
= $(LDLIBS
)
496 yosys-config
: misc
/yosys-config.in
497 $(P
) $(SED
) -e
's#@CXXFLAGS@#$(subst -I. -I"$(YOSYS_SRC)",-I"$(DATDIR)/include",$(strip $(CXXFLAGS_NOVERIFIC)))#;' \
498 -e
's#@CXX@#$(strip $(CXX))#;' -e
's#@LDFLAGS@#$(strip $(LDFLAGS) $(PLUGIN_LDFLAGS))#;' -e
's#@LDLIBS@#$(strip $(LDLIBS_NOVERIFIC))#;' \
499 -e
's#@BINDIR@#$(strip $(BINDIR))#;' -e
's#@DATDIR@#$(strip $(DATDIR))#;' < $< > yosys-config
500 $(Q
) chmod
+x yosys-config
502 abc
/abc-
$(ABCREV
)$(EXE
) abc
/libabc-
$(ABCREV
).a
:
504 ifneq ($(ABCREV
),default
)
505 $(Q
) if
test -d abc
/.hg
; then \
506 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
; \
508 $(Q
) if
( cd abc
2> /dev
/null
&& ! git diff-index
--quiet HEAD
; ); then \
509 echo
'REEBE: NOP pbagnvaf ybpny zbqvsvpngvbaf! Frg NOPERI=qrsnhyg va Lbflf Znxrsvyr!' | tr
'A-Za-z' 'N-ZA-Mn-za-m'; false
; \
511 $(Q
) if
test "`cd abc 2> /dev/null && git rev-parse --short HEAD`" != "$(ABCREV)"; then \
512 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; }; \
513 echo
"Pulling ABC from $(ABCURL):"; set
-x
; \
514 test -d abc || git clone
$(ABCURL
) abc
; \
515 cd abc
&& $(MAKE
) DEP
= clean && git fetch
origin master
&& git checkout
$(ABCREV
); \
518 $(Q
) rm -f abc
/abc-
[0-9a-f
]*
519 $(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
)
521 ifeq ($(ABCREV
),default
)
522 .PHONY
: abc
/abc-
$(ABCREV
)$(EXE
)
523 .PHONY
: abc
/libabc-
$(ABCREV
).a
526 yosys-abc
$(EXE
): abc
/abc-
$(ABCREV
)$(EXE
)
527 $(P
) cp abc
/abc-
$(ABCREV
)$(EXE
) yosys-abc
$(EXE
)
529 yosys-libabc.a
: abc
/libabc-
$(ABCREV
).a
530 $(P
) cp abc
/libabc-
$(ABCREV
).a yosys-libabc.a
538 test: $(TARGETS
) $(EXTRA_TARGETS
)
539 +cd tests
/simple
&& bash run-test.sh
$(SEEDOPT
)
540 +cd tests
/hana
&& bash run-test.sh
$(SEEDOPT
)
541 +cd tests
/asicworld
&& bash run-test.sh
$(SEEDOPT
)
542 +cd tests
/realmath
&& bash run-test.sh
$(SEEDOPT
)
543 +cd tests
/share
&& bash run-test.sh
$(SEEDOPT
)
544 +cd tests
/fsm
&& bash run-test.sh
$(SEEDOPT
)
545 +cd tests
/techmap
&& bash run-test.sh
546 +cd tests
/memories
&& bash run-test.sh
$(SEEDOPT
)
547 +cd tests
/bram
&& bash run-test.sh
$(SEEDOPT
)
548 +cd tests
/various
&& bash run-test.sh
549 +cd tests
/sat
&& bash run-test.sh
551 @echo
" Passed \"make test\"."
554 VALGRIND ?
= valgrind
--error-exitcode
=1 --leak-check
=full
--show-reachable
=yes
--errors-for-leak-kinds
=all
556 vgtest
: $(TARGETS
) $(EXTRA_TARGETS
)
557 $(VALGRIND
) .
/yosys
-p
'setattr -mod -unset top; synth' $$( ls tests
/simple
/*.v | grep
-v repwhile.v
)
559 @echo
" Passed \"make vgtest\"."
562 vloghtb
: $(TARGETS
) $(EXTRA_TARGETS
)
563 +cd tests
/vloghtb
&& bash run-test.sh
565 @echo
" Passed \"make vloghtb\"."
569 unit-test
: libyosys.so
570 @
$(MAKE
) -C
$(UNITESTPATH
) CXX
="$(CXX)" CPPFLAGS
="$(CPPFLAGS)" \
571 CXXFLAGS
="$(CXXFLAGS)" LDLIBS
="$(LDLIBS)" ROOTPATH
="$(CURDIR)"
574 @
$(MAKE
) -C
$(UNITESTPATH
) clean
576 install: $(TARGETS
) $(EXTRA_TARGETS
)
577 $(INSTALL_SUDO
) mkdir
-p
$(DESTDIR
)$(BINDIR
)
578 $(INSTALL_SUDO
) cp
$(TARGETS
) $(DESTDIR
)$(BINDIR
)
579 ifneq ($(filter yosys
,$(TARGETS
)),)
580 $(INSTALL_SUDO
) $(STRIP
) -S
$(DESTDIR
)$(BINDIR
)/yosys
582 ifneq ($(filter yosys-abc
,$(TARGETS
)),)
583 $(INSTALL_SUDO
) $(STRIP
) $(DESTDIR
)$(BINDIR
)/yosys-abc
585 ifneq ($(filter yosys-filterlib
,$(TARGETS
)),)
586 $(INSTALL_SUDO
) $(STRIP
) $(DESTDIR
)$(BINDIR
)/yosys-filterlib
588 $(INSTALL_SUDO
) mkdir
-p
$(DESTDIR
)$(DATDIR
)
589 $(INSTALL_SUDO
) cp
-r share
/.
$(DESTDIR
)$(DATDIR
)/.
590 ifeq ($(ENABLE_LIBYOSYS
),1)
591 $(INSTALL_SUDO
) cp libyosys.so
$(DESTDIR
)$(LIBDIR
)
592 $(INSTALL_SUDO
) $(STRIP
) -S
$(DESTDIR
)$(LIBDIR
)/libyosys.so
593 $(INSTALL_SUDO
) ldconfig
597 $(INSTALL_SUDO
) rm -vf
$(addprefix $(DESTDIR
)$(BINDIR
)/,$(notdir $(TARGETS
)))
598 $(INSTALL_SUDO
) rm -rvf
$(DESTDIR
)$(DATDIR
)
599 ifeq ($(ENABLE_LIBYOSYS
),1)
600 $(INSTALL_SUDO
) rm -vf
$(DESTDIR
)$(LIBDIR
)/libyosys.so
603 update-manual
: $(TARGETS
) $(EXTRA_TARGETS
)
604 cd manual
&& ..
/yosys
-p
'help -write-tex-command-reference-manual'
606 manual
: $(TARGETS
) $(EXTRA_TARGETS
)
607 cd manual
&& bash appnotes.sh
608 cd manual
&& bash presentation.sh
609 cd manual
&& bash manual.sh
613 if
test -d manual
; then cd manual
&& sh
clean.sh
; fi
614 rm -f
$(OBJS
) $(GENFILES
) $(TARGETS
) $(EXTRA_TARGETS
) $(EXTRA_OBJS
)
615 rm -f kernel
/version_
*.o kernel
/version_
*.
cc abc
/abc-
[0-9a-f
]* abc
/libabc-
[0-9a-f
]*.a
616 rm -f libs
/*/*.d frontends
/*/*.d passes
/*/*.d backends
/*/*.d kernel
/*.d techlibs
/*/*.d
617 rm -rf tests
/asicworld
/*.out tests
/asicworld
/*.log
618 rm -rf tests
/hana
/*.out tests
/hana
/*.log
619 rm -rf tests
/simple
/*.out tests
/simple
/*.log
620 rm -rf tests
/memories
/*.out tests
/memories
/*.log tests
/memories
/*.dmp
621 rm -rf tests
/sat
/*.log tests
/techmap
/*.log tests
/various
/*.log
622 rm -rf tests
/bram
/temp tests
/fsm
/temp tests
/realmath
/temp tests
/share
/temp tests
/smv
/temp
623 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_
*
624 rm -f tests
/tools
/cmp_tbdata
627 $(MAKE
) -C abc DEP
= clean
628 rm -f yosys-abc
$(EXE
) yosys-libabc.a abc
/abc-
[0-9a-f
]* abc
/libabc-
[0-9a-f
]*.a
634 { for file in
$(basename $(OBJS
)); do \
635 for
prefix in
cc y l
; do if
[ -f
$${file}.
$${prefix} ]; then echo
$$file.
$${prefix}; fi
; done \
636 done
; find backends frontends kernel libs passes
-type f \
( -name
'*.h' -o
-name
'*.hh' \
); } > qtcreator.files
637 { echo .
; find backends frontends kernel libs passes
-type f \
( -name
'*.h' -o
-name
'*.hh' \
) -printf
'%h\n' |
sort -u
; } > qtcreator.includes
638 touch qtcreator.config qtcreator.creator
640 vcxsrc
: $(GENFILES
) $(EXTRA_TARGETS
)
641 rm -rf yosys-win32-vcxsrc-
$(YOSYS_VER
){,.zip
}
642 set
-e
; for f in
`ls $(filter %.cc %.cpp,$(GENFILES)) $(addsuffix .cc,$(basename $(OBJS))) $(addsuffix .cpp,$(basename $(OBJS))) 2> /dev/null`; do \
643 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
644 bash misc
/create_vcxsrc.sh yosys-win32-vcxsrc
$(YOSYS_VER
) $(GIT_REV
)
645 echo
"namespace Yosys { extern const char *yosys_version_str; const char *yosys_version_str=\"Yosys (Version Information Unavailable)\"; }" > kernel
/version.
cc
646 zip yosys-win32-vcxsrc-
$(YOSYS_VER
)/genfiles.zip
$(GENFILES
) kernel
/version.
cc
647 zip
-r yosys-win32-vcxsrc-
$(YOSYS_VER
).zip yosys-win32-vcxsrc-
$(YOSYS_VER
)/
648 rm -f srcfiles.txt kernel
/version.
cc
651 mxebin
: $(TARGETS
) $(EXTRA_TARGETS
)
652 rm -rf yosys-win32-mxebin-
$(YOSYS_VER
){,.zip
}
653 mkdir
-p yosys-win32-mxebin-
$(YOSYS_VER
)
654 cp
-r yosys.exe share
/ yosys-win32-mxebin-
$(YOSYS_VER
)/
655 ifeq ($(ENABLE_ABC
),1)
656 cp
-r yosys-abc.exe abc
/lib
/x86
/pthreadVC2.dll yosys-win32-mxebin-
$(YOSYS_VER
)/
658 echo
-en
'This is Yosys $(YOSYS_VER) for Win32.\r\n' > yosys-win32-mxebin-
$(YOSYS_VER
)/readme.txt
659 echo
-en
'Documentation at http://www.clifford.at/yosys/.\r\n' >> yosys-win32-mxebin-
$(YOSYS_VER
)/readme.txt
660 zip
-r yosys-win32-mxebin-
$(YOSYS_VER
).zip yosys-win32-mxebin-
$(YOSYS_VER
)/
667 echo
'CONFIG := clang' > Makefile.conf
670 echo
'CONFIG := gcc' > Makefile.conf
672 config-gcc-4.8
: clean
673 echo
'CONFIG := gcc-4.8' > Makefile.conf
676 echo
'CONFIG := emcc' > Makefile.conf
677 echo
'ENABLE_TCL := 0' >> Makefile.conf
678 echo
'ENABLE_ABC := 0' >> Makefile.conf
679 echo
'ENABLE_PLUGINS := 0' >> Makefile.conf
680 echo
'ENABLE_READLINE := 0' >> Makefile.conf
683 echo
'CONFIG := mxe' > Makefile.conf
684 echo
'ENABLE_PLUGINS := 0' >> Makefile.conf
687 echo
'CONFIG := msys2' > Makefile.conf
690 echo
'CONFIG := gcc' > Makefile.conf
691 echo
'ENABLE_GPROF := 1' >> Makefile.conf
694 echo
"INSTALL_SUDO := sudo" >> Makefile.conf
703 -include frontends
/*/*.d
704 -include passes
/*/*.d
705 -include backends
/*/*.d
707 -include techlibs
/*/*.d
709 .PHONY
: all top-all abc
test install install-abc manual
clean mrproper qtcreator
710 .PHONY
: config-clean config-clang config-gcc config-gcc-4.8 config-gprof config-sudo