9 # features (the more the better)
19 # other configuration flags
26 # Needed for environments that don't have proper thread support (i.e. emscripten)
27 DISABLE_ABC_THREADS
:= 0
33 # SANITIZER = undefined
37 OS
:= $(shell uname
-s
)
41 BINDIR
:= $(PREFIX
)/bin
42 LIBDIR
:= $(PREFIX
)/lib
43 DATDIR
:= $(PREFIX
)/share
/yosys
50 TARGETS
= yosys
$(EXE
) yosys-config
56 UNITESTPATH
:= tests
/unit
60 YOSYS_SRC
:= $(dir $(firstword $(MAKEFILE_LIST
)))
63 CXXFLAGS
:= $(CXXFLAGS
) -Wall
-Wextra
-ggdb
-I.
-I
"$(YOSYS_SRC)" -MD
-D_YOSYS_
-fPIC
-I
$(PREFIX
)/include
64 LDFLAGS
:= $(LDFLAGS
) -L
$(LIBDIR
)
65 LDLIBS
:= $(LDLIBS
) -lstdc
++ -lm
68 PKG_CONFIG ?
= pkg-config
74 PLUGIN_LDFLAGS
+= -undefined dynamic_lookup
76 # homebrew search paths
77 ifneq ($(shell which brew
),)
78 BREW_PREFIX
:= $(shell brew
--prefix)/opt
79 CXXFLAGS
+= -I
$(BREW_PREFIX
)/readline
/include
80 LDFLAGS
+= -L
$(BREW_PREFIX
)/readline
/lib
81 PKG_CONFIG_PATH
:= $(BREW_PREFIX
)/libffi
/lib
/pkgconfig
:$(PKG_CONFIG_PATH
)
82 PKG_CONFIG_PATH
:= $(BREW_PREFIX
)/tcl-tk
/lib
/pkgconfig
:$(PKG_CONFIG_PATH
)
83 export PATH
:= $(BREW_PREFIX
)/bison
/bin
:$(BREW_PREFIX
)/gettext
/bin
:$(BREW_PREFIX
)/flex
/bin
:$(PATH
)
85 # macports search paths
86 else ifneq ($(shell which port
),)
87 PORT_PREFIX
:= $(patsubst %/bin
/port
,%,$(shell which port
))
88 CXXFLAGS
+= -I
$(PORT_PREFIX
)/include
89 LDFLAGS
+= -L
$(PORT_PREFIX
)/lib
90 PKG_CONFIG_PATH
:= $(PORT_PREFIX
)/lib
/pkgconfig
:$(PKG_CONFIG_PATH
)
91 export PATH
:= $(PORT_PREFIX
)/bin
:$(PATH
)
99 YOSYS_VER
:= 0.7+$(shell cd
$(YOSYS_SRC
) && test -e .git
&& { git log
--author
=clifford@clifford.at
--oneline
61f6811.. | wc
-l
; })
100 GIT_REV
:= $(shell cd
$(YOSYS_SRC
) && git rev-parse
--short HEAD
2> /dev
/null || echo UNKNOWN
)
101 OBJS
= kernel
/version_
$(GIT_REV
).o
103 # set 'ABCREV = default' to use abc/ as it is
105 # Note: If you do ABC development, make sure that 'abc' in this directory
106 # is just a symlink to your actual ABC working directory, as 'make mrproper'
107 # will remove the 'abc' directory and you do not want to accidentally
108 # delete your work on ABC..
111 ABCURL ?
= https
://github.com
/berkeley-abc
/abc
112 ABCMKARGS
= CC
="$(CXX)" CXX
="$(CXX)" ABC_USE_LIBSTDCXX
=1
114 # set ABCEXTERNAL = <abc-command> to use an external ABC instance
115 # Note: The in-tree ABC (yosys-abc) will not be installed when ABCEXTERNAL is set.
123 ifneq ($(wildcard Makefile.conf
),)
124 $(info $(subst $$--$$,$(newline
),$(shell sed
's,^,[Makefile.conf] ,; s,$$,$$--$$,;' < Makefile.conf | tr
-d
'\n' | sed
's,\$$--\$$$$,,')))
125 include Makefile.conf
128 ifeq ($(CONFIG
),clang
)
131 CXXFLAGS
+= -std
=c
++11 -Os
132 ABCMKARGS
+= ARCHFLAGS
="-DABC_USE_STDINT_H"
134 ifneq ($(SANITIZER
),)
135 $(info [Clang Sanitizer
] $(SANITIZER
))
136 CXXFLAGS
+= -g
-O1
-fno-omit-frame-pointer
-fno-optimize-sibling-calls
-fsanitize
=$(SANITIZER
)
137 LDFLAGS
+= -g
-fsanitize
=$(SANITIZER
)
138 ifeq ($(SANITIZER
),address
)
141 ifeq ($(SANITIZER
),memory
)
142 CXXFLAGS
+= -fPIE
-fsanitize-memory-track-origins
143 LDFLAGS
+= -fPIE
-fsanitize-memory-track-origins
145 ifeq ($(SANITIZER
),cfi
)
151 else ifeq ($(CONFIG
),gcc
)
154 CXXFLAGS
+= -std
=c
++11 -Os
155 ABCMKARGS
+= ARCHFLAGS
="-DABC_USE_STDINT_H"
157 else ifeq ($(CONFIG
),gcc-4.8
)
160 CXXFLAGS
+= -std
=c
++11 -Os
161 ABCMKARGS
+= ARCHFLAGS
="-DABC_USE_STDINT_H"
163 else ifeq ($(CONFIG
),emcc
)
166 CXXFLAGS
:= -std
=c
++11 $(filter-out -fPIC
-ggdb
,$(CXXFLAGS
))
167 ABCMKARGS
+= ARCHFLAGS
="-DABC_USE_STDINT_H -DABC_MEMALIGN=8"
168 EMCCFLAGS
:= -Os
-Wno-warn-absolute-paths
169 EMCCFLAGS
+= --memory-init-file
0 --embed-file share
-s NO_EXIT_RUNTIME
=1
170 EMCCFLAGS
+= -s EXPORTED_FUNCTIONS
="['_main','_run','_prompt','_errmsg']"
171 EMCCFLAGS
+= -s TOTAL_MEMORY
=128*1024*1024
172 # https://github.com/kripken/emscripten/blob/master/src/settings.js
173 CXXFLAGS
+= $(EMCCFLAGS
)
174 LDFLAGS
+= $(EMCCFLAGS
)
178 TARGETS
:= $(filter-out yosys-config
,$(TARGETS
))
179 EXTRA_TARGETS
+= yosysjs-
$(YOSYS_VER
).zip
181 ifeq ($(ENABLE_ABC
),1)
183 DISABLE_ABC_THREADS
:= 1
187 wget
-O viz.js.part https
://github.com
/mdaines
/viz.js
/releases
/download
/0.0.3/viz.js
188 mv viz.js.part viz.js
190 yosysjs-
$(YOSYS_VER
).zip
: yosys.js viz.js misc
/yosysjs
/*
191 rm -rf yosysjs-
$(YOSYS_VER
) yosysjs-
$(YOSYS_VER
).zip
192 mkdir
-p yosysjs-
$(YOSYS_VER
)
193 cp viz.js misc
/yosysjs
/* yosys.js yosysjs-
$(YOSYS_VER
)/
194 zip
-r yosysjs-
$(YOSYS_VER
).zip yosysjs-
$(YOSYS_VER
)
196 yosys.html
: misc
/yosys.html
197 $(P
) cp misc
/yosys.html yosys.html
199 else ifeq ($(CONFIG
),mxe
)
200 PKG_CONFIG
= /usr
/local
/src
/mxe
/usr
/bin
/i686-w64-mingw32.static-pkg-config
201 CXX
= /usr
/local
/src
/mxe
/usr
/bin
/i686-w64-mingw32.static-gcc
202 LD
= /usr
/local
/src
/mxe
/usr
/bin
/i686-w64-mingw32.static-gcc
203 CXXFLAGS
+= -std
=c
++11 -Os
-D_POSIX_SOURCE
-DYOSYS_MXE_HACKS
-Wno-attributes
204 CXXFLAGS
:= $(filter-out -fPIC
,$(CXXFLAGS
))
205 LDFLAGS
:= $(filter-out -rdynamic
,$(LDFLAGS
)) -s
206 LDLIBS
:= $(filter-out -lrt
,$(LDLIBS
))
207 ABCMKARGS
+= ARCHFLAGS
="-DABC_USE_STDINT_H -DWIN32_NO_DLL -DHAVE_STRUCT_TIMESPEC -fpermissive -w"
208 ABCMKARGS
+= LIBS
="lib/x86/pthreadVC2.lib -s" ABC_USE_NO_READLINE
=1
211 else ifeq ($(CONFIG
),msys2
)
212 CXX
= i686-w64-mingw32-g
++
213 LD
= i686-w64-mingw32-g
++
214 CXXFLAGS
+= -std
=c
++11 -Os
-D_POSIX_SOURCE
-DYOSYS_WIN32_UNIX_DIR
215 CXXFLAGS
:= $(filter-out -fPIC
,$(CXXFLAGS
))
216 LDFLAGS
:= $(filter-out -rdynamic
,$(LDFLAGS
)) -s
217 LDLIBS
:= $(filter-out -lrt
,$(LDLIBS
))
218 ABCMKARGS
+= ARCHFLAGS
="-DABC_USE_STDINT_H -DWIN32_NO_DLL -DHAVE_STRUCT_TIMESPEC -fpermissive -w"
219 ABCMKARGS
+= LIBS
="lib/x86/pthreadVC2.lib -s" ABC_USE_NO_READLINE
=0
222 else ifneq ($(CONFIG
),none
)
223 $(error Invalid CONFIG setting
'$(CONFIG)'. Valid values
: clang
, gcc
, gcc-4.8
, emcc
, mxe
, msys2
)
226 ifeq ($(ENABLE_LIBYOSYS
),1)
227 TARGETS
+= libyosys.so
230 ifeq ($(ENABLE_READLINE
),1)
231 CXXFLAGS
+= -DYOSYS_ENABLE_READLINE
232 ifeq ($(OS
), FreeBSD
)
233 CXXFLAGS
+= -I
/usr
/local
/include
236 ifeq ($(LINK_CURSES
),1)
238 ABCMKARGS
+= "ABC_READLINE_LIBRARIES=-lcurses -lreadline"
240 ifeq ($(LINK_TERMCAP
),1)
242 ABCMKARGS
+= "ABC_READLINE_LIBRARIES=-lreadline -ltermcap"
248 ifeq ($(ENABLE_EDITLINE
),1)
249 CXXFLAGS
+= -DYOSYS_ENABLE_EDITLINE
250 LDLIBS
+= -ledit
-ltinfo
-lbsd
252 ABCMKARGS
+= "ABC_USE_NO_READLINE=1"
256 ifeq ($(DISABLE_ABC_THREADS
),1)
257 ABCMKARGS
+= "ABC_USE_NO_PTHREADS=1"
260 ifeq ($(ENABLE_PLUGINS
),1)
261 CXXFLAGS
+= $(shell PKG_CONFIG_PATH
=$(PKG_CONFIG_PATH
) $(PKG_CONFIG
) --silence-errors
--cflags libffi
) -DYOSYS_ENABLE_PLUGINS
262 LDLIBS
+= $(shell PKG_CONFIG_PATH
=$(PKG_CONFIG_PATH
) $(PKG_CONFIG
) --silence-errors
--libs libffi || echo
-lffi
)
263 ifneq ($(OS
), FreeBSD
)
268 ifeq ($(ENABLE_TCL
),1)
269 TCL_VERSION ?
= tcl
$(shell bash
-c
"tclsh <(echo 'puts [info tclversion]')")
270 ifeq ($(OS
), FreeBSD
)
271 TCL_INCLUDE ?
= /usr
/local
/include/$(TCL_VERSION
)
273 TCL_INCLUDE ?
= /usr
/include/$(TCL_VERSION
)
277 CXXFLAGS
+= -DYOSYS_ENABLE_TCL
278 LDLIBS
+= -ltcl86
-lwsock32
-lws2_32
-lnetapi32
280 CXXFLAGS
+= $(shell PKG_CONFIG_PATH
=$(PKG_CONFIG_PATH
) $(PKG_CONFIG
) --silence-errors
--cflags tcl || echo
-I
$(TCL_INCLUDE
)) -DYOSYS_ENABLE_TCL
281 ifeq ($(OS
), FreeBSD
)
282 # FreeBSD uses tcl8.6, but lib is named "libtcl86"
283 LDLIBS
+= $(shell PKG_CONFIG_PATH
=$(PKG_CONFIG_PATH
) $(PKG_CONFIG
) --silence-errors
--libs tcl || echo
-l
$(TCL_VERSION
) | tr
-d
'.')
285 LDLIBS
+= $(shell PKG_CONFIG_PATH
=$(PKG_CONFIG_PATH
) $(PKG_CONFIG
) --silence-errors
--libs tcl || echo
-l
$(TCL_VERSION
))
290 ifeq ($(ENABLE_GPROF
),1)
295 ifeq ($(ENABLE_NDEBUG
),1)
296 CXXFLAGS
:= -O3
-DNDEBUG
$(filter-out -Os
-ggdb
,$(CXXFLAGS
))
299 ifeq ($(ENABLE_DEBUG
),1)
300 ifeq ($(CONFIG
),clang
)
301 CXXFLAGS
:= -O0
-DDEBUG
$(filter-out -Os
,$(CXXFLAGS
))
303 CXXFLAGS
:= -Og
-DDEBUG
$(filter-out -Os
,$(CXXFLAGS
))
307 ifeq ($(ENABLE_ABC
),1)
308 CXXFLAGS
+= -DYOSYS_ENABLE_ABC
310 CXXFLAGS
+= -DYOSYS_LINK_ABC
311 ifeq ($(DISABLE_ABC_THREADS
),0)
315 ifeq ($(ABCEXTERNAL
),)
316 TARGETS
+= yosys-abc
$(EXE
)
321 ifeq ($(ENABLE_VERIFIC
),1)
322 VERIFIC_DIR ?
= /usr
/local
/src
/verific_lib_eval
323 VERIFIC_COMPONENTS ?
= verilog vhdl database util containers sdf hier_tree
324 CXXFLAGS
+= $(patsubst %,-I
$(VERIFIC_DIR
)/%,$(VERIFIC_COMPONENTS
)) -DYOSYS_ENABLE_VERIFIC
325 LDLIBS
+= $(patsubst %,$(VERIFIC_DIR
)/%/*-linux.a
,$(VERIFIC_COMPONENTS
)) -lz
328 ifeq ($(ENABLE_COVER
),1)
329 CXXFLAGS
+= -DYOSYS_ENABLE_COVER
332 define add_share_file
333 EXTRA_TARGETS
+= $(subst //,/,$(1)/$(notdir $(2)))
334 $(subst //,/,$(1)/$(notdir $(2))): $(2)
336 $$(Q
) cp
"$(YOSYS_SRC)"/$(2) $(subst //,/,$(1)/$(notdir $(2)))
339 define add_gen_share_file
340 EXTRA_TARGETS
+= $(subst //,/,$(1)/$(notdir $(2)))
341 $(subst //,/,$(1)/$(notdir $(2))): $(2)
343 $$(Q
) cp
$(2) $(subst //,/,$(1)/$(notdir $(2)))
346 define add_include_file
347 $(eval
$(call add_share_file
,$(dir share
/include/$(1)),$(1)))
353 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; }'))
354 P_SHOW
= [$(shell gawk
"BEGIN { N=$(words $(OBJS) yosys$(EXE)); printf \"%3d\", $(P_OFFSET)+90*$(P_STATUS)/N; exit; }")%]
355 P
= @echo
"$(if $(findstring $@,$(TARGETS) $(EXTRA_TARGETS)),$(eval P_OFFSET = 10))$(call P_UPDATE)$(call P_SHOW) Building $@";
365 $(eval
$(call add_include_file
,kernel
/yosys.h
))
366 $(eval
$(call add_include_file
,kernel
/hashlib.h
))
367 $(eval
$(call add_include_file
,kernel
/log.h
))
368 $(eval
$(call add_include_file
,kernel
/rtlil.h
))
369 $(eval
$(call add_include_file
,kernel
/register.h
))
370 $(eval
$(call add_include_file
,kernel
/celltypes.h
))
371 $(eval
$(call add_include_file
,kernel
/celledges.h
))
372 $(eval
$(call add_include_file
,kernel
/consteval.h
))
373 $(eval
$(call add_include_file
,kernel
/sigtools.h
))
374 $(eval
$(call add_include_file
,kernel
/modtools.h
))
375 $(eval
$(call add_include_file
,kernel
/macc.h
))
376 $(eval
$(call add_include_file
,kernel
/utils.h
))
377 $(eval
$(call add_include_file
,kernel
/satgen.h
))
378 $(eval
$(call add_include_file
,libs
/ezsat
/ezsat.h
))
379 $(eval
$(call add_include_file
,libs
/ezsat
/ezminisat.h
))
380 $(eval
$(call add_include_file
,libs
/sha1
/sha1.h
))
381 $(eval
$(call add_include_file
,passes
/fsm
/fsmdata.h
))
382 $(eval
$(call add_include_file
,frontends
/ast
/ast.h
))
383 $(eval
$(call add_include_file
,backends
/ilang
/ilang_backend.h
))
385 OBJS
+= kernel
/driver.o kernel
/register.o kernel
/rtlil.o kernel
/log.o kernel
/calc.o kernel
/yosys.o
386 OBJS
+= kernel
/cellaigs.o kernel
/celledges.o
388 kernel
/log.o
: CXXFLAGS
+= -DYOSYS_SRC
='"$(YOSYS_SRC)"'
389 kernel
/yosys.o
: CXXFLAGS
+= -DYOSYS_DATDIR
='"$(DATDIR)"'
391 OBJS
+= libs
/bigint
/BigIntegerAlgorithms.o libs
/bigint
/BigInteger.o libs
/bigint
/BigIntegerUtils.o
392 OBJS
+= libs
/bigint
/BigUnsigned.o libs
/bigint
/BigUnsignedInABase.o
394 OBJS
+= libs
/sha1
/sha1.o
398 OBJS
+= libs
/subcircuit
/subcircuit.o
400 OBJS
+= libs
/ezsat
/ezsat.o
401 OBJS
+= libs
/ezsat
/ezminisat.o
403 OBJS
+= libs
/minisat
/Options.o
404 OBJS
+= libs
/minisat
/SimpSolver.o
405 OBJS
+= libs
/minisat
/Solver.o
406 OBJS
+= libs
/minisat
/System.o
408 include $(YOSYS_SRC
)/frontends
/*/Makefile.inc
409 include $(YOSYS_SRC
)/passes
/*/Makefile.inc
410 include $(YOSYS_SRC
)/backends
/*/Makefile.inc
411 include $(YOSYS_SRC
)/techlibs
/*/Makefile.inc
415 include frontends
/verilog
/Makefile.inc
416 include frontends
/ilang
/Makefile.inc
417 include frontends
/ast
/Makefile.inc
418 include frontends
/blif
/Makefile.inc
420 OBJS
+= passes
/hierarchy
/hierarchy.o
421 OBJS
+= passes
/cmds
/select.o
422 OBJS
+= passes
/cmds
/show.o
423 OBJS
+= passes
/cmds
/stat.o
424 OBJS
+= passes
/cmds
/cover.o
425 OBJS
+= passes
/cmds
/design.o
426 OBJS
+= passes
/cmds
/plugin.o
428 include passes
/proc
/Makefile.inc
429 include passes
/opt
/Makefile.inc
430 include passes
/techmap
/Makefile.inc
432 include backends
/verilog
/Makefile.inc
433 include backends
/ilang
/Makefile.inc
435 include techlibs
/common
/Makefile.inc
440 OBJS
+= yosys-libabc.a
443 top-all
: $(TARGETS
) $(EXTRA_TARGETS
)
445 @echo
" Build successful."
448 ifeq ($(CONFIG
),emcc
)
449 yosys.js
: $(filter-out yosysjs-
$(YOSYS_VER
).zip
,$(EXTRA_TARGETS
))
453 $(P
) $(LD
) -o yosys
$(EXE
) $(LDFLAGS
) $(OBJS
) $(LDLIBS
)
455 libyosys.so
: $(filter-out kernel
/driver.o
,$(OBJS
))
456 $(P
) $(LD
) -o libyosys.so
-shared
-Wl
,-soname
,libyosys.so
$(LDFLAGS
) $^
$(LDLIBS
)
459 $(Q
) mkdir
-p
$(dir $@
)
460 $(P
) $(CXX
) -o
$@
-c
$(CPPFLAGS
) $(CXXFLAGS
) $<
463 $(Q
) mkdir
-p
$(dir $@
)
464 $(P
) $(CXX
) -o
$@
-c
$(CPPFLAGS
) $(CXXFLAGS
) $<
466 YOSYS_VER_STR
:= Yosys
$(YOSYS_VER
) (git sha1
$(GIT_REV
), $(notdir $(CXX
)) $(shell \
467 $(CXX
) --version | tr
' ()' '\n' | grep
'^[0-9]' | head
-n1
) $(filter -f
% -m
% -O
% -DNDEBUG
,$(CXXFLAGS
)))
469 kernel
/version_
$(GIT_REV
).
cc: $(YOSYS_SRC
)/Makefile
470 $(P
) rm -f kernel
/version_
*.o kernel
/version_
*.d kernel
/version_
*.
cc
471 $(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
473 ifeq ($(ENABLE_VERIFIC
),1)
474 CXXFLAGS_NOVERIFIC
= $(foreach v
,$(CXXFLAGS
),$(if
$(findstring $(VERIFIC_DIR
),$(v
)),,$(v
)))
475 LDLIBS_NOVERIFIC
= $(foreach v
,$(LDLIBS
),$(if
$(findstring $(VERIFIC_DIR
),$(v
)),,$(v
)))
477 CXXFLAGS_NOVERIFIC
= $(CXXFLAGS
)
478 LDLIBS_NOVERIFIC
= $(LDLIBS
)
481 yosys-config
: misc
/yosys-config.in
482 $(P
) $(SED
) -e
's#@CXXFLAGS@#$(subst -I. -I"$(YOSYS_SRC)",-I"$(DATDIR)/include",$(strip $(CXXFLAGS_NOVERIFIC)))#;' \
483 -e
's#@CXX@#$(strip $(CXX))#;' -e
's#@LDFLAGS@#$(strip $(LDFLAGS) $(PLUGIN_LDFLAGS))#;' -e
's#@LDLIBS@#$(strip $(LDLIBS_NOVERIFIC))#;' \
484 -e
's#@BINDIR@#$(strip $(BINDIR))#;' -e
's#@DATDIR@#$(strip $(DATDIR))#;' < $< > yosys-config
485 $(Q
) chmod
+x yosys-config
487 abc
/abc-
$(ABCREV
)$(EXE
) abc
/libabc-
$(ABCREV
).a
:
489 ifneq ($(ABCREV
),default
)
490 $(Q
) if
test -d abc
/.hg
; then \
491 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
; \
493 $(Q
) if
( cd abc
2> /dev
/null
&& ! git diff-index
--quiet HEAD
; ); then \
494 echo
'REEBE: NOP pbagnvaf ybpny zbqvsvpngvbaf! Frg NOPERI=qrsnhyg va Lbflf Znxrsvyr!' | tr
'A-Za-z' 'N-ZA-Mn-za-m'; false
; \
496 $(Q
) if
test "`cd abc 2> /dev/null && git rev-parse --short HEAD`" != "$(ABCREV)"; then \
497 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; }; \
498 echo
"Pulling ABC from $(ABCURL):"; set
-x
; \
499 test -d abc || git clone
$(ABCURL
) abc
; \
500 cd abc
&& $(MAKE
) DEP
= clean && git fetch
origin master
&& git checkout
$(ABCREV
); \
503 $(Q
) rm -f abc
/abc-
[0-9a-f
]*
504 $(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
)
506 ifeq ($(ABCREV
),default
)
507 .PHONY
: abc
/abc-
$(ABCREV
)$(EXE
)
508 .PHONY
: abc
/libabc-
$(ABCREV
).a
511 yosys-abc
$(EXE
): abc
/abc-
$(ABCREV
)$(EXE
)
512 $(P
) cp abc
/abc-
$(ABCREV
)$(EXE
) yosys-abc
$(EXE
)
514 yosys-libabc.a
: abc
/libabc-
$(ABCREV
).a
515 $(P
) cp abc
/libabc-
$(ABCREV
).a yosys-libabc.a
523 test: $(TARGETS
) $(EXTRA_TARGETS
)
524 +cd tests
/simple
&& bash run-test.sh
$(SEEDOPT
)
525 +cd tests
/hana
&& bash run-test.sh
$(SEEDOPT
)
526 +cd tests
/asicworld
&& bash run-test.sh
$(SEEDOPT
)
527 +cd tests
/realmath
&& bash run-test.sh
$(SEEDOPT
)
528 +cd tests
/share
&& bash run-test.sh
$(SEEDOPT
)
529 +cd tests
/fsm
&& bash run-test.sh
$(SEEDOPT
)
530 +cd tests
/techmap
&& bash run-test.sh
531 +cd tests
/memories
&& bash run-test.sh
$(SEEDOPT
)
532 +cd tests
/bram
&& bash run-test.sh
$(SEEDOPT
)
533 +cd tests
/various
&& bash run-test.sh
534 +cd tests
/sat
&& bash run-test.sh
536 @echo
" Passed \"make test\"."
539 VALGRIND ?
= valgrind
--error-exitcode
=1 --leak-check
=full
--show-reachable
=yes
--errors-for-leak-kinds
=all
541 vgtest
: $(TARGETS
) $(EXTRA_TARGETS
)
542 $(VALGRIND
) .
/yosys
-p
'setattr -mod -unset top; synth' $$( ls tests
/simple
/*.v | grep
-v repwhile.v
)
544 @echo
" Passed \"make vgtest\"."
547 vloghtb
: $(TARGETS
) $(EXTRA_TARGETS
)
548 +cd tests
/vloghtb
&& bash run-test.sh
550 @echo
" Passed \"make vloghtb\"."
554 unit-test
: libyosys.so
555 @
$(MAKE
) -C
$(UNITESTPATH
) CXX
="$(CXX)" CPPFLAGS
="$(CPPFLAGS)" \
556 CXXFLAGS
="$(CXXFLAGS)" LDLIBS
="$(LDLIBS)" ROOTPATH
="$(CURDIR)"
559 @
$(MAKE
) -C
$(UNITESTPATH
) clean
561 install: $(TARGETS
) $(EXTRA_TARGETS
)
562 $(INSTALL_SUDO
) mkdir
-p
$(DESTDIR
)$(BINDIR
)
563 $(INSTALL_SUDO
) cp
$(TARGETS
) $(DESTDIR
)$(BINDIR
)
564 ifneq ($(filter yosys
,$(TARGETS
)),)
565 $(INSTALL_SUDO
) $(STRIP
) -S
$(DESTDIR
)$(BINDIR
)/yosys
567 ifneq ($(filter yosys-abc
,$(TARGETS
)),)
568 $(INSTALL_SUDO
) $(STRIP
) $(DESTDIR
)$(BINDIR
)/yosys-abc
570 ifneq ($(filter yosys-filterlib
,$(TARGETS
)),)
571 $(INSTALL_SUDO
) $(STRIP
) $(DESTDIR
)$(BINDIR
)/yosys-filterlib
573 $(INSTALL_SUDO
) mkdir
-p
$(DESTDIR
)$(DATDIR
)
574 $(INSTALL_SUDO
) cp
-r share
/.
$(DESTDIR
)$(DATDIR
)/.
575 ifeq ($(ENABLE_LIBYOSYS
),1)
576 $(INSTALL_SUDO
) cp libyosys.so
$(DESTDIR
)$(LIBDIR
)
577 $(INSTALL_SUDO
) $(STRIP
) -S
$(DESTDIR
)$(LIBDIR
)/libyosys.so
578 $(INSTALL_SUDO
) ldconfig
582 $(INSTALL_SUDO
) rm -vf
$(addprefix $(DESTDIR
)$(BINDIR
)/,$(notdir $(TARGETS
)))
583 $(INSTALL_SUDO
) rm -rvf
$(DESTDIR
)$(DATDIR
)
584 ifeq ($(ENABLE_LIBYOSYS
),1)
585 $(INSTALL_SUDO
) rm -vf
$(DESTDIR
)$(LIBDIR
)/libyosys.so
588 update-manual
: $(TARGETS
) $(EXTRA_TARGETS
)
589 cd manual
&& ..
/yosys
-p
'help -write-tex-command-reference-manual'
591 manual
: $(TARGETS
) $(EXTRA_TARGETS
)
592 cd manual
&& bash appnotes.sh
593 cd manual
&& bash presentation.sh
594 cd manual
&& bash manual.sh
598 if
test -d manual
; then cd manual
&& sh
clean.sh
; fi
599 rm -f
$(OBJS
) $(GENFILES
) $(TARGETS
) $(EXTRA_TARGETS
) $(EXTRA_OBJS
)
600 rm -f kernel
/version_
*.o kernel
/version_
*.
cc abc
/abc-
[0-9a-f
]* abc
/libabc-
[0-9a-f
]*.a
601 rm -f libs
/*/*.d frontends
/*/*.d passes
/*/*.d backends
/*/*.d kernel
/*.d techlibs
/*/*.d
602 rm -rf tests
/asicworld
/*.out tests
/asicworld
/*.log
603 rm -rf tests
/hana
/*.out tests
/hana
/*.log
604 rm -rf tests
/simple
/*.out tests
/simple
/*.log
605 rm -rf tests
/memories
/*.out tests
/memories
/*.log tests
/memories
/*.dmp
606 rm -rf tests
/sat
/*.log tests
/techmap
/*.log tests
/various
/*.log
607 rm -rf tests
/bram
/temp tests
/fsm
/temp tests
/realmath
/temp tests
/share
/temp tests
/smv
/temp
608 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_
*
609 rm -f tests
/tools
/cmp_tbdata
612 $(MAKE
) -C abc DEP
= clean
613 rm -f yosys-abc
$(EXE
) yosys-libabc.a abc
/abc-
[0-9a-f
]* abc
/libabc-
[0-9a-f
]*.a
619 { for file in
$(basename $(OBJS
)); do \
620 for
prefix in
cc y l
; do if
[ -f
$${file}.
$${prefix} ]; then echo
$$file.
$${prefix}; fi
; done \
621 done
; find backends frontends kernel libs passes
-type f \
( -name
'*.h' -o
-name
'*.hh' \
); } > qtcreator.files
622 { echo .
; find backends frontends kernel libs passes
-type f \
( -name
'*.h' -o
-name
'*.hh' \
) -printf
'%h\n' |
sort -u
; } > qtcreator.includes
623 touch qtcreator.config qtcreator.creator
625 vcxsrc
: $(GENFILES
) $(EXTRA_TARGETS
)
626 rm -rf yosys-win32-vcxsrc-
$(YOSYS_VER
){,.zip
}
627 set
-e
; for f in
`ls $(filter %.cc %.cpp,$(GENFILES)) $(addsuffix .cc,$(basename $(OBJS))) $(addsuffix .cpp,$(basename $(OBJS))) 2> /dev/null`; do \
628 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
629 bash misc
/create_vcxsrc.sh yosys-win32-vcxsrc
$(YOSYS_VER
) $(GIT_REV
)
630 echo
"namespace Yosys { extern const char *yosys_version_str; const char *yosys_version_str=\"Yosys (Version Information Unavailable)\"; }" > kernel
/version.
cc
631 zip yosys-win32-vcxsrc-
$(YOSYS_VER
)/genfiles.zip
$(GENFILES
) kernel
/version.
cc
632 zip
-r yosys-win32-vcxsrc-
$(YOSYS_VER
).zip yosys-win32-vcxsrc-
$(YOSYS_VER
)/
633 rm -f srcfiles.txt kernel
/version.
cc
636 mxebin
: $(TARGETS
) $(EXTRA_TARGETS
)
637 rm -rf yosys-win32-mxebin-
$(YOSYS_VER
){,.zip
}
638 mkdir
-p yosys-win32-mxebin-
$(YOSYS_VER
)
639 cp
-r yosys.exe share
/ yosys-win32-mxebin-
$(YOSYS_VER
)/
640 ifeq ($(ENABLE_ABC
),1)
641 cp
-r yosys-abc.exe abc
/lib
/x86
/pthreadVC2.dll yosys-win32-mxebin-
$(YOSYS_VER
)/
643 echo
-en
'This is Yosys $(YOSYS_VER) for Win32.\r\n' > yosys-win32-mxebin-
$(YOSYS_VER
)/readme.txt
644 echo
-en
'Documentation at http://www.clifford.at/yosys/.\r\n' >> yosys-win32-mxebin-
$(YOSYS_VER
)/readme.txt
645 zip
-r yosys-win32-mxebin-
$(YOSYS_VER
).zip yosys-win32-mxebin-
$(YOSYS_VER
)/
652 echo
'CONFIG := clang' > Makefile.conf
655 echo
'CONFIG := gcc' > Makefile.conf
657 config-gcc-4.8
: clean
658 echo
'CONFIG := gcc-4.8' > Makefile.conf
661 echo
'CONFIG := emcc' > Makefile.conf
662 echo
'ENABLE_TCL := 0' >> Makefile.conf
663 echo
'ENABLE_ABC := 0' >> Makefile.conf
664 echo
'ENABLE_PLUGINS := 0' >> Makefile.conf
665 echo
'ENABLE_READLINE := 0' >> Makefile.conf
668 echo
'CONFIG := mxe' > Makefile.conf
669 echo
'ENABLE_PLUGINS := 0' >> Makefile.conf
672 echo
'CONFIG := msys2' > Makefile.conf
675 echo
'CONFIG := gcc' > Makefile.conf
676 echo
'ENABLE_GPROF := 1' >> Makefile.conf
679 echo
"INSTALL_SUDO := sudo" >> Makefile.conf
688 -include frontends
/*/*.d
689 -include passes
/*/*.d
690 -include backends
/*/*.d
692 -include techlibs
/*/*.d
694 .PHONY
: all top-all abc
test install install-abc manual
clean mrproper qtcreator
695 .PHONY
: config-clean config-clang config-gcc config-gcc-4.8 config-gprof config-sudo