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