9 # features (the more the better)
20 # other configuration flags
27 # Needed for environments that don't have proper thread support (i.e. emscripten)
28 DISABLE_ABC_THREADS
:= 0
34 # SANITIZER = undefined
38 OS
:= $(shell uname
-s
)
42 BINDIR
:= $(PREFIX
)/bin
43 LIBDIR
:= $(PREFIX
)/lib
44 DATDIR
:= $(PREFIX
)/share
/yosys
51 TARGETS
= yosys
$(EXE
) yosys-config
57 UNITESTPATH
:= tests
/unit
61 YOSYS_SRC
:= $(dir $(firstword $(MAKEFILE_LIST
)))
64 CXXFLAGS
:= $(CXXFLAGS
) -Wall
-Wextra
-ggdb
-I.
-I
"$(YOSYS_SRC)" -MD
-D_YOSYS_
-fPIC
-I
$(PREFIX
)/include
65 LDFLAGS
:= $(LDFLAGS
) -L
$(LIBDIR
)
66 LDLIBS
:= $(LDLIBS
) -lstdc
++ -lm
69 PKG_CONFIG ?
= pkg-config
75 PLUGIN_LDFLAGS
+= -undefined dynamic_lookup
77 # homebrew search paths
78 ifneq ($(shell which brew
),)
79 BREW_PREFIX
:= $(shell brew
--prefix)/opt
80 CXXFLAGS
+= -I
$(BREW_PREFIX
)/readline
/include
81 LDFLAGS
+= -L
$(BREW_PREFIX
)/readline
/lib
82 PKG_CONFIG_PATH
:= $(BREW_PREFIX
)/libffi
/lib
/pkgconfig
:$(PKG_CONFIG_PATH
)
83 PKG_CONFIG_PATH
:= $(BREW_PREFIX
)/tcl-tk
/lib
/pkgconfig
:$(PKG_CONFIG_PATH
)
84 export PATH
:= $(BREW_PREFIX
)/bison
/bin
:$(BREW_PREFIX
)/gettext
/bin
:$(BREW_PREFIX
)/flex
/bin
:$(PATH
)
86 # macports search paths
87 else ifneq ($(shell which port
),)
88 PORT_PREFIX
:= $(patsubst %/bin
/port
,%,$(shell which port
))
89 CXXFLAGS
+= -I
$(PORT_PREFIX
)/include
90 LDFLAGS
+= -L
$(PORT_PREFIX
)/lib
91 PKG_CONFIG_PATH
:= $(PORT_PREFIX
)/lib
/pkgconfig
:$(PKG_CONFIG_PATH
)
92 export PATH
:= $(PORT_PREFIX
)/bin
:$(PATH
)
100 YOSYS_VER
:= 0.7+$(shell cd
$(YOSYS_SRC
) && test -e .git
&& { git log
--author
=clifford@clifford.at
--oneline
61f6811.. | wc
-l
; })
101 GIT_REV
:= $(shell cd
$(YOSYS_SRC
) && git rev-parse
--short HEAD
2> /dev
/null || echo UNKNOWN
)
102 OBJS
= kernel
/version_
$(GIT_REV
).o
104 # set 'ABCREV = default' to use abc/ as it is
106 # Note: If you do ABC development, make sure that 'abc' in this directory
107 # is just a symlink to your actual ABC working directory, as 'make mrproper'
108 # will remove the 'abc' directory and you do not want to accidentally
109 # delete your work on ABC..
112 ABCURL ?
= https
://github.com
/berkeley-abc
/abc
113 ABCMKARGS
= CC
="$(CXX)" CXX
="$(CXX)" ABC_USE_LIBSTDCXX
=1
115 # set ABCEXTERNAL = <abc-command> to use an external ABC instance
116 # Note: The in-tree ABC (yosys-abc) will not be installed when ABCEXTERNAL is set.
124 ifneq ($(wildcard Makefile.conf
),)
125 $(info $(subst $$--$$,$(newline
),$(shell sed
's,^,[Makefile.conf] ,; s,$$,$$--$$,;' < Makefile.conf | tr
-d
'\n' | sed
's,\$$--\$$$$,,')))
126 include Makefile.conf
129 ifeq ($(CONFIG
),clang
)
132 CXXFLAGS
+= -std
=c
++11 -Os
133 ABCMKARGS
+= ARCHFLAGS
="-DABC_USE_STDINT_H"
135 ifneq ($(SANITIZER
),)
136 $(info [Clang Sanitizer
] $(SANITIZER
))
137 CXXFLAGS
+= -g
-O1
-fno-omit-frame-pointer
-fno-optimize-sibling-calls
-fsanitize
=$(SANITIZER
)
138 LDFLAGS
+= -g
-fsanitize
=$(SANITIZER
)
139 ifeq ($(SANITIZER
),address
)
142 ifeq ($(SANITIZER
),memory
)
143 CXXFLAGS
+= -fPIE
-fsanitize-memory-track-origins
144 LDFLAGS
+= -fPIE
-fsanitize-memory-track-origins
146 ifeq ($(SANITIZER
),cfi
)
152 else ifeq ($(CONFIG
),gcc
)
155 CXXFLAGS
+= -std
=c
++11 -Os
156 ABCMKARGS
+= ARCHFLAGS
="-DABC_USE_STDINT_H"
158 else ifeq ($(CONFIG
),gcc-4.8
)
161 CXXFLAGS
+= -std
=c
++11 -Os
162 ABCMKARGS
+= ARCHFLAGS
="-DABC_USE_STDINT_H"
164 else ifeq ($(CONFIG
),emcc
)
167 CXXFLAGS
:= -std
=c
++11 $(filter-out -fPIC
-ggdb
,$(CXXFLAGS
))
168 ABCMKARGS
+= ARCHFLAGS
="-DABC_USE_STDINT_H -DABC_MEMALIGN=8"
169 EMCCFLAGS
:= -Os
-Wno-warn-absolute-paths
170 EMCCFLAGS
+= --memory-init-file
0 --embed-file share
-s NO_EXIT_RUNTIME
=1
171 EMCCFLAGS
+= -s EXPORTED_FUNCTIONS
="['_main','_run','_prompt','_errmsg']"
172 EMCCFLAGS
+= -s TOTAL_MEMORY
=128*1024*1024
173 # https://github.com/kripken/emscripten/blob/master/src/settings.js
174 CXXFLAGS
+= $(EMCCFLAGS
)
175 LDFLAGS
+= $(EMCCFLAGS
)
179 TARGETS
:= $(filter-out yosys-config
,$(TARGETS
))
180 EXTRA_TARGETS
+= yosysjs-
$(YOSYS_VER
).zip
182 ifeq ($(ENABLE_ABC
),1)
184 DISABLE_ABC_THREADS
:= 1
188 wget
-O viz.js.part https
://github.com
/mdaines
/viz.js
/releases
/download
/0.0.3/viz.js
189 mv viz.js.part viz.js
191 yosysjs-
$(YOSYS_VER
).zip
: yosys.js viz.js misc
/yosysjs
/*
192 rm -rf yosysjs-
$(YOSYS_VER
) yosysjs-
$(YOSYS_VER
).zip
193 mkdir
-p yosysjs-
$(YOSYS_VER
)
194 cp viz.js misc
/yosysjs
/* yosys.js yosysjs-
$(YOSYS_VER
)/
195 zip
-r yosysjs-
$(YOSYS_VER
).zip yosysjs-
$(YOSYS_VER
)
197 yosys.html
: misc
/yosys.html
198 $(P
) cp misc
/yosys.html yosys.html
200 else ifeq ($(CONFIG
),mxe
)
201 PKG_CONFIG
= /usr
/local
/src
/mxe
/usr
/bin
/i686-w64-mingw32.static-pkg-config
202 CXX
= /usr
/local
/src
/mxe
/usr
/bin
/i686-w64-mingw32.static-gcc
203 LD
= /usr
/local
/src
/mxe
/usr
/bin
/i686-w64-mingw32.static-gcc
204 CXXFLAGS
+= -std
=c
++11 -Os
-D_POSIX_SOURCE
-DYOSYS_MXE_HACKS
-Wno-attributes
205 CXXFLAGS
:= $(filter-out -fPIC
,$(CXXFLAGS
))
206 LDFLAGS
:= $(filter-out -rdynamic
,$(LDFLAGS
)) -s
207 LDLIBS
:= $(filter-out -lrt
,$(LDLIBS
))
208 ABCMKARGS
+= ARCHFLAGS
="-DABC_USE_STDINT_H -DWIN32_NO_DLL -DHAVE_STRUCT_TIMESPEC -fpermissive -w"
209 ABCMKARGS
+= LIBS
="lib/x86/pthreadVC2.lib -s" ABC_USE_NO_READLINE
=1
212 else ifeq ($(CONFIG
),msys2
)
213 CXX
= i686-w64-mingw32-g
++
214 LD
= i686-w64-mingw32-g
++
215 CXXFLAGS
+= -std
=c
++11 -Os
-D_POSIX_SOURCE
-DYOSYS_WIN32_UNIX_DIR
216 CXXFLAGS
:= $(filter-out -fPIC
,$(CXXFLAGS
))
217 LDFLAGS
:= $(filter-out -rdynamic
,$(LDFLAGS
)) -s
218 LDLIBS
:= $(filter-out -lrt
,$(LDLIBS
))
219 ABCMKARGS
+= ARCHFLAGS
="-DABC_USE_STDINT_H -DWIN32_NO_DLL -DHAVE_STRUCT_TIMESPEC -fpermissive -w"
220 ABCMKARGS
+= LIBS
="lib/x86/pthreadVC2.lib -s" ABC_USE_NO_READLINE
=0
223 else ifneq ($(CONFIG
),none
)
224 $(error Invalid CONFIG setting
'$(CONFIG)'. Valid values
: clang
, gcc
, gcc-4.8
, emcc
, mxe
, msys2
)
227 ifeq ($(ENABLE_LIBYOSYS
),1)
228 TARGETS
+= libyosys.so
231 ifeq ($(ENABLE_READLINE
),1)
232 CXXFLAGS
+= -DYOSYS_ENABLE_READLINE
233 ifeq ($(OS
), FreeBSD
)
234 CXXFLAGS
+= -I
/usr
/local
/include
237 ifeq ($(LINK_CURSES
),1)
239 ABCMKARGS
+= "ABC_READLINE_LIBRARIES=-lcurses -lreadline"
241 ifeq ($(LINK_TERMCAP
),1)
243 ABCMKARGS
+= "ABC_READLINE_LIBRARIES=-lreadline -ltermcap"
249 ifeq ($(ENABLE_EDITLINE
),1)
250 CXXFLAGS
+= -DYOSYS_ENABLE_EDITLINE
251 LDLIBS
+= -ledit
-ltinfo
-lbsd
253 ABCMKARGS
+= "ABC_USE_NO_READLINE=1"
257 ifeq ($(DISABLE_ABC_THREADS
),1)
258 ABCMKARGS
+= "ABC_USE_NO_PTHREADS=1"
261 ifeq ($(ENABLE_PLUGINS
),1)
262 CXXFLAGS
+= $(shell PKG_CONFIG_PATH
=$(PKG_CONFIG_PATH
) $(PKG_CONFIG
) --silence-errors
--cflags libffi
) -DYOSYS_ENABLE_PLUGINS
263 LDLIBS
+= $(shell PKG_CONFIG_PATH
=$(PKG_CONFIG_PATH
) $(PKG_CONFIG
) --silence-errors
--libs libffi || echo
-lffi
)
264 ifneq ($(OS
), FreeBSD
)
269 ifeq ($(ENABLE_TCL
),1)
270 TCL_VERSION ?
= tcl
$(shell bash
-c
"tclsh <(echo 'puts [info tclversion]')")
271 ifeq ($(OS
), FreeBSD
)
272 TCL_INCLUDE ?
= /usr
/local
/include/$(TCL_VERSION
)
274 TCL_INCLUDE ?
= /usr
/include/$(TCL_VERSION
)
278 CXXFLAGS
+= -DYOSYS_ENABLE_TCL
279 LDLIBS
+= -ltcl86
-lwsock32
-lws2_32
-lnetapi32
-lz
281 CXXFLAGS
+= $(shell PKG_CONFIG_PATH
=$(PKG_CONFIG_PATH
) $(PKG_CONFIG
) --silence-errors
--cflags tcl || echo
-I
$(TCL_INCLUDE
)) -DYOSYS_ENABLE_TCL
282 ifeq ($(OS
), FreeBSD
)
283 # FreeBSD uses tcl8.6, but lib is named "libtcl86"
284 LDLIBS
+= $(shell PKG_CONFIG_PATH
=$(PKG_CONFIG_PATH
) $(PKG_CONFIG
) --silence-errors
--libs tcl || echo
-l
$(TCL_VERSION
) | tr
-d
'.')
286 LDLIBS
+= $(shell PKG_CONFIG_PATH
=$(PKG_CONFIG_PATH
) $(PKG_CONFIG
) --silence-errors
--libs tcl || echo
-l
$(TCL_VERSION
))
291 ifeq ($(ENABLE_GPROF
),1)
296 ifeq ($(ENABLE_NDEBUG
),1)
297 CXXFLAGS
:= -O3
-DNDEBUG
$(filter-out -Os
-ggdb
,$(CXXFLAGS
))
300 ifeq ($(ENABLE_DEBUG
),1)
301 ifeq ($(CONFIG
),clang
)
302 CXXFLAGS
:= -O0
-DDEBUG
$(filter-out -Os
,$(CXXFLAGS
))
304 CXXFLAGS
:= -Og
-DDEBUG
$(filter-out -Os
,$(CXXFLAGS
))
308 ifeq ($(ENABLE_ABC
),1)
309 CXXFLAGS
+= -DYOSYS_ENABLE_ABC
311 CXXFLAGS
+= -DYOSYS_LINK_ABC
312 ifeq ($(DISABLE_ABC_THREADS
),0)
316 ifeq ($(ABCEXTERNAL
),)
317 TARGETS
+= yosys-abc
$(EXE
)
322 ifeq ($(ENABLE_VERIFIC
),1)
323 VERIFIC_DIR ?
= /usr
/local
/src
/verific_lib_eval
324 VERIFIC_COMPONENTS ?
= verilog vhdl database util containers sdf hier_tree
325 CXXFLAGS
+= $(patsubst %,-I
$(VERIFIC_DIR
)/%,$(VERIFIC_COMPONENTS
)) -DYOSYS_ENABLE_VERIFIC
326 LDLIBS
+= $(patsubst %,$(VERIFIC_DIR
)/%/*-linux.a
,$(VERIFIC_COMPONENTS
)) -lz
329 ifeq ($(ENABLE_PROTOBUF
),1)
330 LDLIBS
+= $(shell pkg-config
--cflags --libs protobuf
)
333 ifeq ($(ENABLE_COVER
),1)
334 CXXFLAGS
+= -DYOSYS_ENABLE_COVER
337 define add_share_file
338 EXTRA_TARGETS
+= $(subst //,/,$(1)/$(notdir $(2)))
339 $(subst //,/,$(1)/$(notdir $(2))): $(2)
341 $$(Q
) cp
"$(YOSYS_SRC)"/$(2) $(subst //,/,$(1)/$(notdir $(2)))
344 define add_gen_share_file
345 EXTRA_TARGETS
+= $(subst //,/,$(1)/$(notdir $(2)))
346 $(subst //,/,$(1)/$(notdir $(2))): $(2)
348 $$(Q
) cp
$(2) $(subst //,/,$(1)/$(notdir $(2)))
351 define add_include_file
352 $(eval
$(call add_share_file
,$(dir share
/include/$(1)),$(1)))
358 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; }'))
359 P_SHOW
= [$(shell gawk
"BEGIN { N=$(words $(OBJS) yosys$(EXE)); printf \"%3d\", $(P_OFFSET)+90*$(P_STATUS)/N; exit; }")%]
360 P
= @echo
"$(if $(findstring $@,$(TARGETS) $(EXTRA_TARGETS)),$(eval P_OFFSET = 10))$(call P_UPDATE)$(call P_SHOW) Building $@";
370 $(eval
$(call add_include_file
,kernel
/yosys.h
))
371 $(eval
$(call add_include_file
,kernel
/hashlib.h
))
372 $(eval
$(call add_include_file
,kernel
/log.h
))
373 $(eval
$(call add_include_file
,kernel
/rtlil.h
))
374 $(eval
$(call add_include_file
,kernel
/register.h
))
375 $(eval
$(call add_include_file
,kernel
/celltypes.h
))
376 $(eval
$(call add_include_file
,kernel
/celledges.h
))
377 $(eval
$(call add_include_file
,kernel
/consteval.h
))
378 $(eval
$(call add_include_file
,kernel
/sigtools.h
))
379 $(eval
$(call add_include_file
,kernel
/modtools.h
))
380 $(eval
$(call add_include_file
,kernel
/macc.h
))
381 $(eval
$(call add_include_file
,kernel
/utils.h
))
382 $(eval
$(call add_include_file
,kernel
/satgen.h
))
383 $(eval
$(call add_include_file
,libs
/ezsat
/ezsat.h
))
384 $(eval
$(call add_include_file
,libs
/ezsat
/ezminisat.h
))
385 $(eval
$(call add_include_file
,libs
/sha1
/sha1.h
))
386 $(eval
$(call add_include_file
,passes
/fsm
/fsmdata.h
))
387 $(eval
$(call add_include_file
,frontends
/ast
/ast.h
))
388 $(eval
$(call add_include_file
,backends
/ilang
/ilang_backend.h
))
390 OBJS
+= kernel
/driver.o kernel
/register.o kernel
/rtlil.o kernel
/log.o kernel
/calc.o kernel
/yosys.o
391 OBJS
+= kernel
/cellaigs.o kernel
/celledges.o
393 kernel
/log.o
: CXXFLAGS
+= -DYOSYS_SRC
='"$(YOSYS_SRC)"'
394 kernel
/yosys.o
: CXXFLAGS
+= -DYOSYS_DATDIR
='"$(DATDIR)"'
396 OBJS
+= libs
/bigint
/BigIntegerAlgorithms.o libs
/bigint
/BigInteger.o libs
/bigint
/BigIntegerUtils.o
397 OBJS
+= libs
/bigint
/BigUnsigned.o libs
/bigint
/BigUnsignedInABase.o
399 OBJS
+= libs
/sha1
/sha1.o
403 OBJS
+= libs
/subcircuit
/subcircuit.o
405 OBJS
+= libs
/ezsat
/ezsat.o
406 OBJS
+= libs
/ezsat
/ezminisat.o
408 OBJS
+= libs
/minisat
/Options.o
409 OBJS
+= libs
/minisat
/SimpSolver.o
410 OBJS
+= libs
/minisat
/Solver.o
411 OBJS
+= libs
/minisat
/System.o
413 include $(YOSYS_SRC
)/frontends
/*/Makefile.inc
414 include $(YOSYS_SRC
)/passes
/*/Makefile.inc
415 include $(YOSYS_SRC
)/backends
/*/Makefile.inc
416 include $(YOSYS_SRC
)/techlibs
/*/Makefile.inc
420 include frontends
/verilog
/Makefile.inc
421 include frontends
/ilang
/Makefile.inc
422 include frontends
/ast
/Makefile.inc
423 include frontends
/blif
/Makefile.inc
425 OBJS
+= passes
/hierarchy
/hierarchy.o
426 OBJS
+= passes
/cmds
/select.o
427 OBJS
+= passes
/cmds
/show.o
428 OBJS
+= passes
/cmds
/stat.o
429 OBJS
+= passes
/cmds
/cover.o
430 OBJS
+= passes
/cmds
/design.o
431 OBJS
+= passes
/cmds
/plugin.o
433 include passes
/proc
/Makefile.inc
434 include passes
/opt
/Makefile.inc
435 include passes
/techmap
/Makefile.inc
437 include backends
/verilog
/Makefile.inc
438 include backends
/ilang
/Makefile.inc
440 include techlibs
/common
/Makefile.inc
445 OBJS
+= yosys-libabc.a
448 top-all
: $(TARGETS
) $(EXTRA_TARGETS
)
450 @echo
" Build successful."
453 ifeq ($(CONFIG
),emcc
)
454 yosys.js
: $(filter-out yosysjs-
$(YOSYS_VER
).zip
,$(EXTRA_TARGETS
))
458 $(P
) $(LD
) -o yosys
$(EXE
) $(LDFLAGS
) $(OBJS
) $(LDLIBS
)
460 libyosys.so
: $(filter-out kernel
/driver.o
,$(OBJS
))
461 $(P
) $(LD
) -o libyosys.so
-shared
-Wl
,-soname
,libyosys.so
$(LDFLAGS
) $^
$(LDLIBS
)
464 $(Q
) mkdir
-p
$(dir $@
)
465 $(P
) $(CXX
) -o
$@
-c
$(CPPFLAGS
) $(CXXFLAGS
) $<
468 $(Q
) mkdir
-p
$(dir $@
)
469 $(P
) $(CXX
) -o
$@
-c
$(CPPFLAGS
) $(CXXFLAGS
) $<
471 YOSYS_VER_STR
:= Yosys
$(YOSYS_VER
) (git sha1
$(GIT_REV
), $(notdir $(CXX
)) $(shell \
472 $(CXX
) --version | tr
' ()' '\n' | grep
'^[0-9]' | head
-n1
) $(filter -f
% -m
% -O
% -DNDEBUG
,$(CXXFLAGS
)))
474 kernel
/version_
$(GIT_REV
).
cc: $(YOSYS_SRC
)/Makefile
475 $(P
) rm -f kernel
/version_
*.o kernel
/version_
*.d kernel
/version_
*.
cc
476 $(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
478 ifeq ($(ENABLE_VERIFIC
),1)
479 CXXFLAGS_NOVERIFIC
= $(foreach v
,$(CXXFLAGS
),$(if
$(findstring $(VERIFIC_DIR
),$(v
)),,$(v
)))
480 LDLIBS_NOVERIFIC
= $(foreach v
,$(LDLIBS
),$(if
$(findstring $(VERIFIC_DIR
),$(v
)),,$(v
)))
482 CXXFLAGS_NOVERIFIC
= $(CXXFLAGS
)
483 LDLIBS_NOVERIFIC
= $(LDLIBS
)
486 yosys-config
: misc
/yosys-config.in
487 $(P
) $(SED
) -e
's#@CXXFLAGS@#$(subst -I. -I"$(YOSYS_SRC)",-I"$(DATDIR)/include",$(strip $(CXXFLAGS_NOVERIFIC)))#;' \
488 -e
's#@CXX@#$(strip $(CXX))#;' -e
's#@LDFLAGS@#$(strip $(LDFLAGS) $(PLUGIN_LDFLAGS))#;' -e
's#@LDLIBS@#$(strip $(LDLIBS_NOVERIFIC))#;' \
489 -e
's#@BINDIR@#$(strip $(BINDIR))#;' -e
's#@DATDIR@#$(strip $(DATDIR))#;' < $< > yosys-config
490 $(Q
) chmod
+x yosys-config
492 abc
/abc-
$(ABCREV
)$(EXE
) abc
/libabc-
$(ABCREV
).a
:
494 ifneq ($(ABCREV
),default
)
495 $(Q
) if
test -d abc
/.hg
; then \
496 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
; \
498 $(Q
) if
( cd abc
2> /dev
/null
&& ! git diff-index
--quiet HEAD
; ); then \
499 echo
'REEBE: NOP pbagnvaf ybpny zbqvsvpngvbaf! Frg NOPERI=qrsnhyg va Lbflf Znxrsvyr!' | tr
'A-Za-z' 'N-ZA-Mn-za-m'; false
; \
501 $(Q
) if
test "`cd abc 2> /dev/null && git rev-parse --short HEAD`" != "$(ABCREV)"; then \
502 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; }; \
503 echo
"Pulling ABC from $(ABCURL):"; set
-x
; \
504 test -d abc || git clone
$(ABCURL
) abc
; \
505 cd abc
&& $(MAKE
) DEP
= clean && git fetch
origin master
&& git checkout
$(ABCREV
); \
508 $(Q
) rm -f abc
/abc-
[0-9a-f
]*
509 $(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
)
511 ifeq ($(ABCREV
),default
)
512 .PHONY
: abc
/abc-
$(ABCREV
)$(EXE
)
513 .PHONY
: abc
/libabc-
$(ABCREV
).a
516 yosys-abc
$(EXE
): abc
/abc-
$(ABCREV
)$(EXE
)
517 $(P
) cp abc
/abc-
$(ABCREV
)$(EXE
) yosys-abc
$(EXE
)
519 yosys-libabc.a
: abc
/libabc-
$(ABCREV
).a
520 $(P
) cp abc
/libabc-
$(ABCREV
).a yosys-libabc.a
528 test: $(TARGETS
) $(EXTRA_TARGETS
)
529 +cd tests
/simple
&& bash run-test.sh
$(SEEDOPT
)
530 +cd tests
/hana
&& bash run-test.sh
$(SEEDOPT
)
531 +cd tests
/asicworld
&& bash run-test.sh
$(SEEDOPT
)
532 +cd tests
/realmath
&& bash run-test.sh
$(SEEDOPT
)
533 +cd tests
/share
&& bash run-test.sh
$(SEEDOPT
)
534 +cd tests
/fsm
&& bash run-test.sh
$(SEEDOPT
)
535 +cd tests
/techmap
&& bash run-test.sh
536 +cd tests
/memories
&& bash run-test.sh
$(SEEDOPT
)
537 +cd tests
/bram
&& bash run-test.sh
$(SEEDOPT
)
538 +cd tests
/various
&& bash run-test.sh
539 +cd tests
/sat
&& bash run-test.sh
541 @echo
" Passed \"make test\"."
544 VALGRIND ?
= valgrind
--error-exitcode
=1 --leak-check
=full
--show-reachable
=yes
--errors-for-leak-kinds
=all
546 vgtest
: $(TARGETS
) $(EXTRA_TARGETS
)
547 $(VALGRIND
) .
/yosys
-p
'setattr -mod -unset top; synth' $$( ls tests
/simple
/*.v | grep
-v repwhile.v
)
549 @echo
" Passed \"make vgtest\"."
552 vloghtb
: $(TARGETS
) $(EXTRA_TARGETS
)
553 +cd tests
/vloghtb
&& bash run-test.sh
555 @echo
" Passed \"make vloghtb\"."
559 unit-test
: libyosys.so
560 @
$(MAKE
) -C
$(UNITESTPATH
) CXX
="$(CXX)" CPPFLAGS
="$(CPPFLAGS)" \
561 CXXFLAGS
="$(CXXFLAGS)" LDLIBS
="$(LDLIBS)" ROOTPATH
="$(CURDIR)"
564 @
$(MAKE
) -C
$(UNITESTPATH
) clean
566 install: $(TARGETS
) $(EXTRA_TARGETS
)
567 $(INSTALL_SUDO
) mkdir
-p
$(DESTDIR
)$(BINDIR
)
568 $(INSTALL_SUDO
) cp
$(TARGETS
) $(DESTDIR
)$(BINDIR
)
569 ifneq ($(filter yosys
,$(TARGETS
)),)
570 $(INSTALL_SUDO
) $(STRIP
) -S
$(DESTDIR
)$(BINDIR
)/yosys
572 ifneq ($(filter yosys-abc
,$(TARGETS
)),)
573 $(INSTALL_SUDO
) $(STRIP
) $(DESTDIR
)$(BINDIR
)/yosys-abc
575 ifneq ($(filter yosys-filterlib
,$(TARGETS
)),)
576 $(INSTALL_SUDO
) $(STRIP
) $(DESTDIR
)$(BINDIR
)/yosys-filterlib
578 $(INSTALL_SUDO
) mkdir
-p
$(DESTDIR
)$(DATDIR
)
579 $(INSTALL_SUDO
) cp
-r share
/.
$(DESTDIR
)$(DATDIR
)/.
580 ifeq ($(ENABLE_LIBYOSYS
),1)
581 $(INSTALL_SUDO
) cp libyosys.so
$(DESTDIR
)$(LIBDIR
)
582 $(INSTALL_SUDO
) $(STRIP
) -S
$(DESTDIR
)$(LIBDIR
)/libyosys.so
583 $(INSTALL_SUDO
) ldconfig
587 $(INSTALL_SUDO
) rm -vf
$(addprefix $(DESTDIR
)$(BINDIR
)/,$(notdir $(TARGETS
)))
588 $(INSTALL_SUDO
) rm -rvf
$(DESTDIR
)$(DATDIR
)
589 ifeq ($(ENABLE_LIBYOSYS
),1)
590 $(INSTALL_SUDO
) rm -vf
$(DESTDIR
)$(LIBDIR
)/libyosys.so
593 update-manual
: $(TARGETS
) $(EXTRA_TARGETS
)
594 cd manual
&& ..
/yosys
-p
'help -write-tex-command-reference-manual'
596 manual
: $(TARGETS
) $(EXTRA_TARGETS
)
597 cd manual
&& bash appnotes.sh
598 cd manual
&& bash presentation.sh
599 cd manual
&& bash manual.sh
603 if
test -d manual
; then cd manual
&& sh
clean.sh
; fi
604 rm -f
$(OBJS
) $(GENFILES
) $(TARGETS
) $(EXTRA_TARGETS
) $(EXTRA_OBJS
)
605 rm -f kernel
/version_
*.o kernel
/version_
*.
cc abc
/abc-
[0-9a-f
]* abc
/libabc-
[0-9a-f
]*.a
606 rm -f libs
/*/*.d frontends
/*/*.d passes
/*/*.d backends
/*/*.d kernel
/*.d techlibs
/*/*.d
607 rm -rf tests
/asicworld
/*.out tests
/asicworld
/*.log
608 rm -rf tests
/hana
/*.out tests
/hana
/*.log
609 rm -rf tests
/simple
/*.out tests
/simple
/*.log
610 rm -rf tests
/memories
/*.out tests
/memories
/*.log tests
/memories
/*.dmp
611 rm -rf tests
/sat
/*.log tests
/techmap
/*.log tests
/various
/*.log
612 rm -rf tests
/bram
/temp tests
/fsm
/temp tests
/realmath
/temp tests
/share
/temp tests
/smv
/temp
613 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_
*
614 rm -f tests
/tools
/cmp_tbdata
617 $(MAKE
) -C abc DEP
= clean
618 rm -f yosys-abc
$(EXE
) yosys-libabc.a abc
/abc-
[0-9a-f
]* abc
/libabc-
[0-9a-f
]*.a
624 { for file in
$(basename $(OBJS
)); do \
625 for
prefix in
cc y l
; do if
[ -f
$${file}.
$${prefix} ]; then echo
$$file.
$${prefix}; fi
; done \
626 done
; find backends frontends kernel libs passes
-type f \
( -name
'*.h' -o
-name
'*.hh' \
); } > qtcreator.files
627 { echo .
; find backends frontends kernel libs passes
-type f \
( -name
'*.h' -o
-name
'*.hh' \
) -printf
'%h\n' |
sort -u
; } > qtcreator.includes
628 touch qtcreator.config qtcreator.creator
630 vcxsrc
: $(GENFILES
) $(EXTRA_TARGETS
)
631 rm -rf yosys-win32-vcxsrc-
$(YOSYS_VER
){,.zip
}
632 set
-e
; for f in
`ls $(filter %.cc %.cpp,$(GENFILES)) $(addsuffix .cc,$(basename $(OBJS))) $(addsuffix .cpp,$(basename $(OBJS))) 2> /dev/null`; do \
633 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
634 bash misc
/create_vcxsrc.sh yosys-win32-vcxsrc
$(YOSYS_VER
) $(GIT_REV
)
635 echo
"namespace Yosys { extern const char *yosys_version_str; const char *yosys_version_str=\"Yosys (Version Information Unavailable)\"; }" > kernel
/version.
cc
636 zip yosys-win32-vcxsrc-
$(YOSYS_VER
)/genfiles.zip
$(GENFILES
) kernel
/version.
cc
637 zip
-r yosys-win32-vcxsrc-
$(YOSYS_VER
).zip yosys-win32-vcxsrc-
$(YOSYS_VER
)/
638 rm -f srcfiles.txt kernel
/version.
cc
641 mxebin
: $(TARGETS
) $(EXTRA_TARGETS
)
642 rm -rf yosys-win32-mxebin-
$(YOSYS_VER
){,.zip
}
643 mkdir
-p yosys-win32-mxebin-
$(YOSYS_VER
)
644 cp
-r yosys.exe share
/ yosys-win32-mxebin-
$(YOSYS_VER
)/
645 ifeq ($(ENABLE_ABC
),1)
646 cp
-r yosys-abc.exe abc
/lib
/x86
/pthreadVC2.dll yosys-win32-mxebin-
$(YOSYS_VER
)/
648 echo
-en
'This is Yosys $(YOSYS_VER) for Win32.\r\n' > yosys-win32-mxebin-
$(YOSYS_VER
)/readme.txt
649 echo
-en
'Documentation at http://www.clifford.at/yosys/.\r\n' >> yosys-win32-mxebin-
$(YOSYS_VER
)/readme.txt
650 zip
-r yosys-win32-mxebin-
$(YOSYS_VER
).zip yosys-win32-mxebin-
$(YOSYS_VER
)/
657 echo
'CONFIG := clang' > Makefile.conf
660 echo
'CONFIG := gcc' > Makefile.conf
662 config-gcc-4.8
: clean
663 echo
'CONFIG := gcc-4.8' > Makefile.conf
666 echo
'CONFIG := emcc' > Makefile.conf
667 echo
'ENABLE_TCL := 0' >> Makefile.conf
668 echo
'ENABLE_ABC := 0' >> Makefile.conf
669 echo
'ENABLE_PLUGINS := 0' >> Makefile.conf
670 echo
'ENABLE_READLINE := 0' >> Makefile.conf
673 echo
'CONFIG := mxe' > Makefile.conf
674 echo
'ENABLE_PLUGINS := 0' >> Makefile.conf
677 echo
'CONFIG := msys2' > Makefile.conf
680 echo
'CONFIG := gcc' > Makefile.conf
681 echo
'ENABLE_GPROF := 1' >> Makefile.conf
684 echo
"INSTALL_SUDO := sudo" >> Makefile.conf
693 -include frontends
/*/*.d
694 -include passes
/*/*.d
695 -include backends
/*/*.d
697 -include techlibs
/*/*.d
699 .PHONY
: all top-all abc
test install install-abc manual
clean mrproper qtcreator
700 .PHONY
: config-clean config-clang config-gcc config-gcc-4.8 config-gprof config-sudo