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