Merge tag 'yosys-0.9'
[yosys.git] / Makefile
1
2 CONFIG := clang
3 # CONFIG := gcc
4 # CONFIG := gcc-4.8
5 # CONFIG := afl-gcc
6 # CONFIG := emcc
7 # CONFIG := mxe
8 # CONFIG := msys2
9 # CONFIG := msys2-64
10
11 # features (the more the better)
12 ENABLE_TCL := 1
13 ENABLE_ABC := 1
14 ENABLE_GLOB := 1
15 ENABLE_PLUGINS := 1
16 ENABLE_READLINE := 1
17 ENABLE_EDITLINE := 0
18 ENABLE_VERIFIC := 0
19 ENABLE_COVER := 1
20 ENABLE_LIBYOSYS := 0
21 ENABLE_PROTOBUF := 0
22 ENABLE_ZLIB := 1
23
24 # python wrappers
25 ENABLE_PYOSYS := 0
26
27 # other configuration flags
28 ENABLE_GCOV := 0
29 ENABLE_GPROF := 0
30 ENABLE_DEBUG := 0
31 ENABLE_NDEBUG := 0
32 LINK_CURSES := 0
33 LINK_TERMCAP := 0
34 LINK_ABC := 0
35 # Needed for environments that don't have proper thread support (i.e. emscripten)
36 DISABLE_ABC_THREADS := 0
37
38 # clang sanitizers
39 SANITIZER =
40 # SANITIZER = address
41 # SANITIZER = memory
42 # SANITIZER = undefined
43 # SANITIZER = cfi
44
45
46 OS := $(shell uname -s)
47 PREFIX ?= /usr/local
48 INSTALL_SUDO :=
49
50 ifneq ($(wildcard Makefile.conf),)
51 include Makefile.conf
52 endif
53
54 BINDIR := $(PREFIX)/bin
55 LIBDIR := $(PREFIX)/lib
56 DATDIR := $(PREFIX)/share/yosys
57
58 EXE =
59 OBJS =
60 GENFILES =
61 EXTRA_OBJS =
62 EXTRA_TARGETS =
63 TARGETS = yosys$(EXE) yosys-config
64
65 PRETTY = 1
66 SMALL = 0
67
68 # Unit test
69 UNITESTPATH := tests/unit
70
71 all: top-all
72
73 YOSYS_SRC := $(dir $(firstword $(MAKEFILE_LIST)))
74 VPATH := $(YOSYS_SRC)
75
76 CXXFLAGS := $(CXXFLAGS) -Wall -Wextra -ggdb -I. -I"$(YOSYS_SRC)" -MD -D_YOSYS_ -fPIC -I$(PREFIX)/include
77 LDFLAGS := $(LDFLAGS) -L$(LIBDIR)
78 LDLIBS := $(LDLIBS) -lstdc++ -lm
79 PLUGIN_LDFLAGS :=
80
81 PKG_CONFIG ?= pkg-config
82 SED ?= sed
83 BISON ?= bison
84 STRIP ?= strip
85 AWK ?= awk
86
87 ifeq ($(OS), Darwin)
88 PLUGIN_LDFLAGS += -undefined dynamic_lookup
89
90 # homebrew search paths
91 ifneq ($(shell which brew),)
92 BREW_PREFIX := $(shell brew --prefix)/opt
93 $(info $$BREW_PREFIX is [${BREW_PREFIX}])
94 ifeq ($(ENABLE_PYOSYS),1)
95 CXXFLAGS += -I$(BREW_PREFIX)/boost/include/boost
96 LDFLAGS += -L$(BREW_PREFIX)/boost/lib
97 endif
98 CXXFLAGS += -I$(BREW_PREFIX)/readline/include
99 LDFLAGS += -L$(BREW_PREFIX)/readline/lib
100 PKG_CONFIG_PATH := $(BREW_PREFIX)/libffi/lib/pkgconfig:$(PKG_CONFIG_PATH)
101 PKG_CONFIG_PATH := $(BREW_PREFIX)/tcl-tk/lib/pkgconfig:$(PKG_CONFIG_PATH)
102 export PATH := $(BREW_PREFIX)/bison/bin:$(BREW_PREFIX)/gettext/bin:$(BREW_PREFIX)/flex/bin:$(PATH)
103
104 # macports search paths
105 else ifneq ($(shell which port),)
106 PORT_PREFIX := $(patsubst %/bin/port,%,$(shell which port))
107 CXXFLAGS += -I$(PORT_PREFIX)/include
108 LDFLAGS += -L$(PORT_PREFIX)/lib
109 PKG_CONFIG_PATH := $(PORT_PREFIX)/lib/pkgconfig:$(PKG_CONFIG_PATH)
110 export PATH := $(PORT_PREFIX)/bin:$(PATH)
111 endif
112
113 else
114 LDFLAGS += -rdynamic
115 LDLIBS += -lrt
116 endif
117
118 YOSYS_VER := 0.9+1
119 GIT_REV := $(shell cd $(YOSYS_SRC) && git rev-parse --short HEAD 2> /dev/null || echo UNKNOWN)
120 OBJS = kernel/version_$(GIT_REV).o
121
122 # set 'ABCREV = default' to use abc/ as it is
123 #
124 # Note: If you do ABC development, make sure that 'abc' in this directory
125 # is just a symlink to your actual ABC working directory, as 'make mrproper'
126 # will remove the 'abc' directory and you do not want to accidentally
127 # delete your work on ABC..
128 ABCREV = 5776ad0
129 ABCPULL = 1
130 ABCURL ?= https://github.com/berkeley-abc/abc
131 ABCMKARGS = CC="$(CXX)" CXX="$(CXX)" ABC_USE_LIBSTDCXX=1
132
133 # set ABCEXTERNAL = <abc-command> to use an external ABC instance
134 # Note: The in-tree ABC (yosys-abc) will not be installed when ABCEXTERNAL is set.
135 ABCEXTERNAL ?=
136
137 define newline
138
139
140 endef
141
142 ifneq ($(wildcard Makefile.conf),)
143 $(info $(subst $$--$$,$(newline),$(shell sed 's,^,[Makefile.conf] ,; s,$$,$$--$$,;' < Makefile.conf | tr -d '\n' | sed 's,\$$--\$$$$,,')))
144 include Makefile.conf
145 endif
146
147 ifeq ($(ENABLE_PYOSYS),1)
148 PYTHON_VERSION_TESTCODE := "import sys;t='{v[0]}.{v[1]}'.format(v=list(sys.version_info[:2]));print(t)"
149 PYTHON_EXECUTABLE := $(shell if python3 -c ""; then echo "python3"; else echo "python"; fi)
150 PYTHON_VERSION := $(shell $(PYTHON_EXECUTABLE) -c ""$(PYTHON_VERSION_TESTCODE)"")
151 PYTHON_MAJOR_VERSION := $(shell echo $(PYTHON_VERSION) | cut -f1 -d.)
152 PYTHON_PREFIX := $(shell $(PYTHON_EXECUTABLE)-config --prefix)
153 PYTHON_DESTDIR := $(PYTHON_PREFIX)/lib/python$(PYTHON_VERSION)/site-packages
154
155 # Reload Makefile.conf to override python specific variables if defined
156 ifneq ($(wildcard Makefile.conf),)
157 include Makefile.conf
158 endif
159
160 endif
161
162 ifeq ($(CONFIG),clang)
163 CXX = clang
164 LD = clang++
165 CXXFLAGS += -std=c++11 -Os
166 ABCMKARGS += ARCHFLAGS="-DABC_USE_STDINT_H"
167
168 ifneq ($(SANITIZER),)
169 $(info [Clang Sanitizer] $(SANITIZER))
170 CXXFLAGS += -g -O1 -fno-omit-frame-pointer -fno-optimize-sibling-calls -fsanitize=$(SANITIZER)
171 LDFLAGS += -g -fsanitize=$(SANITIZER)
172 ifeq ($(SANITIZER),address)
173 ENABLE_COVER := 0
174 endif
175 ifeq ($(SANITIZER),memory)
176 CXXFLAGS += -fPIE -fsanitize-memory-track-origins
177 LDFLAGS += -fPIE -fsanitize-memory-track-origins
178 endif
179 ifeq ($(SANITIZER),cfi)
180 CXXFLAGS += -flto
181 LDFLAGS += -flto
182 endif
183 endif
184
185 else ifeq ($(CONFIG),gcc)
186 CXX = gcc
187 LD = gcc
188 CXXFLAGS += -std=c++11 -Os
189 ABCMKARGS += ARCHFLAGS="-DABC_USE_STDINT_H"
190
191 else ifeq ($(CONFIG),gcc-static)
192 LD = $(CXX)
193 LDFLAGS := $(filter-out -rdynamic,$(LDFLAGS)) -static
194 LDLIBS := $(filter-out -lrt,$(LDLIBS))
195 CXXFLAGS := $(filter-out -fPIC,$(CXXFLAGS))
196 CXXFLAGS += -std=c++11 -Os
197 ABCMKARGS = CC="$(CC)" CXX="$(CXX)" LD="$(LD)" ABC_USE_LIBSTDCXX=1 LIBS="-lm -lpthread -static" OPTFLAGS="-O" \
198 ARCHFLAGS="-DABC_USE_STDINT_H -DABC_NO_DYNAMIC_LINKING=1 -Wno-unused-but-set-variable $(ARCHFLAGS)" ABC_USE_NO_READLINE=1
199 ifeq ($(DISABLE_ABC_THREADS),1)
200 ABCMKARGS += "ABC_USE_NO_PTHREADS=1"
201 endif
202
203 else ifeq ($(CONFIG),gcc-4.8)
204 CXX = gcc-4.8
205 LD = gcc-4.8
206 CXXFLAGS += -std=c++11 -Os
207 ABCMKARGS += ARCHFLAGS="-DABC_USE_STDINT_H"
208
209 else ifeq ($(CONFIG),afl-gcc)
210 CXX = AFL_QUIET=1 AFL_HARDEN=1 afl-gcc
211 LD = AFL_QUIET=1 AFL_HARDEN=1 afl-gcc
212 CXXFLAGS += -std=c++11 -Os
213 ABCMKARGS += ARCHFLAGS="-DABC_USE_STDINT_H"
214
215 else ifeq ($(CONFIG),cygwin)
216 CXX = gcc
217 LD = gcc
218 CXXFLAGS += -std=gnu++11 -Os
219 ABCMKARGS += ARCHFLAGS="-DABC_USE_STDINT_H"
220
221 else ifeq ($(CONFIG),emcc)
222 CXX = emcc
223 LD = emcc
224 CXXFLAGS := -std=c++11 $(filter-out -fPIC -ggdb,$(CXXFLAGS))
225 ABCMKARGS += ARCHFLAGS="-DABC_USE_STDINT_H -DABC_MEMALIGN=8"
226 EMCCFLAGS := -Os -Wno-warn-absolute-paths
227 EMCCFLAGS += --memory-init-file 0 --embed-file share -s NO_EXIT_RUNTIME=1
228 EMCCFLAGS += -s EXPORTED_FUNCTIONS="['_main','_run','_prompt','_errmsg']"
229 EMCCFLAGS += -s TOTAL_MEMORY=128*1024*1024
230 # https://github.com/kripken/emscripten/blob/master/src/settings.js
231 CXXFLAGS += $(EMCCFLAGS)
232 LDFLAGS += $(EMCCFLAGS)
233 LDLIBS =
234 EXE = .js
235
236 TARGETS := $(filter-out yosys-config,$(TARGETS))
237 EXTRA_TARGETS += yosysjs-$(YOSYS_VER).zip
238
239 ifeq ($(ENABLE_ABC),1)
240 LINK_ABC := 1
241 DISABLE_ABC_THREADS := 1
242 endif
243
244 viz.js:
245 wget -O viz.js.part https://github.com/mdaines/viz.js/releases/download/0.0.3/viz.js
246 mv viz.js.part viz.js
247
248 yosysjs-$(YOSYS_VER).zip: yosys.js viz.js misc/yosysjs/*
249 rm -rf yosysjs-$(YOSYS_VER) yosysjs-$(YOSYS_VER).zip
250 mkdir -p yosysjs-$(YOSYS_VER)
251 cp viz.js misc/yosysjs/* yosys.js yosysjs-$(YOSYS_VER)/
252 zip -r yosysjs-$(YOSYS_VER).zip yosysjs-$(YOSYS_VER)
253
254 yosys.html: misc/yosys.html
255 $(P) cp misc/yosys.html yosys.html
256
257 else ifeq ($(CONFIG),mxe)
258 PKG_CONFIG = /usr/local/src/mxe/usr/bin/i686-w64-mingw32.static-pkg-config
259 CXX = /usr/local/src/mxe/usr/bin/i686-w64-mingw32.static-g++
260 LD = /usr/local/src/mxe/usr/bin/i686-w64-mingw32.static-g++
261 CXXFLAGS += -std=c++11 -Os -D_POSIX_SOURCE -DYOSYS_MXE_HACKS -Wno-attributes
262 CXXFLAGS := $(filter-out -fPIC,$(CXXFLAGS))
263 LDFLAGS := $(filter-out -rdynamic,$(LDFLAGS)) -s
264 LDLIBS := $(filter-out -lrt,$(LDLIBS))
265 ABCMKARGS += ARCHFLAGS="-DWIN32_NO_DLL -DHAVE_STRUCT_TIMESPEC -fpermissive -w"
266 # TODO: Try to solve pthread linking issue in more appropriate way
267 ABCMKARGS += LIBS="lib/x86/pthreadVC2.lib -s" LDFLAGS="-Wl,--allow-multiple-definition" ABC_USE_NO_READLINE=1 CC="/usr/local/src/mxe/usr/bin/i686-w64-mingw32.static-gcc"
268 EXE = .exe
269
270 else ifeq ($(CONFIG),msys2)
271 CXX = i686-w64-mingw32-g++
272 LD = i686-w64-mingw32-g++
273 CXXFLAGS += -std=c++11 -Os -D_POSIX_SOURCE -DYOSYS_WIN32_UNIX_DIR
274 CXXFLAGS := $(filter-out -fPIC,$(CXXFLAGS))
275 LDFLAGS := $(filter-out -rdynamic,$(LDFLAGS)) -s
276 LDLIBS := $(filter-out -lrt,$(LDLIBS))
277 ABCMKARGS += ARCHFLAGS="-DABC_USE_STDINT_H -DWIN32_NO_DLL -DHAVE_STRUCT_TIMESPEC -fpermissive -w"
278 ABCMKARGS += LIBS="-lpthread -s" ABC_USE_NO_READLINE=0 CC="i686-w64-mingw32-gcc" CXX="$(CXX)"
279 EXE = .exe
280
281 else ifeq ($(CONFIG),msys2-64)
282 CXX = x86_64-w64-mingw32-g++
283 LD = x86_64-w64-mingw32-g++
284 CXXFLAGS += -std=c++11 -Os -D_POSIX_SOURCE -DYOSYS_WIN32_UNIX_DIR
285 CXXFLAGS := $(filter-out -fPIC,$(CXXFLAGS))
286 LDFLAGS := $(filter-out -rdynamic,$(LDFLAGS)) -s
287 LDLIBS := $(filter-out -lrt,$(LDLIBS))
288 ABCMKARGS += ARCHFLAGS="-DABC_USE_STDINT_H -DWIN32_NO_DLL -DHAVE_STRUCT_TIMESPEC -fpermissive -w"
289 ABCMKARGS += LIBS="-lpthread -s" ABC_USE_NO_READLINE=0 CC="x86_64-w64-mingw32-gcc" CXX="$(CXX)"
290 EXE = .exe
291
292 else ifneq ($(CONFIG),none)
293 $(error Invalid CONFIG setting '$(CONFIG)'. Valid values: clang, gcc, gcc-4.8, emcc, mxe, msys2, msys2-64)
294 endif
295
296 ifeq ($(ENABLE_LIBYOSYS),1)
297 TARGETS += libyosys.so
298 endif
299
300 ifeq ($(ENABLE_PYOSYS),1)
301
302 #Detect name of boost_python library. Some distros usbe boost_python-py<version>, other boost_python<version>, some only use the major version number, some a concatenation of major and minor version numbers
303 ifeq ($(OS), Darwin)
304 BOOST_PYTHON_LIB ?= $(shell \
305 if echo "int main(int argc, char ** argv) {return 0;}" | $(CXX) -xc -o /dev/null $(shell $(PYTHON_EXECUTABLE)-config --ldflags) -lboost_python-py$(subst .,,$(PYTHON_VERSION)) - > /dev/null 2>&1; then echo "-lboost_python-py$(subst .,,$(PYTHON_VERSION))"; else \
306 if echo "int main(int argc, char ** argv) {return 0;}" | $(CXX) -xc -o /dev/null $(shell $(PYTHON_EXECUTABLE)-config --ldflags) -lboost_python-py$(subst .,,$(PYTHON_MAJOR_VERSION)) - > /dev/null 2>&1; then echo "-lboost_python-py$(subst .,,$(PYTHON_MAJOR_VERSION))"; else \
307 if echo "int main(int argc, char ** argv) {return 0;}" | $(CXX) -xc -o /dev/null $(shell $(PYTHON_EXECUTABLE)-config --ldflags) -lboost_python$(subst .,,$(PYTHON_VERSION)) - > /dev/null 2>&1; then echo "-lboost_python$(subst .,,$(PYTHON_VERSION))"; else \
308 if echo "int main(int argc, char ** argv) {return 0;}" | $(CXX) -xc -o /dev/null $(shell $(PYTHON_EXECUTABLE)-config --ldflags) -lboost_python$(subst .,,$(PYTHON_MAJOR_VERSION)) - > /dev/null 2>&1; then echo "-lboost_python$(subst .,,$(PYTHON_MAJOR_VERSION))"; else \
309 echo ""; fi; fi; fi; fi;)
310 else
311 BOOST_PYTHON_LIB ?= $(shell \
312 if echo "int main(int argc, char ** argv) {return 0;}" | $(CXX) -xc -o /dev/null `$(PYTHON_EXECUTABLE)-config --libs` -lboost_python-py$(subst .,,$(PYTHON_VERSION)) - > /dev/null 2>&1; then echo "-lboost_python-py$(subst .,,$(PYTHON_VERSION))"; else \
313 if echo "int main(int argc, char ** argv) {return 0;}" | $(CXX) -xc -o /dev/null `$(PYTHON_EXECUTABLE)-config --libs` -lboost_python-py$(subst .,,$(PYTHON_MAJOR_VERSION)) - > /dev/null 2>&1; then echo "-lboost_python-py$(subst .,,$(PYTHON_MAJOR_VERSION))"; else \
314 if echo "int main(int argc, char ** argv) {return 0;}" | $(CXX) -xc -o /dev/null `$(PYTHON_EXECUTABLE)-config --libs` -lboost_python$(subst .,,$(PYTHON_VERSION)) - > /dev/null 2>&1; then echo "-lboost_python$(subst .,,$(PYTHON_VERSION))"; else \
315 if echo "int main(int argc, char ** argv) {return 0;}" | $(CXX) -xc -o /dev/null `$(PYTHON_EXECUTABLE)-config --libs` -lboost_python$(subst .,,$(PYTHON_MAJOR_VERSION)) - > /dev/null 2>&1; then echo "-lboost_python$(subst .,,$(PYTHON_MAJOR_VERSION))"; else \
316 echo ""; fi; fi; fi; fi;)
317 endif
318
319 ifeq ($(BOOST_PYTHON_LIB),)
320 $(error BOOST_PYTHON_LIB could not be detected. Please define manualy)
321 endif
322
323 ifeq ($(OS), Darwin)
324 ifeq ($(PYTHON_MAJOR_VERSION),3)
325 LDLIBS += $(shell $(PYTHON_EXECUTABLE)-config --ldflags) $(BOOST_PYTHON_LIB) -lboost_system -lboost_filesystem
326 CXXFLAGS += $(shell $(PYTHON_EXECUTABLE)-config --includes) -DWITH_PYTHON
327 else
328 LDLIBS += $(shell $(PYTHON_EXECUTABLE)-config --ldflags) $(BOOST_PYTHON_LIB) -lboost_system -lboost_filesystem
329 CXXFLAGS += $(shell $(PYTHON_EXECUTABLE)-config --includes) -DWITH_PYTHON
330 endif
331 else
332 ifeq ($(PYTHON_MAJOR_VERSION),3)
333 LDLIBS += $(shell $(PYTHON_EXECUTABLE)-config --libs) $(BOOST_PYTHON_LIB) -lboost_system -lboost_filesystem
334 CXXFLAGS += $(shell $(PYTHON_EXECUTABLE)-config --includes) -DWITH_PYTHON
335 else
336 LDLIBS += $(shell $(PYTHON_EXECUTABLE)-config --libs) $(BOOST_PYTHON_LIB) -lboost_system -lboost_filesystem
337 CXXFLAGS += $(shell $(PYTHON_EXECUTABLE)-config --includes) -DWITH_PYTHON
338 endif
339 endif
340
341 ifeq ($(ENABLE_PYOSYS),1)
342 PY_WRAPPER_FILE = kernel/python_wrappers
343 OBJS += $(PY_WRAPPER_FILE).o
344 PY_GEN_SCRIPT= py_wrap_generator
345 PY_WRAP_INCLUDES := $(shell python$(PYTHON_VERSION) -c "from misc import $(PY_GEN_SCRIPT); $(PY_GEN_SCRIPT).print_includes()")
346 endif
347 endif
348
349 ifeq ($(ENABLE_READLINE),1)
350 CXXFLAGS += -DYOSYS_ENABLE_READLINE
351 ifeq ($(OS), FreeBSD)
352 CXXFLAGS += -I/usr/local/include
353 endif
354 LDLIBS += -lreadline
355 ifeq ($(LINK_CURSES),1)
356 LDLIBS += -lcurses
357 ABCMKARGS += "ABC_READLINE_LIBRARIES=-lcurses -lreadline"
358 endif
359 ifeq ($(LINK_TERMCAP),1)
360 LDLIBS += -ltermcap
361 ABCMKARGS += "ABC_READLINE_LIBRARIES=-lreadline -ltermcap"
362 endif
363 ifeq ($(CONFIG),mxe)
364 LDLIBS += -ltermcap
365 endif
366 else
367 ifeq ($(ENABLE_EDITLINE),1)
368 CXXFLAGS += -DYOSYS_ENABLE_EDITLINE
369 LDLIBS += -ledit -ltinfo -lbsd
370 else
371 ABCMKARGS += "ABC_USE_NO_READLINE=1"
372 endif
373 endif
374
375 ifeq ($(DISABLE_ABC_THREADS),1)
376 ABCMKARGS += "ABC_USE_NO_PTHREADS=1"
377 endif
378
379 ifeq ($(ENABLE_PLUGINS),1)
380 CXXFLAGS += $(shell PKG_CONFIG_PATH=$(PKG_CONFIG_PATH) $(PKG_CONFIG) --silence-errors --cflags libffi) -DYOSYS_ENABLE_PLUGINS
381 LDLIBS += $(shell PKG_CONFIG_PATH=$(PKG_CONFIG_PATH) $(PKG_CONFIG) --silence-errors --libs libffi || echo -lffi)
382 ifneq ($(OS), FreeBSD)
383 LDLIBS += -ldl
384 endif
385 endif
386
387 ifeq ($(ENABLE_GLOB),1)
388 CXXFLAGS += -DYOSYS_ENABLE_GLOB
389 endif
390
391 ifeq ($(ENABLE_ZLIB),1)
392 CXXFLAGS += -DYOSYS_ENABLE_ZLIB
393 LDLIBS += -lz
394 endif
395
396
397 ifeq ($(ENABLE_TCL),1)
398 TCL_VERSION ?= tcl$(shell bash -c "tclsh <(echo 'puts [info tclversion]')")
399 ifeq ($(OS), FreeBSD)
400 TCL_INCLUDE ?= /usr/local/include/$(TCL_VERSION)
401 else
402 TCL_INCLUDE ?= /usr/include/$(TCL_VERSION)
403 endif
404
405 ifeq ($(CONFIG),mxe)
406 CXXFLAGS += -DYOSYS_ENABLE_TCL
407 LDLIBS += -ltcl86 -lwsock32 -lws2_32 -lnetapi32 -lz -luserenv
408 else
409 CXXFLAGS += $(shell PKG_CONFIG_PATH=$(PKG_CONFIG_PATH) $(PKG_CONFIG) --silence-errors --cflags tcl || echo -I$(TCL_INCLUDE)) -DYOSYS_ENABLE_TCL
410 ifeq ($(OS), FreeBSD)
411 # FreeBSD uses tcl8.6, but lib is named "libtcl86"
412 LDLIBS += $(shell PKG_CONFIG_PATH=$(PKG_CONFIG_PATH) $(PKG_CONFIG) --silence-errors --libs tcl || echo -l$(TCL_VERSION) | tr -d '.')
413 else
414 LDLIBS += $(shell PKG_CONFIG_PATH=$(PKG_CONFIG_PATH) $(PKG_CONFIG) --silence-errors --libs tcl || echo -l$(TCL_VERSION))
415 endif
416 endif
417 endif
418
419 ifeq ($(ENABLE_GCOV),1)
420 CXXFLAGS += --coverage
421 LDFLAGS += --coverage
422 endif
423
424 ifeq ($(ENABLE_GPROF),1)
425 CXXFLAGS += -pg
426 LDFLAGS += -pg
427 endif
428
429 ifeq ($(ENABLE_NDEBUG),1)
430 CXXFLAGS := -O3 -DNDEBUG $(filter-out -Os -ggdb,$(CXXFLAGS))
431 endif
432
433 ifeq ($(ENABLE_DEBUG),1)
434 ifeq ($(CONFIG),clang)
435 CXXFLAGS := -O0 -DDEBUG $(filter-out -Os,$(CXXFLAGS))
436 else
437 CXXFLAGS := -Og -DDEBUG $(filter-out -Os,$(CXXFLAGS))
438 endif
439 endif
440
441 ifeq ($(ENABLE_ABC),1)
442 CXXFLAGS += -DYOSYS_ENABLE_ABC
443 ifeq ($(LINK_ABC),1)
444 CXXFLAGS += -DYOSYS_LINK_ABC
445 ifeq ($(DISABLE_ABC_THREADS),0)
446 LDLIBS += -lpthread
447 endif
448 else
449 ifeq ($(ABCEXTERNAL),)
450 TARGETS += yosys-abc$(EXE)
451 endif
452 endif
453 endif
454
455 ifeq ($(ENABLE_VERIFIC),1)
456 VERIFIC_DIR ?= /usr/local/src/verific_lib
457 VERIFIC_COMPONENTS ?= verilog vhdl database util containers hier_tree
458 CXXFLAGS += $(patsubst %,-I$(VERIFIC_DIR)/%,$(VERIFIC_COMPONENTS)) -DYOSYS_ENABLE_VERIFIC
459 ifeq ($(OS), Darwin)
460 LDLIBS += $(patsubst %,$(VERIFIC_DIR)/%/*-mac.a,$(VERIFIC_COMPONENTS)) -lz
461 else
462 LDLIBS += $(patsubst %,$(VERIFIC_DIR)/%/*-linux.a,$(VERIFIC_COMPONENTS)) -lz
463 endif
464 endif
465
466 ifeq ($(ENABLE_PROTOBUF),1)
467 LDLIBS += $(shell pkg-config --cflags --libs protobuf)
468 endif
469
470 ifeq ($(ENABLE_COVER),1)
471 CXXFLAGS += -DYOSYS_ENABLE_COVER
472 endif
473
474 define add_share_file
475 EXTRA_TARGETS += $(subst //,/,$(1)/$(notdir $(2)))
476 $(subst //,/,$(1)/$(notdir $(2))): $(2)
477 $$(P) mkdir -p $(1)
478 $$(Q) cp "$(YOSYS_SRC)"/$(2) $(subst //,/,$(1)/$(notdir $(2)))
479 endef
480
481 define add_gen_share_file
482 EXTRA_TARGETS += $(subst //,/,$(1)/$(notdir $(2)))
483 $(subst //,/,$(1)/$(notdir $(2))): $(2)
484 $$(P) mkdir -p $(1)
485 $$(Q) cp $(2) $(subst //,/,$(1)/$(notdir $(2)))
486 endef
487
488 define add_include_file
489 $(eval $(call add_share_file,$(dir share/include/$(1)),$(1)))
490 endef
491
492 define add_extra_objs
493 EXTRA_OBJS += $(1)
494 .SECONDARY: $(1)
495 endef
496
497 ifeq ($(PRETTY), 1)
498 P_STATUS = 0
499 P_OFFSET = 0
500 P_UPDATE = $(eval P_STATUS=$(shell echo $(OBJS) yosys$(EXE) | $(AWK) 'BEGIN { RS = " "; I = $(P_STATUS)+0; } $$1 == "$@" && NR > I { I = NR; } END { print I; }'))
501 P_SHOW = [$(shell $(AWK) "BEGIN { N=$(words $(OBJS) yosys$(EXE)); printf \"%3d\", $(P_OFFSET)+90*$(P_STATUS)/N; exit; }")%]
502 P = @echo "$(if $(findstring $@,$(TARGETS) $(EXTRA_TARGETS)),$(eval P_OFFSET = 10))$(call P_UPDATE)$(call P_SHOW) Building $@";
503 Q = @
504 S = -s
505 else
506 P_SHOW = ->
507 P =
508 Q =
509 S =
510 endif
511
512 $(eval $(call add_include_file,kernel/yosys.h))
513 $(eval $(call add_include_file,kernel/hashlib.h))
514 $(eval $(call add_include_file,kernel/log.h))
515 $(eval $(call add_include_file,kernel/rtlil.h))
516 $(eval $(call add_include_file,kernel/register.h))
517 $(eval $(call add_include_file,kernel/celltypes.h))
518 $(eval $(call add_include_file,kernel/celledges.h))
519 $(eval $(call add_include_file,kernel/consteval.h))
520 $(eval $(call add_include_file,kernel/sigtools.h))
521 $(eval $(call add_include_file,kernel/modtools.h))
522 $(eval $(call add_include_file,kernel/macc.h))
523 $(eval $(call add_include_file,kernel/utils.h))
524 $(eval $(call add_include_file,kernel/satgen.h))
525 $(eval $(call add_include_file,libs/ezsat/ezsat.h))
526 $(eval $(call add_include_file,libs/ezsat/ezminisat.h))
527 $(eval $(call add_include_file,libs/sha1/sha1.h))
528 $(eval $(call add_include_file,passes/fsm/fsmdata.h))
529 $(eval $(call add_include_file,frontends/ast/ast.h))
530 $(eval $(call add_include_file,backends/ilang/ilang_backend.h))
531
532 OBJS += kernel/driver.o kernel/register.o kernel/rtlil.o kernel/log.o kernel/calc.o kernel/yosys.o
533 OBJS += kernel/cellaigs.o kernel/celledges.o
534
535 kernel/log.o: CXXFLAGS += -DYOSYS_SRC='"$(YOSYS_SRC)"'
536 kernel/yosys.o: CXXFLAGS += -DYOSYS_DATDIR='"$(DATDIR)"'
537
538 OBJS += libs/bigint/BigIntegerAlgorithms.o libs/bigint/BigInteger.o libs/bigint/BigIntegerUtils.o
539 OBJS += libs/bigint/BigUnsigned.o libs/bigint/BigUnsignedInABase.o
540
541 OBJS += libs/sha1/sha1.o
542
543 ifneq ($(SMALL),1)
544
545 OBJS += libs/subcircuit/subcircuit.o
546
547 OBJS += libs/ezsat/ezsat.o
548 OBJS += libs/ezsat/ezminisat.o
549
550 OBJS += libs/minisat/Options.o
551 OBJS += libs/minisat/SimpSolver.o
552 OBJS += libs/minisat/Solver.o
553 OBJS += libs/minisat/System.o
554
555 include $(YOSYS_SRC)/frontends/*/Makefile.inc
556 include $(YOSYS_SRC)/passes/*/Makefile.inc
557 include $(YOSYS_SRC)/backends/*/Makefile.inc
558 include $(YOSYS_SRC)/techlibs/*/Makefile.inc
559
560 else
561
562 include frontends/verilog/Makefile.inc
563 include frontends/ilang/Makefile.inc
564 include frontends/ast/Makefile.inc
565 include frontends/blif/Makefile.inc
566
567 OBJS += passes/hierarchy/hierarchy.o
568 OBJS += passes/cmds/select.o
569 OBJS += passes/cmds/show.o
570 OBJS += passes/cmds/stat.o
571 OBJS += passes/cmds/cover.o
572 OBJS += passes/cmds/design.o
573 OBJS += passes/cmds/plugin.o
574
575 include passes/proc/Makefile.inc
576 include passes/opt/Makefile.inc
577 include passes/techmap/Makefile.inc
578
579 include backends/verilog/Makefile.inc
580 include backends/ilang/Makefile.inc
581
582 include techlibs/common/Makefile.inc
583
584 endif
585
586 ifeq ($(LINK_ABC),1)
587 OBJS += yosys-libabc.a
588 endif
589
590 top-all: $(TARGETS) $(EXTRA_TARGETS)
591 @echo ""
592 @echo " Build successful."
593 @echo ""
594
595 ifeq ($(CONFIG),emcc)
596 yosys.js: $(filter-out yosysjs-$(YOSYS_VER).zip,$(EXTRA_TARGETS))
597 endif
598
599 yosys$(EXE): $(OBJS)
600 $(P) $(LD) -o yosys$(EXE) $(LDFLAGS) $(OBJS) $(LDLIBS)
601
602 libyosys.so: $(filter-out kernel/driver.o,$(OBJS))
603 ifeq ($(OS), Darwin)
604 $(P) $(LD) -o libyosys.so -shared -Wl,-install_name,libyosys.so $(LDFLAGS) $^ $(LDLIBS)
605 else
606 $(P) $(LD) -o libyosys.so -shared -Wl,-soname,libyosys.so $(LDFLAGS) $^ $(LDLIBS)
607 endif
608
609 %.o: %.cc
610 $(Q) mkdir -p $(dir $@)
611 $(P) $(CXX) -o $@ -c $(CPPFLAGS) $(CXXFLAGS) $<
612
613 %.pyh: %.h
614 $(Q) mkdir -p $(dir $@)
615 $(P) cat $< | grep -E -v "#[ ]*(include|error)" | $(LD) -x c++ -o $@ -E -P -
616
617 ifeq ($(ENABLE_PYOSYS),1)
618 $(PY_WRAPPER_FILE).cc: misc/$(PY_GEN_SCRIPT).py $(PY_WRAP_INCLUDES)
619 $(Q) mkdir -p $(dir $@)
620 $(P) python$(PYTHON_VERSION) -c "from misc import $(PY_GEN_SCRIPT); $(PY_GEN_SCRIPT).gen_wrappers(\"$(PY_WRAPPER_FILE).cc\")"
621 endif
622
623 %.o: %.cpp
624 $(Q) mkdir -p $(dir $@)
625 $(P) $(CXX) -o $@ -c $(CPPFLAGS) $(CXXFLAGS) $<
626
627 YOSYS_VER_STR := Yosys $(YOSYS_VER) (git sha1 $(GIT_REV), $(notdir $(CXX)) $(shell \
628 $(CXX) --version | tr ' ()' '\n' | grep '^[0-9]' | head -n1) $(filter -f% -m% -O% -DNDEBUG,$(CXXFLAGS)))
629
630 kernel/version_$(GIT_REV).cc: $(YOSYS_SRC)/Makefile
631 $(P) rm -f kernel/version_*.o kernel/version_*.d kernel/version_*.cc
632 $(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
633
634 ifeq ($(ENABLE_VERIFIC),1)
635 CXXFLAGS_NOVERIFIC = $(foreach v,$(CXXFLAGS),$(if $(findstring $(VERIFIC_DIR),$(v)),,$(v)))
636 LDLIBS_NOVERIFIC = $(foreach v,$(LDLIBS),$(if $(findstring $(VERIFIC_DIR),$(v)),,$(v)))
637 else
638 CXXFLAGS_NOVERIFIC = $(CXXFLAGS)
639 LDLIBS_NOVERIFIC = $(LDLIBS)
640 endif
641
642 yosys-config: misc/yosys-config.in
643 $(P) $(SED) -e 's#@CXXFLAGS@#$(subst -I. -I"$(YOSYS_SRC)",-I"$(DATDIR)/include",$(strip $(CXXFLAGS_NOVERIFIC)))#;' \
644 -e 's#@CXX@#$(strip $(CXX))#;' -e 's#@LDFLAGS@#$(strip $(LDFLAGS) $(PLUGIN_LDFLAGS))#;' -e 's#@LDLIBS@#$(strip $(LDLIBS_NOVERIFIC))#;' \
645 -e 's#@BINDIR@#$(strip $(BINDIR))#;' -e 's#@DATDIR@#$(strip $(DATDIR))#;' < $< > yosys-config
646 $(Q) chmod +x yosys-config
647
648 abc/abc-$(ABCREV)$(EXE) abc/libabc-$(ABCREV).a:
649 $(P)
650 ifneq ($(ABCREV),default)
651 $(Q) if test -d abc/.hg; then \
652 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; \
653 fi
654 $(Q) if ( cd abc 2> /dev/null && ! git diff-index --quiet HEAD; ); then \
655 echo 'REEBE: NOP pbagnvaf ybpny zbqvsvpngvbaf! Frg NOPERI=qrsnhyg va Lbflf Znxrsvyr!' | tr 'A-Za-z' 'N-ZA-Mn-za-m'; false; \
656 fi
657 $(Q) if test "`cd abc 2> /dev/null && git rev-parse --short HEAD`" != "$(ABCREV)"; then \
658 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; }; \
659 echo "Pulling ABC from $(ABCURL):"; set -x; \
660 test -d abc || git clone $(ABCURL) abc; \
661 cd abc && $(MAKE) DEP= clean && git fetch origin master && git checkout $(ABCREV); \
662 fi
663 endif
664 $(Q) rm -f abc/abc-[0-9a-f]*
665 $(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)
666
667 ifeq ($(ABCREV),default)
668 .PHONY: abc/abc-$(ABCREV)$(EXE)
669 .PHONY: abc/libabc-$(ABCREV).a
670 endif
671
672 yosys-abc$(EXE): abc/abc-$(ABCREV)$(EXE)
673 $(P) cp abc/abc-$(ABCREV)$(EXE) yosys-abc$(EXE)
674
675 yosys-libabc.a: abc/libabc-$(ABCREV).a
676 $(P) cp abc/libabc-$(ABCREV).a yosys-libabc.a
677
678 ifneq ($(SEED),)
679 SEEDOPT="-S $(SEED)"
680 else
681 SEEDOPT=""
682 endif
683
684 ifneq ($(ABCEXTERNAL),)
685 ABCOPT="-A $(ABCEXTERNAL)"
686 else
687 ABCOPT=""
688 endif
689
690 test: $(TARGETS) $(EXTRA_TARGETS)
691 +cd tests/simple && bash run-test.sh $(SEEDOPT)
692 +cd tests/simple_abc9 && bash run-test.sh $(SEEDOPT)
693 +cd tests/hana && bash run-test.sh $(SEEDOPT)
694 +cd tests/asicworld && bash run-test.sh $(SEEDOPT)
695 # +cd tests/realmath && bash run-test.sh $(SEEDOPT)
696 +cd tests/share && bash run-test.sh $(SEEDOPT)
697 +cd tests/opt_share && bash run-test.sh $(SEEDOPT)
698 +cd tests/fsm && bash run-test.sh $(SEEDOPT)
699 +cd tests/techmap && bash run-test.sh
700 +cd tests/memories && bash run-test.sh $(ABCOPT) $(SEEDOPT)
701 +cd tests/bram && bash run-test.sh $(SEEDOPT)
702 +cd tests/various && bash run-test.sh
703 +cd tests/sat && bash run-test.sh
704 +cd tests/svinterfaces && bash run-test.sh $(SEEDOPT)
705 +cd tests/proc && bash run-test.sh
706 +cd tests/opt && bash run-test.sh
707 +cd tests/aiger && bash run-test.sh $(ABCOPT)
708 +cd tests/arch && bash run-test.sh
709 @echo ""
710 @echo " Passed \"make test\"."
711 @echo ""
712
713 VALGRIND ?= valgrind --error-exitcode=1 --leak-check=full --show-reachable=yes --errors-for-leak-kinds=all
714
715 vgtest: $(TARGETS) $(EXTRA_TARGETS)
716 $(VALGRIND) ./yosys -p 'setattr -mod -unset top; synth' $$( ls tests/simple/*.v | grep -v repwhile.v )
717 @echo ""
718 @echo " Passed \"make vgtest\"."
719 @echo ""
720
721 vloghtb: $(TARGETS) $(EXTRA_TARGETS)
722 +cd tests/vloghtb && bash run-test.sh
723 @echo ""
724 @echo " Passed \"make vloghtb\"."
725 @echo ""
726
727 ystests: $(TARGETS) $(EXTRA_TARGETS)
728 rm -rf tests/ystests
729 git clone https://github.com/YosysHQ/yosys-tests.git tests/ystests
730 +$(MAKE) PATH="$$PWD:$$PATH" -C tests/ystests
731 @echo ""
732 @echo " Finished \"make ystests\"."
733 @echo ""
734
735 # Unit test
736 unit-test: libyosys.so
737 @$(MAKE) -C $(UNITESTPATH) CXX="$(CXX)" CPPFLAGS="$(CPPFLAGS)" \
738 CXXFLAGS="$(CXXFLAGS)" LDLIBS="$(LDLIBS)" ROOTPATH="$(CURDIR)"
739
740 clean-unit-test:
741 @$(MAKE) -C $(UNITESTPATH) clean
742
743 install: $(TARGETS) $(EXTRA_TARGETS)
744 $(INSTALL_SUDO) mkdir -p $(DESTDIR)$(BINDIR)
745 $(INSTALL_SUDO) cp $(TARGETS) $(DESTDIR)$(BINDIR)
746 ifneq ($(filter yosys,$(TARGETS)),)
747 $(INSTALL_SUDO) $(STRIP) -S $(DESTDIR)$(BINDIR)/yosys
748 endif
749 ifneq ($(filter yosys-abc,$(TARGETS)),)
750 $(INSTALL_SUDO) $(STRIP) $(DESTDIR)$(BINDIR)/yosys-abc
751 endif
752 ifneq ($(filter yosys-filterlib,$(TARGETS)),)
753 $(INSTALL_SUDO) $(STRIP) $(DESTDIR)$(BINDIR)/yosys-filterlib
754 endif
755 $(INSTALL_SUDO) mkdir -p $(DESTDIR)$(DATDIR)
756 $(INSTALL_SUDO) cp -r share/. $(DESTDIR)$(DATDIR)/.
757 ifeq ($(ENABLE_LIBYOSYS),1)
758 $(INSTALL_SUDO) mkdir -p $(DESTDIR)$(LIBDIR)
759 $(INSTALL_SUDO) cp libyosys.so $(DESTDIR)$(LIBDIR)/
760 $(INSTALL_SUDO) $(STRIP) -S $(DESTDIR)$(LIBDIR)/libyosys.so
761 ifeq ($(ENABLE_PYOSYS),1)
762 $(INSTALL_SUDO) mkdir -p $(PYTHON_DESTDIR)/pyosys
763 $(INSTALL_SUDO) cp libyosys.so $(PYTHON_DESTDIR)/pyosys/
764 $(INSTALL_SUDO) cp misc/__init__.py $(PYTHON_DESTDIR)/pyosys/
765 endif
766 endif
767
768 uninstall:
769 $(INSTALL_SUDO) rm -vf $(addprefix $(DESTDIR)$(BINDIR)/,$(notdir $(TARGETS)))
770 $(INSTALL_SUDO) rm -rvf $(DESTDIR)$(DATDIR)
771 ifeq ($(ENABLE_LIBYOSYS),1)
772 $(INSTALL_SUDO) rm -vf $(DESTDIR)$(LIBDIR)/libyosys.so
773 ifeq ($(ENABLE_PYOSYS),1)
774 $(INSTALL_SUDO) rm -vf $(PYTHON_DESTDIR)/pyosys/libyosys.so
775 $(INSTALL_SUDO) rm -vf $(PYTHON_DESTDIR)/pyosys/__init__.py
776 $(INSTALL_SUDO) rmdir $(PYTHON_DESTDIR)/pyosys
777 endif
778 endif
779
780 update-manual: $(TARGETS) $(EXTRA_TARGETS)
781 cd manual && ../yosys -p 'help -write-tex-command-reference-manual'
782
783 manual: $(TARGETS) $(EXTRA_TARGETS)
784 cd manual && bash appnotes.sh
785 cd manual && bash presentation.sh
786 cd manual && bash manual.sh
787
788 clean:
789 rm -rf share
790 rm -rf kernel/*.pyh
791 if test -d manual; then cd manual && sh clean.sh; fi
792 rm -f $(OBJS) $(GENFILES) $(TARGETS) $(EXTRA_TARGETS) $(EXTRA_OBJS) $(PY_WRAP_INCLUDES) $(PY_WRAPPER_FILE).cc
793 rm -f kernel/version_*.o kernel/version_*.cc
794 rm -f libs/*/*.d frontends/*/*.d passes/*/*.d backends/*/*.d kernel/*.d techlibs/*/*.d
795 rm -rf tests/asicworld/*.out tests/asicworld/*.log
796 rm -rf tests/hana/*.out tests/hana/*.log
797 rm -rf tests/simple/*.out tests/simple/*.log
798 rm -rf tests/memories/*.out tests/memories/*.log tests/memories/*.dmp
799 rm -rf tests/sat/*.log tests/techmap/*.log tests/various/*.log
800 rm -rf tests/bram/temp tests/fsm/temp tests/realmath/temp tests/share/temp tests/smv/temp
801 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_*
802 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
803 rm -f tests/tools/cmp_tbdata
804
805 clean-abc:
806 $(MAKE) -C abc DEP= clean
807 rm -f yosys-abc$(EXE) yosys-libabc.a abc/abc-[0-9a-f]* abc/libabc-[0-9a-f]*.a
808
809 mrproper: clean
810 git clean -xdf
811
812 coverage:
813 ./yosys -qp 'help; help -all'
814 rm -rf coverage.info coverage_html
815 lcov --capture -d . --no-external -o coverage.info
816 genhtml coverage.info --output-directory coverage_html
817
818 qtcreator:
819 { for file in $(basename $(OBJS)); do \
820 for prefix in cc y l; do if [ -f $${file}.$${prefix} ]; then echo $$file.$${prefix}; fi; done \
821 done; find backends frontends kernel libs passes -type f \( -name '*.h' -o -name '*.hh' \); } > qtcreator.files
822 { echo .; find backends frontends kernel libs passes -type f \( -name '*.h' -o -name '*.hh' \) -printf '%h\n' | sort -u; } > qtcreator.includes
823 touch qtcreator.config qtcreator.creator
824
825 vcxsrc: $(GENFILES) $(EXTRA_TARGETS)
826 rm -rf yosys-win32-vcxsrc-$(YOSYS_VER){,.zip}
827 set -e; for f in `ls $(filter %.cc %.cpp,$(GENFILES)) $(addsuffix .cc,$(basename $(OBJS))) $(addsuffix .cpp,$(basename $(OBJS))) 2> /dev/null`; do \
828 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
829 bash misc/create_vcxsrc.sh yosys-win32-vcxsrc $(YOSYS_VER) $(GIT_REV)
830 echo "namespace Yosys { extern const char *yosys_version_str; const char *yosys_version_str=\"Yosys (Version Information Unavailable)\"; }" > kernel/version.cc
831 zip yosys-win32-vcxsrc-$(YOSYS_VER)/genfiles.zip $(GENFILES) kernel/version.cc
832 zip -r yosys-win32-vcxsrc-$(YOSYS_VER).zip yosys-win32-vcxsrc-$(YOSYS_VER)/
833 rm -f srcfiles.txt kernel/version.cc
834
835 ifeq ($(CONFIG),mxe)
836 mxebin: $(TARGETS) $(EXTRA_TARGETS)
837 rm -rf yosys-win32-mxebin-$(YOSYS_VER){,.zip}
838 mkdir -p yosys-win32-mxebin-$(YOSYS_VER)
839 cp -r yosys.exe share/ yosys-win32-mxebin-$(YOSYS_VER)/
840 ifeq ($(ENABLE_ABC),1)
841 cp -r yosys-abc.exe abc/lib/x86/pthreadVC2.dll yosys-win32-mxebin-$(YOSYS_VER)/
842 endif
843 echo -en 'This is Yosys $(YOSYS_VER) for Win32.\r\n' > yosys-win32-mxebin-$(YOSYS_VER)/readme.txt
844 echo -en 'Documentation at http://www.clifford.at/yosys/.\r\n' >> yosys-win32-mxebin-$(YOSYS_VER)/readme.txt
845 zip -r yosys-win32-mxebin-$(YOSYS_VER).zip yosys-win32-mxebin-$(YOSYS_VER)/
846 endif
847
848 config-clean: clean
849 rm -f Makefile.conf
850
851 config-clang: clean
852 echo 'CONFIG := clang' > Makefile.conf
853
854 config-gcc: clean
855 echo 'CONFIG := gcc' > Makefile.conf
856
857 config-gcc-static: clean
858 echo 'CONFIG := gcc-static' > Makefile.conf
859 echo 'ENABLE_PLUGINS := 0' >> Makefile.conf
860 echo 'ENABLE_READLINE := 0' >> Makefile.conf
861 echo 'ENABLE_TCL := 0' >> Makefile.conf
862
863 config-gcc-4.8: clean
864 echo 'CONFIG := gcc-4.8' > Makefile.conf
865
866 config-afl-gcc: clean
867 echo 'CONFIG := afl-gcc' > Makefile.conf
868
869 config-emcc: clean
870 echo 'CONFIG := emcc' > Makefile.conf
871 echo 'ENABLE_TCL := 0' >> Makefile.conf
872 echo 'ENABLE_ABC := 0' >> Makefile.conf
873 echo 'ENABLE_PLUGINS := 0' >> Makefile.conf
874 echo 'ENABLE_READLINE := 0' >> Makefile.conf
875
876 config-mxe: clean
877 echo 'CONFIG := mxe' > Makefile.conf
878 echo 'ENABLE_PLUGINS := 0' >> Makefile.conf
879
880 config-msys2: clean
881 echo 'CONFIG := msys2' > Makefile.conf
882 echo 'ENABLE_PLUGINS := 0' >> Makefile.conf
883
884 config-msys2-64: clean
885 echo 'CONFIG := msys2-64' > Makefile.conf
886 echo 'ENABLE_PLUGINS := 0' >> Makefile.conf
887
888 config-cygwin: clean
889 echo 'CONFIG := cygwin' > Makefile.conf
890
891 config-gcov: clean
892 echo 'CONFIG := gcc' > Makefile.conf
893 echo 'ENABLE_GCOV := 1' >> Makefile.conf
894 echo 'ENABLE_DEBUG := 1' >> Makefile.conf
895
896 config-gprof: clean
897 echo 'CONFIG := gcc' > Makefile.conf
898 echo 'ENABLE_GPROF := 1' >> Makefile.conf
899
900 config-sudo:
901 echo "INSTALL_SUDO := sudo" >> Makefile.conf
902
903 echo-yosys-ver:
904 @echo "$(YOSYS_VER)"
905
906 echo-git-rev:
907 @echo "$(GIT_REV)"
908
909 -include libs/*/*.d
910 -include frontends/*/*.d
911 -include passes/*/*.d
912 -include backends/*/*.d
913 -include kernel/*.d
914 -include techlibs/*/*.d
915
916 .PHONY: all top-all abc test install install-abc manual clean mrproper qtcreator coverage vcxsrc mxebin
917 .PHONY: config-clean config-clang config-gcc config-gcc-static config-gcc-4.8 config-afl-gcc config-gprof config-sudo
918