9 # features (the more the better)
19 # other configuration flags
30 # SANITIZER = undefined
34 OS
:= $(shell uname
-s
)
38 BINDIR
:= $(PREFIX
)/bin
39 LIBDIR
:= $(PREFIX
)/lib
40 DATDIR
:= $(PREFIX
)/share
/yosys
47 TARGETS
= yosys
$(EXE
) yosys-config
53 UNITESTPATH
:= tests
/unit
57 YOSYS_SRC
:= $(dir $(firstword $(MAKEFILE_LIST
)))
60 CXXFLAGS
:= $(CXXFLAGS
) -Wall
-Wextra
-ggdb
-I.
-I
"$(YOSYS_SRC)" -MD
-D_YOSYS_
-fPIC
-I
$(PREFIX
)/include
61 LDFLAGS
:= $(LDFLAGS
) -L
$(LIBDIR
)
62 LDLIBS
:= $(LDLIBS
) -lstdc
++ -lm
65 PKG_CONFIG ?
= pkg-config
71 PLUGIN_LDFLAGS
+= -undefined dynamic_lookup
73 # homebrew search paths
74 ifneq ($(shell which brew
),)
75 BREW_PREFIX
:= $(shell brew
--prefix)/opt
76 CXXFLAGS
+= -I
$(BREW_PREFIX
)/readline
/include
77 LDFLAGS
+= -L
$(BREW_PREFIX
)/readline
/lib
78 PKG_CONFIG_PATH
:= $(BREW_PREFIX
)/libffi
/lib
/pkgconfig
:$(PKG_CONFIG_PATH
)
79 PKG_CONFIG_PATH
:= $(BREW_PREFIX
)/tcl-tk
/lib
/pkgconfig
:$(PKG_CONFIG_PATH
)
80 export PATH
:= $(BREW_PREFIX
)/bison
/bin
:$(BREW_PREFIX
)/gettext
/bin
:$(BREW_PREFIX
)/flex
/bin
:$(PATH
)
82 # macports search paths
83 else ifneq ($(shell which port
),)
84 PORT_PREFIX
:= $(patsubst %/bin
/port
,%,$(shell which port
))
85 CXXFLAGS
+= -I
$(PORT_PREFIX
)/include
86 LDFLAGS
+= -L
$(PORT_PREFIX
)/lib
87 PKG_CONFIG_PATH
:= $(PORT_PREFIX
)/lib
/pkgconfig
:$(PKG_CONFIG_PATH
)
88 export PATH
:= $(PORT_PREFIX
)/bin
:$(PATH
)
96 YOSYS_VER
:= 0.7+$(shell cd
$(YOSYS_SRC
) && test -e .git
&& { git log
--author
=clifford@clifford.at
--oneline
61f6811.. | wc
-l
; })
97 GIT_REV
:= $(shell cd
$(YOSYS_SRC
) && git rev-parse
--short HEAD
2> /dev
/null || echo UNKNOWN
)
98 OBJS
= kernel
/version_
$(GIT_REV
).o
100 # set 'ABCREV = default' to use abc/ as it is
102 # Note: If you do ABC development, make sure that 'abc' in this directory
103 # is just a symlink to your actual ABC working directory, as 'make mrproper'
104 # will remove the 'abc' directory and you do not want to accidentally
105 # delete your work on ABC..
108 ABCURL ?
= https
://github.com
/berkeley-abc
/abc
109 ABCMKARGS
= CC
="$(CXX)" CXX
="$(CXX)" ABC_USE_LIBSTDCXX
=1
111 # set ABCEXTERNAL = <abc-command> to use an external ABC instance
112 # Note: The in-tree ABC (yosys-abc) will not be installed when ABCEXTERNAL is set.
120 ifneq ($(wildcard Makefile.conf
),)
121 $(info $(subst $$--$$,$(newline
),$(shell sed
's,^,[Makefile.conf] ,; s,$$,$$--$$,;' < Makefile.conf | tr
-d
'\n' | sed
's,\$$--\$$$$,,')))
122 include Makefile.conf
125 ifeq ($(CONFIG
),clang
)
128 CXXFLAGS
+= -std
=c
++11 -Os
129 ABCMKARGS
+= ARCHFLAGS
="-DABC_USE_STDINT_H"
131 ifneq ($(SANITIZER
),)
132 $(info [Clang Sanitizer
] $(SANITIZER
))
133 CXXFLAGS
+= -g
-O1
-fno-omit-frame-pointer
-fno-optimize-sibling-calls
-fsanitize
=$(SANITIZER
)
134 LDFLAGS
+= -g
-fsanitize
=$(SANITIZER
)
135 ifeq ($(SANITIZER
),address
)
138 ifeq ($(SANITIZER
),memory
)
139 CXXFLAGS
+= -fPIE
-fsanitize-memory-track-origins
140 LDFLAGS
+= -fPIE
-fsanitize-memory-track-origins
142 ifeq ($(SANITIZER
),cfi
)
148 else ifeq ($(CONFIG
),gcc
)
151 CXXFLAGS
+= -std
=c
++11 -Os
152 ABCMKARGS
+= ARCHFLAGS
="-DABC_USE_STDINT_H"
154 else ifeq ($(CONFIG
),gcc-4.8
)
157 CXXFLAGS
+= -std
=c
++11 -Os
158 ABCMKARGS
+= ARCHFLAGS
="-DABC_USE_STDINT_H"
160 else ifeq ($(CONFIG
),emcc
)
163 CXXFLAGS
:= -std
=c
++11 $(filter-out -fPIC
-ggdb
,$(CXXFLAGS
))
164 ABCMKARGS
+= ARCHFLAGS
="-DABC_USE_STDINT_H"
165 EMCCFLAGS
:= -Os
-Wno-warn-absolute-paths
166 EMCCFLAGS
+= --memory-init-file
0 --embed-file share
-s NO_EXIT_RUNTIME
=1
167 EMCCFLAGS
+= -s EXPORTED_FUNCTIONS
="['_main','_run','_prompt','_errmsg']"
168 EMCCFLAGS
+= -s TOTAL_MEMORY
=128*1024*1024
169 # https://github.com/kripken/emscripten/blob/master/src/settings.js
170 CXXFLAGS
+= $(EMCCFLAGS
)
171 LDFLAGS
+= $(EMCCFLAGS
)
175 TARGETS
:= $(filter-out yosys-config
,$(TARGETS
))
176 EXTRA_TARGETS
+= yosysjs-
$(YOSYS_VER
).zip
179 wget
-O viz.js.part https
://github.com
/mdaines
/viz.js
/releases
/download
/0.0.3/viz.js
180 mv viz.js.part viz.js
182 yosysjs-
$(YOSYS_VER
).zip
: yosys.js viz.js misc
/yosysjs
/*
183 rm -rf yosysjs-
$(YOSYS_VER
) yosysjs-
$(YOSYS_VER
).zip
184 mkdir
-p yosysjs-
$(YOSYS_VER
)
185 cp viz.js misc
/yosysjs
/* yosys.js yosysjs-
$(YOSYS_VER
)/
186 zip
-r yosysjs-
$(YOSYS_VER
).zip yosysjs-
$(YOSYS_VER
)
188 yosys.html
: misc
/yosys.html
189 $(P
) cp misc
/yosys.html yosys.html
191 else ifeq ($(CONFIG
),mxe
)
192 PKG_CONFIG
= /usr
/local
/src
/mxe
/usr
/bin
/i686-w64-mingw32.static-pkg-config
193 CXX
= /usr
/local
/src
/mxe
/usr
/bin
/i686-w64-mingw32.static-gcc
194 LD
= /usr
/local
/src
/mxe
/usr
/bin
/i686-w64-mingw32.static-gcc
195 CXXFLAGS
+= -std
=c
++11 -Os
-D_POSIX_SOURCE
-DYOSYS_MXE_HACKS
-Wno-attributes
196 CXXFLAGS
:= $(filter-out -fPIC
,$(CXXFLAGS
))
197 LDFLAGS
:= $(filter-out -rdynamic
,$(LDFLAGS
)) -s
198 LDLIBS
:= $(filter-out -lrt
,$(LDLIBS
))
199 ABCMKARGS
+= ARCHFLAGS
="-DABC_USE_STDINT_H -DWIN32_NO_DLL -DHAVE_STRUCT_TIMESPEC -fpermissive -w"
200 ABCMKARGS
+= LIBS
="lib/x86/pthreadVC2.lib -s" ABC_USE_NO_READLINE
=1
203 else ifeq ($(CONFIG
),msys2
)
204 CXX
= i686-w64-mingw32-g
++
205 LD
= i686-w64-mingw32-g
++
206 CXXFLAGS
+= -std
=c
++11 -Os
-D_POSIX_SOURCE
-DYOSYS_WIN32_UNIX_DIR
207 CXXFLAGS
:= $(filter-out -fPIC
,$(CXXFLAGS
))
208 LDFLAGS
:= $(filter-out -rdynamic
,$(LDFLAGS
)) -s
209 LDLIBS
:= $(filter-out -lrt
,$(LDLIBS
))
210 ABCMKARGS
+= ARCHFLAGS
="-DABC_USE_STDINT_H -DWIN32_NO_DLL -DHAVE_STRUCT_TIMESPEC -fpermissive -w"
211 ABCMKARGS
+= LIBS
="lib/x86/pthreadVC2.lib -s" ABC_USE_NO_READLINE
=0
214 else ifneq ($(CONFIG
),none
)
215 $(error Invalid CONFIG setting
'$(CONFIG)'. Valid values
: clang
, gcc
, gcc-4.8
, emcc
, mxe
, msys2
)
218 ifeq ($(ENABLE_LIBYOSYS
),1)
219 TARGETS
+= libyosys.so
222 ifeq ($(ENABLE_READLINE
),1)
223 CXXFLAGS
+= -DYOSYS_ENABLE_READLINE
224 ifeq ($(OS
), FreeBSD
)
225 CXXFLAGS
+= -I
/usr
/local
/include
228 ifeq ($(LINK_CURSES
),1)
230 ABCMKARGS
+= "ABC_READLINE_LIBRARIES=-lcurses -lreadline"
232 ifeq ($(LINK_TERMCAP
),1)
234 ABCMKARGS
+= "ABC_READLINE_LIBRARIES=-lreadline -ltermcap"
240 ifeq ($(ENABLE_EDITLINE
),1)
241 CXXFLAGS
+= -DYOSYS_ENABLE_EDITLINE
242 LDLIBS
+= -ledit
-ltinfo
-lbsd
246 ifeq ($(ENABLE_PLUGINS
),1)
247 CXXFLAGS
+= $(shell PKG_CONFIG_PATH
=$(PKG_CONFIG_PATH
) $(PKG_CONFIG
) --silence-errors
--cflags libffi
) -DYOSYS_ENABLE_PLUGINS
248 LDLIBS
+= $(shell PKG_CONFIG_PATH
=$(PKG_CONFIG_PATH
) $(PKG_CONFIG
) --silence-errors
--libs libffi || echo
-lffi
)
249 ifneq ($(OS
), FreeBSD
)
254 ifeq ($(ENABLE_TCL
),1)
255 TCL_VERSION ?
= tcl
$(shell bash
-c
"tclsh <(echo 'puts [info tclversion]')")
256 ifeq ($(OS
), FreeBSD
)
257 TCL_INCLUDE ?
= /usr
/local
/include/$(TCL_VERSION
)
259 TCL_INCLUDE ?
= /usr
/include/$(TCL_VERSION
)
263 CXXFLAGS
+= -DYOSYS_ENABLE_TCL
264 LDLIBS
+= -ltcl86
-lwsock32
-lws2_32
-lnetapi32
266 CXXFLAGS
+= $(shell PKG_CONFIG_PATH
=$(PKG_CONFIG_PATH
) $(PKG_CONFIG
) --silence-errors
--cflags tcl || echo
-I
$(TCL_INCLUDE
)) -DYOSYS_ENABLE_TCL
267 ifeq ($(OS
), FreeBSD
)
268 # FreeBSD uses tcl8.6, but lib is named "libtcl86"
269 LDLIBS
+= $(shell PKG_CONFIG_PATH
=$(PKG_CONFIG_PATH
) $(PKG_CONFIG
) --silence-errors
--libs tcl || echo
-l
$(TCL_VERSION
) | tr
-d
'.')
271 LDLIBS
+= $(shell PKG_CONFIG_PATH
=$(PKG_CONFIG_PATH
) $(PKG_CONFIG
) --silence-errors
--libs tcl || echo
-l
$(TCL_VERSION
))
276 ifeq ($(ENABLE_GPROF
),1)
281 ifeq ($(ENABLE_NDEBUG
),1)
282 CXXFLAGS
:= -O3
-DNDEBUG
$(filter-out -Os
-ggdb
,$(CXXFLAGS
))
285 ifeq ($(ENABLE_DEBUG
),1)
286 ifeq ($(CONFIG
),clang
)
287 CXXFLAGS
:= -O0
-DDEBUG
$(filter-out -Os
,$(CXXFLAGS
))
289 CXXFLAGS
:= -Og
-DDEBUG
$(filter-out -Os
,$(CXXFLAGS
))
293 ifeq ($(ENABLE_ABC
),1)
294 CXXFLAGS
+= -DYOSYS_ENABLE_ABC
295 ifeq ($(ABCEXTERNAL
),)
296 TARGETS
+= yosys-abc
$(EXE
)
300 ifeq ($(ENABLE_VERIFIC
),1)
301 VERIFIC_DIR ?
= /usr
/local
/src
/verific_lib_eval
302 VERIFIC_COMPONENTS ?
= verilog vhdl database util containers sdf hier_tree
303 CXXFLAGS
+= $(patsubst %,-I
$(VERIFIC_DIR
)/%,$(VERIFIC_COMPONENTS
)) -DYOSYS_ENABLE_VERIFIC
304 LDLIBS
+= $(patsubst %,$(VERIFIC_DIR
)/%/*-linux.a
,$(VERIFIC_COMPONENTS
)) -lz
307 ifeq ($(ENABLE_COVER
),1)
308 CXXFLAGS
+= -DYOSYS_ENABLE_COVER
311 define add_share_file
312 EXTRA_TARGETS
+= $(subst //,/,$(1)/$(notdir $(2)))
313 $(subst //,/,$(1)/$(notdir $(2))): $(2)
315 $$(Q
) cp
"$(YOSYS_SRC)"/$(2) $(subst //,/,$(1)/$(notdir $(2)))
318 define add_gen_share_file
319 EXTRA_TARGETS
+= $(subst //,/,$(1)/$(notdir $(2)))
320 $(subst //,/,$(1)/$(notdir $(2))): $(2)
322 $$(Q
) cp
$(2) $(subst //,/,$(1)/$(notdir $(2)))
325 define add_include_file
326 $(eval
$(call add_share_file
,$(dir share
/include/$(1)),$(1)))
332 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; }'))
333 P_SHOW
= [$(shell gawk
"BEGIN { N=$(words $(OBJS) yosys$(EXE)); printf \"%3d\", $(P_OFFSET)+90*$(P_STATUS)/N; exit; }")%]
334 P
= @echo
"$(if $(findstring $@,$(TARGETS) $(EXTRA_TARGETS)),$(eval P_OFFSET = 10))$(call P_UPDATE)$(call P_SHOW) Building $@";
344 $(eval
$(call add_include_file
,kernel
/yosys.h
))
345 $(eval
$(call add_include_file
,kernel
/hashlib.h
))
346 $(eval
$(call add_include_file
,kernel
/log.h
))
347 $(eval
$(call add_include_file
,kernel
/rtlil.h
))
348 $(eval
$(call add_include_file
,kernel
/register.h
))
349 $(eval
$(call add_include_file
,kernel
/celltypes.h
))
350 $(eval
$(call add_include_file
,kernel
/celledges.h
))
351 $(eval
$(call add_include_file
,kernel
/consteval.h
))
352 $(eval
$(call add_include_file
,kernel
/sigtools.h
))
353 $(eval
$(call add_include_file
,kernel
/modtools.h
))
354 $(eval
$(call add_include_file
,kernel
/macc.h
))
355 $(eval
$(call add_include_file
,kernel
/utils.h
))
356 $(eval
$(call add_include_file
,kernel
/satgen.h
))
357 $(eval
$(call add_include_file
,libs
/ezsat
/ezsat.h
))
358 $(eval
$(call add_include_file
,libs
/ezsat
/ezminisat.h
))
359 $(eval
$(call add_include_file
,libs
/sha1
/sha1.h
))
360 $(eval
$(call add_include_file
,passes
/fsm
/fsmdata.h
))
361 $(eval
$(call add_include_file
,frontends
/ast
/ast.h
))
362 $(eval
$(call add_include_file
,backends
/ilang
/ilang_backend.h
))
364 OBJS
+= kernel
/driver.o kernel
/register.o kernel
/rtlil.o kernel
/log.o kernel
/calc.o kernel
/yosys.o
365 OBJS
+= kernel
/cellaigs.o kernel
/celledges.o
367 kernel
/log.o
: CXXFLAGS
+= -DYOSYS_SRC
='"$(YOSYS_SRC)"'
368 kernel
/yosys.o
: CXXFLAGS
+= -DYOSYS_DATDIR
='"$(DATDIR)"'
370 OBJS
+= libs
/bigint
/BigIntegerAlgorithms.o libs
/bigint
/BigInteger.o libs
/bigint
/BigIntegerUtils.o
371 OBJS
+= libs
/bigint
/BigUnsigned.o libs
/bigint
/BigUnsignedInABase.o
373 OBJS
+= libs
/sha1
/sha1.o
377 OBJS
+= libs
/subcircuit
/subcircuit.o
379 OBJS
+= libs
/ezsat
/ezsat.o
380 OBJS
+= libs
/ezsat
/ezminisat.o
382 OBJS
+= libs
/minisat
/Options.o
383 OBJS
+= libs
/minisat
/SimpSolver.o
384 OBJS
+= libs
/minisat
/Solver.o
385 OBJS
+= libs
/minisat
/System.o
387 include $(YOSYS_SRC
)/frontends
/*/Makefile.inc
388 include $(YOSYS_SRC
)/passes
/*/Makefile.inc
389 include $(YOSYS_SRC
)/backends
/*/Makefile.inc
390 include $(YOSYS_SRC
)/techlibs
/*/Makefile.inc
394 include frontends
/verilog
/Makefile.inc
395 include frontends
/ilang
/Makefile.inc
396 include frontends
/ast
/Makefile.inc
397 include frontends
/blif
/Makefile.inc
399 OBJS
+= passes
/hierarchy
/hierarchy.o
400 OBJS
+= passes
/cmds
/select.o
401 OBJS
+= passes
/cmds
/show.o
402 OBJS
+= passes
/cmds
/stat.o
403 OBJS
+= passes
/cmds
/cover.o
404 OBJS
+= passes
/cmds
/design.o
405 OBJS
+= passes
/cmds
/plugin.o
407 include passes
/proc
/Makefile.inc
408 include passes
/opt
/Makefile.inc
409 include passes
/techmap
/Makefile.inc
411 include backends
/verilog
/Makefile.inc
412 include backends
/ilang
/Makefile.inc
414 include techlibs
/common
/Makefile.inc
418 top-all
: $(TARGETS
) $(EXTRA_TARGETS
)
420 @echo
" Build successful."
423 ifeq ($(CONFIG
),emcc
)
424 yosys.js
: $(filter-out yosysjs-
$(YOSYS_VER
).zip
,$(EXTRA_TARGETS
))
428 $(P
) $(LD
) -o yosys
$(EXE
) $(LDFLAGS
) $(OBJS
) $(LDLIBS
)
430 libyosys.so
: $(filter-out kernel
/driver.o
,$(OBJS
))
431 $(P
) $(LD
) -o libyosys.so
-shared
-Wl
,-soname
,libyosys.so
$(LDFLAGS
) $^
$(LDLIBS
)
434 $(Q
) mkdir
-p
$(dir $@
)
435 $(P
) $(CXX
) -o
$@
-c
$(CPPFLAGS
) $(CXXFLAGS
) $<
438 $(Q
) mkdir
-p
$(dir $@
)
439 $(P
) $(CXX
) -o
$@
-c
$(CPPFLAGS
) $(CXXFLAGS
) $<
441 YOSYS_VER_STR
:= Yosys
$(YOSYS_VER
) (git sha1
$(GIT_REV
), $(notdir $(CXX
)) $(shell \
442 $(CXX
) --version | tr
' ()' '\n' | grep
'^[0-9]' | head
-n1
) $(filter -f
% -m
% -O
% -DNDEBUG
,$(CXXFLAGS
)))
444 kernel
/version_
$(GIT_REV
).
cc: $(YOSYS_SRC
)/Makefile
445 $(P
) rm -f kernel
/version_
*.o kernel
/version_
*.d kernel
/version_
*.
cc
446 $(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
448 ifeq ($(ENABLE_VERIFIC
),1)
449 CXXFLAGS_NOVERIFIC
= $(foreach v
,$(CXXFLAGS
),$(if
$(findstring $(VERIFIC_DIR
),$(v
)),,$(v
)))
450 LDLIBS_NOVERIFIC
= $(foreach v
,$(LDLIBS
),$(if
$(findstring $(VERIFIC_DIR
),$(v
)),,$(v
)))
452 CXXFLAGS_NOVERIFIC
= $(CXXFLAGS
)
453 LDLIBS_NOVERIFIC
= $(LDLIBS
)
456 yosys-config
: misc
/yosys-config.in
457 $(P
) $(SED
) -e
's#@CXXFLAGS@#$(subst -I. -I"$(YOSYS_SRC)",-I"$(DATDIR)/include",$(strip $(CXXFLAGS_NOVERIFIC)))#;' \
458 -e
's#@CXX@#$(strip $(CXX))#;' -e
's#@LDFLAGS@#$(strip $(LDFLAGS) $(PLUGIN_LDFLAGS))#;' -e
's#@LDLIBS@#$(strip $(LDLIBS_NOVERIFIC))#;' \
459 -e
's#@BINDIR@#$(strip $(BINDIR))#;' -e
's#@DATDIR@#$(strip $(DATDIR))#;' < $< > yosys-config
460 $(Q
) chmod
+x yosys-config
462 abc
/abc-
$(ABCREV
)$(EXE
):
464 ifneq ($(ABCREV
),default
)
465 $(Q
) if
test -d abc
/.hg
; then \
466 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
; \
468 $(Q
) if
( cd abc
2> /dev
/null
&& ! git diff-index
--quiet HEAD
; ); then \
469 echo
'REEBE: NOP pbagnvaf ybpny zbqvsvpngvbaf! Frg NOPERI=qrsnhyg va Lbflf Znxrsvyr!' | tr
'A-Za-z' 'N-ZA-Mn-za-m'; false
; \
471 $(Q
) if
test "`cd abc 2> /dev/null && git rev-parse --short HEAD`" != "$(ABCREV)"; then \
472 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; }; \
473 echo
"Pulling ABC from $(ABCURL):"; set
-x
; \
474 test -d abc || git clone
$(ABCURL
) abc
; \
475 cd abc
&& $(MAKE
) DEP
= clean && git fetch
origin master
&& git checkout
$(ABCREV
); \
478 $(Q
) rm -f abc
/abc-
[0-9a-f
]*
479 $(Q
) cd abc
&& $(MAKE
) $(S
) $(ABCMKARGS
) PROG
="abc-$(ABCREV)$(EXE)" MSG_PREFIX
="$(eval P_OFFSET = 5)$(call P_SHOW)$(eval P_OFFSET = 10) ABC: "
481 ifeq ($(ABCREV
),default
)
482 .PHONY
: abc
/abc-
$(ABCREV
)$(EXE
)
485 yosys-abc
$(EXE
): abc
/abc-
$(ABCREV
)$(EXE
)
486 $(P
) cp abc
/abc-
$(ABCREV
)$(EXE
) yosys-abc
$(EXE
)
494 test: $(TARGETS
) $(EXTRA_TARGETS
)
495 +cd tests
/simple
&& bash run-test.sh
$(SEEDOPT
)
496 +cd tests
/hana
&& bash run-test.sh
$(SEEDOPT
)
497 +cd tests
/asicworld
&& bash run-test.sh
$(SEEDOPT
)
498 +cd tests
/realmath
&& bash run-test.sh
$(SEEDOPT
)
499 +cd tests
/share
&& bash run-test.sh
$(SEEDOPT
)
500 +cd tests
/fsm
&& bash run-test.sh
$(SEEDOPT
)
501 +cd tests
/techmap
&& bash run-test.sh
502 +cd tests
/memories
&& bash run-test.sh
$(SEEDOPT
)
503 +cd tests
/bram
&& bash run-test.sh
$(SEEDOPT
)
504 +cd tests
/various
&& bash run-test.sh
505 +cd tests
/sat
&& bash run-test.sh
507 @echo
" Passed \"make test\"."
510 VALGRIND ?
= valgrind
--error-exitcode
=1 --leak-check
=full
--show-reachable
=yes
--errors-for-leak-kinds
=all
512 vgtest
: $(TARGETS
) $(EXTRA_TARGETS
)
513 $(VALGRIND
) .
/yosys
-p
'setattr -mod -unset top; synth' $$( ls tests
/simple
/*.v | grep
-v repwhile.v
)
515 @echo
" Passed \"make vgtest\"."
518 vloghtb
: $(TARGETS
) $(EXTRA_TARGETS
)
519 +cd tests
/vloghtb
&& bash run-test.sh
521 @echo
" Passed \"make vloghtb\"."
525 unit-test
: libyosys.so
526 @
$(MAKE
) -C
$(UNITESTPATH
) CXX
="$(CXX)" CPPFLAGS
="$(CPPFLAGS)" \
527 CXXFLAGS
="$(CXXFLAGS)" LDLIBS
="$(LDLIBS)" ROOTPATH
="$(CURDIR)"
530 @
$(MAKE
) -C
$(UNITESTPATH
) clean
532 install: $(TARGETS
) $(EXTRA_TARGETS
)
533 $(INSTALL_SUDO
) mkdir
-p
$(DESTDIR
)$(BINDIR
)
534 $(INSTALL_SUDO
) cp
$(TARGETS
) $(DESTDIR
)$(BINDIR
)
535 ifneq ($(filter yosys
,$(TARGETS
)),)
536 $(INSTALL_SUDO
) $(STRIP
) -S
$(DESTDIR
)$(BINDIR
)/yosys
538 ifneq ($(filter yosys-abc
,$(TARGETS
)),)
539 $(INSTALL_SUDO
) $(STRIP
) $(DESTDIR
)$(BINDIR
)/yosys-abc
541 ifneq ($(filter yosys-filterlib
,$(TARGETS
)),)
542 $(INSTALL_SUDO
) $(STRIP
) $(DESTDIR
)$(BINDIR
)/yosys-filterlib
544 $(INSTALL_SUDO
) mkdir
-p
$(DESTDIR
)$(DATDIR
)
545 $(INSTALL_SUDO
) cp
-r share
/.
$(DESTDIR
)$(DATDIR
)/.
546 ifeq ($(ENABLE_LIBYOSYS
),1)
547 $(INSTALL_SUDO
) cp libyosys.so
$(DESTDIR
)$(LIBDIR
)
548 $(INSTALL_SUDO
) $(STRIP
) -S
$(DESTDIR
)$(LIBDIR
)/libyosys.so
549 $(INSTALL_SUDO
) ldconfig
553 $(INSTALL_SUDO
) rm -vf
$(addprefix $(DESTDIR
)$(BINDIR
)/,$(notdir $(TARGETS
)))
554 $(INSTALL_SUDO
) rm -rvf
$(DESTDIR
)$(DATDIR
)
555 ifeq ($(ENABLE_LIBYOSYS
),1)
556 $(INSTALL_SUDO
) rm -vf
$(DESTDIR
)$(LIBDIR
)/libyosys.so
559 update-manual
: $(TARGETS
) $(EXTRA_TARGETS
)
560 cd manual
&& ..
/yosys
-p
'help -write-tex-command-reference-manual'
562 manual
: $(TARGETS
) $(EXTRA_TARGETS
)
563 cd manual
&& bash appnotes.sh
564 cd manual
&& bash presentation.sh
565 cd manual
&& bash manual.sh
569 if
test -d manual
; then cd manual
&& sh
clean.sh
; fi
570 rm -f
$(OBJS
) $(GENFILES
) $(TARGETS
) $(EXTRA_TARGETS
) $(EXTRA_OBJS
)
571 rm -f kernel
/version_
*.o kernel
/version_
*.
cc abc
/abc-
[0-9a-f
]*
572 rm -f libs
/*/*.d frontends
/*/*.d passes
/*/*.d backends
/*/*.d kernel
/*.d techlibs
/*/*.d
573 rm -rf tests
/asicworld
/*.out tests
/asicworld
/*.log
574 rm -rf tests
/hana
/*.out tests
/hana
/*.log
575 rm -rf tests
/simple
/*.out tests
/simple
/*.log
576 rm -rf tests
/memories
/*.out tests
/memories
/*.log tests
/memories
/*.dmp
577 rm -rf tests
/sat
/*.log tests
/techmap
/*.log tests
/various
/*.log
578 rm -rf tests
/bram
/temp tests
/fsm
/temp tests
/realmath
/temp tests
/share
/temp tests
/smv
/temp
579 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_
*
580 rm -f tests
/tools
/cmp_tbdata
583 $(MAKE
) -C abc DEP
= clean
584 rm -f yosys-abc
$(EXE
) abc
/abc-
[0-9a-f
]*
590 { for file in
$(basename $(OBJS
)); do \
591 for
prefix in
cc y l
; do if
[ -f
$${file}.
$${prefix} ]; then echo
$$file.
$${prefix}; fi
; done \
592 done
; find backends frontends kernel libs passes
-type f \
( -name
'*.h' -o
-name
'*.hh' \
); } > qtcreator.files
593 { echo .
; find backends frontends kernel libs passes
-type f \
( -name
'*.h' -o
-name
'*.hh' \
) -printf
'%h\n' |
sort -u
; } > qtcreator.includes
594 touch qtcreator.config qtcreator.creator
596 vcxsrc
: $(GENFILES
) $(EXTRA_TARGETS
)
597 rm -rf yosys-win32-vcxsrc-
$(YOSYS_VER
){,.zip
}
598 set
-e
; for f in
`ls $(filter %.cc %.cpp,$(GENFILES)) $(addsuffix .cc,$(basename $(OBJS))) $(addsuffix .cpp,$(basename $(OBJS))) 2> /dev/null`; do \
599 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
600 bash misc
/create_vcxsrc.sh yosys-win32-vcxsrc
$(YOSYS_VER
) $(GIT_REV
)
601 echo
"namespace Yosys { extern const char *yosys_version_str; const char *yosys_version_str=\"Yosys (Version Information Unavailable)\"; }" > kernel
/version.
cc
602 zip yosys-win32-vcxsrc-
$(YOSYS_VER
)/genfiles.zip
$(GENFILES
) kernel
/version.
cc
603 zip
-r yosys-win32-vcxsrc-
$(YOSYS_VER
).zip yosys-win32-vcxsrc-
$(YOSYS_VER
)/
604 rm -f srcfiles.txt kernel
/version.
cc
607 mxebin
: $(TARGETS
) $(EXTRA_TARGETS
)
608 rm -rf yosys-win32-mxebin-
$(YOSYS_VER
){,.zip
}
609 mkdir
-p yosys-win32-mxebin-
$(YOSYS_VER
)
610 cp
-r yosys.exe share
/ yosys-win32-mxebin-
$(YOSYS_VER
)/
611 ifeq ($(ENABLE_ABC
),1)
612 cp
-r yosys-abc.exe abc
/lib
/x86
/pthreadVC2.dll yosys-win32-mxebin-
$(YOSYS_VER
)/
614 echo
-en
'This is Yosys $(YOSYS_VER) for Win32.\r\n' > yosys-win32-mxebin-
$(YOSYS_VER
)/readme.txt
615 echo
-en
'Documentation at http://www.clifford.at/yosys/.\r\n' >> yosys-win32-mxebin-
$(YOSYS_VER
)/readme.txt
616 zip
-r yosys-win32-mxebin-
$(YOSYS_VER
).zip yosys-win32-mxebin-
$(YOSYS_VER
)/
623 echo
'CONFIG := clang' > Makefile.conf
626 echo
'CONFIG := gcc' > Makefile.conf
628 config-gcc-4.8
: clean
629 echo
'CONFIG := gcc-4.8' > Makefile.conf
632 echo
'CONFIG := emcc' > Makefile.conf
633 echo
'ENABLE_TCL := 0' >> Makefile.conf
634 echo
'ENABLE_ABC := 0' >> Makefile.conf
635 echo
'ENABLE_PLUGINS := 0' >> Makefile.conf
636 echo
'ENABLE_READLINE := 0' >> Makefile.conf
639 echo
'CONFIG := mxe' > Makefile.conf
640 echo
'ENABLE_PLUGINS := 0' >> Makefile.conf
643 echo
'CONFIG := msys2' > Makefile.conf
646 echo
'CONFIG := gcc' > Makefile.conf
647 echo
'ENABLE_GPROF := 1' >> Makefile.conf
650 echo
"INSTALL_SUDO := sudo" >> Makefile.conf
659 -include frontends
/*/*.d
660 -include passes
/*/*.d
661 -include backends
/*/*.d
663 -include techlibs
/*/*.d
665 .PHONY
: all top-all abc
test install install-abc manual
clean mrproper qtcreator
666 .PHONY
: config-clean config-clang config-gcc config-gcc-4.8 config-gprof config-sudo