Avoid creation of bogus initial blocks for assert/assume in always @*
[yosys.git] / Makefile
1
2 CONFIG := clang
3 # CONFIG := gcc
4 # CONFIG := gcc-4.8
5 # CONFIG := emcc
6 # CONFIG := mxe
7 # CONFIG := msys2
8
9 # features (the more the better)
10 ENABLE_TCL := 1
11 ENABLE_ABC := 1
12 ENABLE_PLUGINS := 1
13 ENABLE_READLINE := 1
14 ENABLE_VERIFIC := 0
15 ENABLE_COVER := 1
16 ENABLE_LIBYOSYS := 0
17
18 # other configuration flags
19 ENABLE_GPROF := 0
20 ENABLE_NDEBUG := 0
21
22 # clang sanitizers
23 SANITIZER =
24 # SANITIZER = address
25 # SANITIZER = memory
26 # SANITIZER = undefined
27 # SANITIZER = cfi
28
29
30 PREFIX ?= /usr/local
31 INSTALL_SUDO :=
32
33 BINDIR := $(PREFIX)/bin
34 LIBDIR := $(PREFIX)/lib
35 DATDIR := $(PREFIX)/share/yosys
36
37 EXE =
38 OBJS =
39 GENFILES =
40 EXTRA_OBJS =
41 EXTRA_TARGETS =
42 TARGETS = yosys$(EXE) yosys-config
43
44 PRETTY = 1
45 SMALL = 0
46
47 all: top-all
48
49 YOSYS_SRC := $(dir $(firstword $(MAKEFILE_LIST)))
50 VPATH := $(YOSYS_SRC)
51
52 CXXFLAGS += -Wall -Wextra -ggdb -I. -I"$(YOSYS_SRC)" -MD -D_YOSYS_ -fPIC -I$(PREFIX)/include
53 LDFLAGS += -L$(LIBDIR)
54 LDLIBS = -lstdc++ -lm
55
56 PKG_CONFIG = pkg-config
57 SED = sed
58 BISON = bison
59
60 ifeq (Darwin,$(findstring Darwin,$(shell uname)))
61 # add macports/homebrew include and library path to search directories, don't use '-rdynamic' and '-lrt':
62 CXXFLAGS += -I/opt/local/include -I/usr/local/opt/readline/include
63 LDFLAGS += -L/opt/local/lib -L/usr/local/opt/readline/lib
64 # add homebrew's libffi include and library path
65 CXXFLAGS += $(shell PKG_CONFIG_PATH=$$(brew list libffi | grep pkgconfig | xargs dirname) pkg-config --silence-errors --cflags libffi)
66 LDFLAGS += $(shell PKG_CONFIG_PATH=$$(brew list libffi | grep pkgconfig | xargs dirname) pkg-config --silence-errors --libs libffi)
67 # use bison installed by homebrew if available
68 BISON = $(shell (brew list bison | grep -m1 "bin/bison") || echo bison)
69 SED = sed
70 else
71 LDFLAGS += -rdynamic
72 LDLIBS += -lrt
73 endif
74
75 YOSYS_VER := 0.6+$(shell test -e .git && { git log --author=clifford@clifford.at --oneline 5869d26da021.. | wc -l; })
76 GIT_REV := $(shell cd $(YOSYS_SRC) && git rev-parse --short HEAD 2> /dev/null || echo UNKNOWN)
77 OBJS = kernel/version_$(GIT_REV).o
78
79 # set 'ABCREV = default' to use abc/ as it is
80 #
81 # Note: If you do ABC development, make sure that 'abc' in this directory
82 # is just a symlink to your actual ABC working directory, as 'make mrproper'
83 # will remove the 'abc' directory and you do not want to accidentally
84 # delete your work on ABC..
85 ABCREV = a86455b00da5
86 ABCPULL = 1
87 ABCURL ?= https://bitbucket.org/alanmi/abc
88 ABCMKARGS = CC="$(CXX)" CXX="$(CXX)"
89
90 # set ABCEXTERNAL = <abc-command> to use an external ABC instance
91 # Note: The in-tree ABC (yosys-abc) will not be installed when ABCEXTERNAL is set.
92 ABCEXTERNAL =
93
94 define newline
95
96
97 endef
98
99 ifneq ($(wildcard Makefile.conf),)
100 $(info $(subst $$--$$,$(newline),$(shell sed 's,^,[Makefile.conf] ,; s,$$,$$--$$,;' < Makefile.conf | tr -d '\n' | sed 's,\$$--\$$$$,,')))
101 include Makefile.conf
102 endif
103
104 ifeq ($(CONFIG),clang)
105 CXX = clang
106 LD = clang++
107 CXXFLAGS += -std=c++11 -Os
108
109 ifneq ($(SANITIZER),)
110 $(info [Clang Sanitizer] $(SANITIZER))
111 CXXFLAGS += -g -O1 -fno-omit-frame-pointer -fno-optimize-sibling-calls -fsanitize=$(SANITIZER)
112 LDFLAGS += -g -fsanitize=$(SANITIZER)
113 ifeq ($(SANITIZER),address)
114 ENABLE_COVER := 0
115 endif
116 ifeq ($(SANITIZER),memory)
117 CXXFLAGS += -fPIE -fsanitize-memory-track-origins
118 LDFLAGS += -fPIE -fsanitize-memory-track-origins
119 endif
120 ifeq ($(SANITIZER),cfi)
121 CXXFLAGS += -flto
122 LDFLAGS += -flto
123 endif
124 endif
125
126 else ifeq ($(CONFIG),gcc)
127 CXX = gcc
128 LD = gcc
129 CXXFLAGS += -std=c++11 -Os
130
131 else ifeq ($(CONFIG),gcc-4.8)
132 CXX = gcc-4.8
133 LD = gcc-4.8
134 CXXFLAGS += -std=c++11 -Os
135
136 else ifeq ($(CONFIG),emcc)
137 CXX = emcc
138 LD = emcc
139 CXXFLAGS := -std=c++11 $(filter-out -fPIC -ggdb,$(CXXFLAGS))
140 EMCCFLAGS := -Os -Wno-warn-absolute-paths
141 EMCCFLAGS += --memory-init-file 0 --embed-file share -s NO_EXIT_RUNTIME=1
142 EMCCFLAGS += -s EXPORTED_FUNCTIONS="['_main','_run','_prompt','_errmsg']"
143 EMCCFLAGS += -s TOTAL_MEMORY=128*1024*1024
144 # https://github.com/kripken/emscripten/blob/master/src/settings.js
145 CXXFLAGS += $(EMCCFLAGS)
146 LDFLAGS += $(EMCCFLAGS)
147 LDLIBS =
148 EXE = .js
149
150 TARGETS := $(filter-out yosys-config,$(TARGETS))
151 EXTRA_TARGETS += yosysjs-$(YOSYS_VER).zip
152
153 viz.js:
154 wget -O viz.js.part https://github.com/mdaines/viz.js/releases/download/0.0.3/viz.js
155 mv viz.js.part viz.js
156
157 yosysjs-$(YOSYS_VER).zip: yosys.js viz.js misc/yosysjs/*
158 rm -rf yosysjs-$(YOSYS_VER) yosysjs-$(YOSYS_VER).zip
159 mkdir -p yosysjs-$(YOSYS_VER)
160 cp viz.js misc/yosysjs/* yosys.js yosysjs-$(YOSYS_VER)/
161 zip -r yosysjs-$(YOSYS_VER).zip yosysjs-$(YOSYS_VER)
162
163 yosys.html: misc/yosys.html
164 $(P) cp misc/yosys.html yosys.html
165
166 else ifeq ($(CONFIG),mxe)
167 CXX = /usr/local/src/mxe/usr/bin/i686-w64-mingw32.static-gcc
168 LD = /usr/local/src/mxe/usr/bin/i686-w64-mingw32.static-gcc
169 CXXFLAGS += -std=c++11 -Os -D_POSIX_SOURCE
170 CXXFLAGS := $(filter-out -fPIC,$(CXXFLAGS))
171 LDFLAGS := $(filter-out -rdynamic,$(LDFLAGS)) -s
172 LDLIBS := $(filter-out -lrt,$(LDLIBS))
173 ABCMKARGS += ARCHFLAGS="-DSIZEOF_VOID_P=4 -DSIZEOF_LONG=4 -DSIZEOF_INT=4 -DWIN32_NO_DLL -DHAVE_STRUCT_TIMESPEC -x c++ -fpermissive -w"
174 ABCMKARGS += LIBS="lib/x86/pthreadVC2.lib -s" ABC_USE_NO_READLINE=1 CC="$(CXX)" CXX="$(CXX)"
175 EXE = .exe
176
177 else ifeq ($(CONFIG),msys2)
178 CXX = i686-w64-mingw32-gcc
179 LD = i686-w64-mingw32-gcc
180 CXXFLAGS += -std=c++11 -Os -D_POSIX_SOURCE -DYOSYS_WIN32_UNIX_DIR
181 CXXFLAGS := $(filter-out -fPIC,$(CXXFLAGS))
182 LDFLAGS := $(filter-out -rdynamic,$(LDFLAGS)) -s
183 LDLIBS := $(filter-out -lrt,$(LDLIBS))
184 ABCMKARGS += ARCHFLAGS="-DSIZEOF_VOID_P=4 -DSIZEOF_LONG=4 -DSIZEOF_INT=4 -DWIN32_NO_DLL -DHAVE_STRUCT_TIMESPEC -x c++ -fpermissive -w"
185 ABCMKARGS += LIBS="lib/x86/pthreadVC2.lib -s" ABC_USE_NO_READLINE=0 CC="$(CXX)" CXX="$(CXX)"
186 EXE = .exe
187
188 else ifneq ($(CONFIG),none)
189 $(error Invalid CONFIG setting '$(CONFIG)'. Valid values: clang, gcc, gcc-4.8, emcc, mxe, msys2)
190 endif
191
192 ifeq ($(ENABLE_LIBYOSYS),1)
193 TARGETS += libyosys.so
194 endif
195
196 ifeq ($(ENABLE_READLINE),1)
197 CXXFLAGS += -DYOSYS_ENABLE_READLINE
198 LDLIBS += -lreadline
199 ifeq ($(CONFIG),mxe)
200 LDLIBS += -lpdcurses
201 endif
202 endif
203
204 ifeq ($(ENABLE_PLUGINS),1)
205 CXXFLAGS += -DYOSYS_ENABLE_PLUGINS $(shell $(PKG_CONFIG) --silence-errors --cflags libffi)
206 LDLIBS += $(shell $(PKG_CONFIG) --silence-errors --libs libffi || echo -lffi) -ldl
207 endif
208
209 ifeq ($(ENABLE_TCL),1)
210 TCL_VERSION ?= tcl$(shell bash -c "tclsh <(echo 'puts [info tclversion]')")
211 TCL_INCLUDE ?= /usr/include/$(TCL_VERSION)
212 CXXFLAGS += -I$(TCL_INCLUDE) -DYOSYS_ENABLE_TCL
213 LDLIBS += -l$(TCL_VERSION)
214 endif
215
216 ifeq ($(ENABLE_GPROF),1)
217 CXXFLAGS += -pg
218 LDFLAGS += -pg
219 endif
220
221 ifeq ($(ENABLE_NDEBUG),1)
222 CXXFLAGS := -O3 -DNDEBUG $(filter-out -Os,$(CXXFLAGS))
223 endif
224
225 ifeq ($(ENABLE_ABC),1)
226 CXXFLAGS += -DYOSYS_ENABLE_ABC
227 ifeq ($(ABCEXTERNAL),)
228 TARGETS += yosys-abc$(EXE)
229 endif
230 endif
231
232 ifeq ($(ENABLE_VERIFIC),1)
233 VERIFIC_DIR ?= /usr/local/src/verific_lib_eval
234 VERIFIC_COMPONENTS ?= verilog vhdl database util containers sdf
235 CXXFLAGS += $(patsubst %,-I$(VERIFIC_DIR)/%,$(VERIFIC_COMPONENTS)) -DYOSYS_ENABLE_VERIFIC
236 LDLIBS += $(patsubst %,$(VERIFIC_DIR)/%/*-linux.a,$(VERIFIC_COMPONENTS))
237 endif
238
239 ifeq ($(ENABLE_COVER),1)
240 CXXFLAGS += -DYOSYS_ENABLE_COVER
241 endif
242
243 define add_share_file
244 EXTRA_TARGETS += $(subst //,/,$(1)/$(notdir $(2)))
245 $(subst //,/,$(1)/$(notdir $(2))): $(2)
246 $$(P) mkdir -p $(1)
247 $$(Q) cp "$(YOSYS_SRC)"/$(2) $(subst //,/,$(1)/$(notdir $(2)))
248 endef
249
250 define add_gen_share_file
251 EXTRA_TARGETS += $(subst //,/,$(1)/$(notdir $(2)))
252 $(subst //,/,$(1)/$(notdir $(2))): $(2)
253 $$(P) mkdir -p $(1)
254 $$(Q) cp $(2) $(subst //,/,$(1)/$(notdir $(2)))
255 endef
256
257 define add_include_file
258 $(eval $(call add_share_file,$(dir share/include/$(1)),$(1)))
259 endef
260
261 ifeq ($(PRETTY), 1)
262 P_STATUS = 0
263 P_OFFSET = 0
264 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; }'))
265 P_SHOW = [$(shell gawk "BEGIN { N=$(words $(OBJS) yosys$(EXE)); printf \"%3d\", $(P_OFFSET)+90*$(P_STATUS)/N; exit; }")%]
266 P = @echo "$(if $(findstring $@,$(TARGETS) $(EXTRA_TARGETS)),$(eval P_OFFSET = 10))$(call P_UPDATE)$(call P_SHOW) Building $@";
267 Q = @
268 S = -s
269 else
270 P_SHOW = ->
271 P =
272 Q =
273 S =
274 endif
275
276 $(eval $(call add_include_file,kernel/yosys.h))
277 $(eval $(call add_include_file,kernel/hashlib.h))
278 $(eval $(call add_include_file,kernel/log.h))
279 $(eval $(call add_include_file,kernel/rtlil.h))
280 $(eval $(call add_include_file,kernel/register.h))
281 $(eval $(call add_include_file,kernel/celltypes.h))
282 $(eval $(call add_include_file,kernel/consteval.h))
283 $(eval $(call add_include_file,kernel/sigtools.h))
284 $(eval $(call add_include_file,kernel/modtools.h))
285 $(eval $(call add_include_file,kernel/macc.h))
286 $(eval $(call add_include_file,kernel/utils.h))
287 $(eval $(call add_include_file,kernel/satgen.h))
288 $(eval $(call add_include_file,libs/ezsat/ezsat.h))
289 $(eval $(call add_include_file,libs/ezsat/ezminisat.h))
290 $(eval $(call add_include_file,libs/sha1/sha1.h))
291 $(eval $(call add_include_file,passes/fsm/fsmdata.h))
292 $(eval $(call add_include_file,frontends/ast/ast.h))
293 $(eval $(call add_include_file,backends/ilang/ilang_backend.h))
294
295 OBJS += kernel/driver.o kernel/register.o kernel/rtlil.o kernel/log.o kernel/calc.o kernel/yosys.o
296 OBJS += kernel/cellaigs.o kernel/celledges.o
297
298 kernel/log.o: CXXFLAGS += -DYOSYS_SRC='"$(YOSYS_SRC)"'
299 kernel/yosys.o: CXXFLAGS += -DYOSYS_DATDIR='"$(DATDIR)"'
300
301 OBJS += libs/bigint/BigIntegerAlgorithms.o libs/bigint/BigInteger.o libs/bigint/BigIntegerUtils.o
302 OBJS += libs/bigint/BigUnsigned.o libs/bigint/BigUnsignedInABase.o
303
304 OBJS += libs/sha1/sha1.o
305
306 ifneq ($(SMALL),1)
307
308 OBJS += libs/subcircuit/subcircuit.o
309
310 OBJS += libs/ezsat/ezsat.o
311 OBJS += libs/ezsat/ezminisat.o
312
313 OBJS += libs/minisat/Options.o
314 OBJS += libs/minisat/SimpSolver.o
315 OBJS += libs/minisat/Solver.o
316 OBJS += libs/minisat/System.o
317
318 include $(YOSYS_SRC)/frontends/*/Makefile.inc
319 include $(YOSYS_SRC)/passes/*/Makefile.inc
320 include $(YOSYS_SRC)/backends/*/Makefile.inc
321 include $(YOSYS_SRC)/techlibs/*/Makefile.inc
322
323 else
324
325 include frontends/verilog/Makefile.inc
326 include frontends/ilang/Makefile.inc
327 include frontends/ast/Makefile.inc
328 include frontends/blif/Makefile.inc
329
330 OBJS += passes/hierarchy/hierarchy.o
331 OBJS += passes/cmds/select.o
332 OBJS += passes/cmds/show.o
333 OBJS += passes/cmds/stat.o
334 OBJS += passes/cmds/cover.o
335 OBJS += passes/cmds/design.o
336 OBJS += passes/cmds/plugin.o
337
338 include passes/proc/Makefile.inc
339 include passes/opt/Makefile.inc
340 include passes/techmap/Makefile.inc
341
342 include backends/verilog/Makefile.inc
343 include backends/ilang/Makefile.inc
344
345 include techlibs/common/Makefile.inc
346
347 endif
348
349 top-all: $(TARGETS) $(EXTRA_TARGETS)
350 @echo ""
351 @echo " Build successful."
352 @echo ""
353
354 ifeq ($(CONFIG),emcc)
355 yosys.js: $(filter-out yosysjs-$(YOSYS_VER).zip,$(EXTRA_TARGETS))
356 endif
357
358 yosys$(EXE): $(OBJS)
359 $(P) $(LD) -o yosys$(EXE) $(LDFLAGS) $(OBJS) $(LDLIBS)
360
361 libyosys.so: $(filter-out kernel/driver.o,$(OBJS))
362 $(P) $(LD) -o libyosys.so -shared -Wl,-soname,libyosys.so $(LDFLAGS) $^ $(LDLIBS)
363
364 %.o: %.cc
365 $(Q) mkdir -p $(dir $@)
366 $(P) $(CXX) -o $@ -c $(CPPFLAGS) $(CXXFLAGS) $<
367
368 %.o: %.cpp
369 $(Q) mkdir -p $(dir $@)
370 $(P) $(CXX) -o $@ -c $(CPPFLAGS) $(CXXFLAGS) $<
371
372 kernel/version_$(GIT_REV).cc: $(YOSYS_SRC)/Makefile
373 $(P) rm -f kernel/version_*.o kernel/version_*.d kernel/version_*.cc
374 $(Q) mkdir -p kernel && echo "namespace Yosys { extern const char *yosys_version_str; const char *yosys_version_str=\"Yosys $(YOSYS_VER) (git sha1 $(GIT_REV), $(notdir $(CXX)) ` \
375 $(CXX) --version | tr ' ()' '\n' | grep '^[0-9]' | head -n1` $(filter -f% -m% -O% -DNDEBUG,$(CXXFLAGS)))\"; }" > kernel/version_$(GIT_REV).cc
376
377 yosys-config: misc/yosys-config.in
378 $(P) $(SED) -e 's#@CXXFLAGS@#$(subst -I. -I"$(YOSYS_SRC)",-I"$(DATDIR)/include",$(CXXFLAGS))#;' \
379 -e 's#@CXX@#$(CXX)#;' -e 's#@LDFLAGS@#$(LDFLAGS)#;' -e 's#@LDLIBS@#$(LDLIBS)#;' \
380 -e 's#@BINDIR@#$(BINDIR)#;' -e 's#@DATDIR@#$(DATDIR)#;' < $< > yosys-config
381 $(Q) chmod +x yosys-config
382
383 abc/abc-$(ABCREV)$(EXE):
384 $(P)
385 ifneq ($(ABCREV),default)
386 $(Q) if ( cd abc 2> /dev/null && hg identify; ) | grep -q +; then \
387 echo 'REEBE: NOP pbagnvaf ybpny zbqvsvpngvbaf! Frg NOPERI=qrsnhyg va Lbflf Znxrsvyr!' | tr 'A-Za-z' 'N-ZA-Mn-za-m'; false; \
388 fi
389 $(Q) if test "`cd abc 2> /dev/null && hg identify | cut -f1 -d' '`" != "$(ABCREV)"; then \
390 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; }; \
391 echo "Pulling ABC from $(ABCURL):"; set -x; \
392 test -d abc || hg clone $(ABCURL) abc; \
393 cd abc && $(MAKE) DEP= clean && hg pull && hg update -r $(ABCREV); \
394 fi
395 endif
396 $(Q) rm -f abc/abc-[0-9a-f]*
397 $(Q) cd abc && $(MAKE) $(S) $(ABCMKARGS) PROG="abc-$(ABCREV)$(EXE)" MSG_PREFIX="$(eval P_OFFSET = 5)$(call P_SHOW)$(eval P_OFFSET = 10) ABC: "
398
399 ifeq ($(ABCREV),default)
400 .PHONY: abc/abc-$(ABCREV)$(EXE)
401 endif
402
403 yosys-abc$(EXE): abc/abc-$(ABCREV)$(EXE)
404 $(P) cp abc/abc-$(ABCREV)$(EXE) yosys-abc$(EXE)
405
406 test: $(TARGETS) $(EXTRA_TARGETS)
407 +cd tests/simple && bash run-test.sh
408 +cd tests/hana && bash run-test.sh
409 +cd tests/asicworld && bash run-test.sh
410 +cd tests/realmath && bash run-test.sh
411 +cd tests/share && bash run-test.sh
412 +cd tests/fsm && bash run-test.sh
413 +cd tests/techmap && bash run-test.sh
414 +cd tests/memories && bash run-test.sh
415 +cd tests/bram && bash run-test.sh
416 +cd tests/various && bash run-test.sh
417 +cd tests/sat && bash run-test.sh
418 @echo ""
419 @echo " Passed \"make test\"."
420 @echo ""
421
422 VALGRIND ?= valgrind --error-exitcode=1 --leak-check=full --show-reachable=yes --errors-for-leak-kinds=all
423
424 vgtest: $(TARGETS) $(EXTRA_TARGETS)
425 $(VALGRIND) ./yosys -p 'setattr -mod -unset top; synth' $$( ls tests/simple/*.v | grep -v repwhile.v )
426 @echo ""
427 @echo " Passed \"make vgtest\"."
428 @echo ""
429
430 vloghtb: $(TARGETS) $(EXTRA_TARGETS)
431 +cd tests/vloghtb && bash run-test.sh
432 @echo ""
433 @echo " Passed \"make vloghtb\"."
434 @echo ""
435
436 install: $(TARGETS) $(EXTRA_TARGETS)
437 $(INSTALL_SUDO) mkdir -p $(DESTDIR)$(BINDIR)
438 $(INSTALL_SUDO) install $(TARGETS) $(DESTDIR)$(BINDIR)
439 $(INSTALL_SUDO) mkdir -p $(DESTDIR)$(DATDIR)
440 $(INSTALL_SUDO) cp -r share/. $(DESTDIR)$(DATDIR)/.
441 ifeq ($(ENABLE_LIBYOSYS),1)
442 $(INSTALL_SUDO) cp libyosys.so $(DESTDIR)$(LIBDIR)
443 $(INSTALL_SUDO) ldconfig
444 endif
445
446 uninstall:
447 $(INSTALL_SUDO) rm -vf $(addprefix $(DESTDIR)$(BINDIR),$(notdir $(TARGETS)))
448 $(INSTALL_SUDO) rm -rvf $(DESTDIR)$(DATDIR)
449 ifeq ($(ENABLE_LIBYOSYS),1)
450 $(INSTALL_SUDO) rm -vf $(DESTDIR)$(LIBDIR)/libyosys.so
451 endif
452
453 update-manual: $(TARGETS) $(EXTRA_TARGETS)
454 cd manual && ../yosys -p 'help -write-tex-command-reference-manual'
455
456 manual: $(TARGETS) $(EXTRA_TARGETS)
457 cd manual && bash appnotes.sh
458 cd manual && bash presentation.sh
459 cd manual && bash manual.sh
460
461 clean:
462 rm -rf share
463 if test -d manual; then cd manual && sh clean.sh; fi
464 rm -f $(OBJS) $(GENFILES) $(TARGETS) $(EXTRA_TARGETS) $(EXTRA_OBJS)
465 rm -f kernel/version_*.o kernel/version_*.cc abc/abc-[0-9a-f]*
466 rm -f libs/*/*.d frontends/*/*.d passes/*/*.d backends/*/*.d kernel/*.d techlibs/*/*.d
467
468 clean-abc:
469 $(MAKE) -C abc DEP= clean
470 rm -f yosys-abc$(EXE) abc/abc-[0-9a-f]*
471
472 mrproper: clean
473 git clean -xdf
474
475 qtcreator:
476 { for file in $(basename $(OBJS)); do \
477 for prefix in cc y l; do if [ -f $${file}.$${prefix} ]; then echo $$file.$${prefix}; fi; done \
478 done; find backends frontends kernel libs passes -type f \( -name '*.h' -o -name '*.hh' \); } > qtcreator.files
479 { echo .; find backends frontends kernel libs passes -type f \( -name '*.h' -o -name '*.hh' \) -printf '%h\n' | sort -u; } > qtcreator.includes
480 touch qtcreator.config qtcreator.creator
481
482 vcxsrc: $(GENFILES) $(EXTRA_TARGETS)
483 rm -rf yosys-win32-vcxsrc-$(YOSYS_VER){,.zip}
484 set -e; for f in `ls $(filter %.cc %.cpp,$(GENFILES)) $(addsuffix .cc,$(basename $(OBJS))) $(addsuffix .cpp,$(basename $(OBJS))) 2> /dev/null`; do \
485 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
486 bash misc/create_vcxsrc.sh yosys-win32-vcxsrc $(YOSYS_VER) $(GIT_REV)
487 echo "namespace Yosys { extern const char *yosys_version_str; const char *yosys_version_str=\"Yosys (Version Information Unavailable)\"; }" > kernel/version.cc
488 zip yosys-win32-vcxsrc-$(YOSYS_VER)/genfiles.zip $(GENFILES) kernel/version.cc
489 zip -r yosys-win32-vcxsrc-$(YOSYS_VER).zip yosys-win32-vcxsrc-$(YOSYS_VER)/
490 rm -f srcfiles.txt kernel/version.cc
491
492 ifeq ($(CONFIG),mxe)
493 mxebin: $(TARGETS) $(EXTRA_TARGETS)
494 rm -rf yosys-win32-mxebin-$(YOSYS_VER){,.zip}
495 mkdir -p yosys-win32-mxebin-$(YOSYS_VER)
496 cp -r yosys.exe share/ yosys-win32-mxebin-$(YOSYS_VER)/
497 ifeq ($(ENABLE_ABC),1)
498 cp -r yosys-abc.exe abc/lib/x86/pthreadVC2.dll yosys-win32-mxebin-$(YOSYS_VER)/
499 endif
500 echo -en 'This is Yosys $(YOSYS_VER) for Win32.\r\n' > yosys-win32-mxebin-$(YOSYS_VER)/readme.txt
501 echo -en 'Documentation at http://www.clifford.at/yosys/.\r\n' >> yosys-win32-mxebin-$(YOSYS_VER)/readme.txt
502 zip -r yosys-win32-mxebin-$(YOSYS_VER).zip yosys-win32-mxebin-$(YOSYS_VER)/
503 endif
504
505 config-clean: clean
506 rm -f Makefile.conf
507
508 config-clang: clean
509 echo 'CONFIG := clang' > Makefile.conf
510
511 config-gcc: clean
512 echo 'CONFIG := gcc' > Makefile.conf
513
514 config-gcc-4.8: clean
515 echo 'CONFIG := gcc-4.8' > Makefile.conf
516
517 config-emcc: clean
518 echo 'CONFIG := emcc' > Makefile.conf
519 echo 'ENABLE_TCL := 0' >> Makefile.conf
520 echo 'ENABLE_ABC := 0' >> Makefile.conf
521 echo 'ENABLE_PLUGINS := 0' >> Makefile.conf
522 echo 'ENABLE_READLINE := 0' >> Makefile.conf
523
524 config-mxe: clean
525 echo 'CONFIG := mxe' > Makefile.conf
526 echo 'ENABLE_TCL := 0' >> Makefile.conf
527 echo 'ENABLE_PLUGINS := 0' >> Makefile.conf
528 echo 'ENABLE_READLINE := 0' >> Makefile.conf
529
530 config-msys2: clean
531 echo 'CONFIG := msys2' > Makefile.conf
532
533 config-gprof: clean
534 echo 'CONFIG := gcc' > Makefile.conf
535 echo 'ENABLE_GPROF := 1' >> Makefile.conf
536
537 config-sudo:
538 echo "INSTALL_SUDO := sudo" >> Makefile.conf
539
540 echo-yosys-ver:
541 @echo "$(YOSYS_VER)"
542
543 echo-git-rev:
544 @echo "$(GIT_REV)"
545
546 -include libs/*/*.d
547 -include frontends/*/*.d
548 -include passes/*/*.d
549 -include backends/*/*.d
550 -include kernel/*.d
551 -include techlibs/*/*.d
552
553 .PHONY: all top-all abc test install install-abc manual clean mrproper qtcreator
554 .PHONY: config-clean config-clang config-gcc config-gcc-4.8 config-gprof config-sudo
555