Added a new configuration variable GIT_REV_WHERE
[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 GIT_REV_WHERE ?= HEAD
76 YOSYS_VER := 0.6+$(shell test -e .git && { git log --author=clifford@clifford.at --oneline 5869d26da021.. | wc -l; })
77 GIT_REV := $(shell cd $(YOSYS_SRC) && git rev-parse --short $(GIT_REV_WHERE) 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 ($(CONFIG),mxe)
201 LDLIBS += -lpdcurses
202 endif
203 endif
204
205 ifeq ($(ENABLE_PLUGINS),1)
206 CXXFLAGS += -DYOSYS_ENABLE_PLUGINS $(shell $(PKG_CONFIG) --silence-errors --cflags libffi)
207 LDLIBS += $(shell $(PKG_CONFIG) --silence-errors --libs libffi || echo -lffi) -ldl
208 endif
209
210 ifeq ($(ENABLE_TCL),1)
211 TCL_VERSION ?= tcl$(shell bash -c "tclsh <(echo 'puts [info tclversion]')")
212 TCL_INCLUDE ?= /usr/include/$(TCL_VERSION)
213 CXXFLAGS += -I$(TCL_INCLUDE) -DYOSYS_ENABLE_TCL
214 LDLIBS += -l$(TCL_VERSION)
215 endif
216
217 ifeq ($(ENABLE_GPROF),1)
218 CXXFLAGS += -pg
219 LDFLAGS += -pg
220 endif
221
222 ifeq ($(ENABLE_NDEBUG),1)
223 CXXFLAGS := -O3 -DNDEBUG $(filter-out -Os,$(CXXFLAGS))
224 endif
225
226 ifeq ($(ENABLE_ABC),1)
227 CXXFLAGS += -DYOSYS_ENABLE_ABC
228 ifeq ($(ABCEXTERNAL),)
229 TARGETS += yosys-abc$(EXE)
230 endif
231 endif
232
233 ifeq ($(ENABLE_VERIFIC),1)
234 VERIFIC_DIR ?= /usr/local/src/verific_lib_eval
235 VERIFIC_COMPONENTS ?= verilog vhdl database util containers sdf
236 CXXFLAGS += $(patsubst %,-I$(VERIFIC_DIR)/%,$(VERIFIC_COMPONENTS)) -DYOSYS_ENABLE_VERIFIC
237 LDLIBS += $(patsubst %,$(VERIFIC_DIR)/%/*-linux.a,$(VERIFIC_COMPONENTS))
238 endif
239
240 ifeq ($(ENABLE_COVER),1)
241 CXXFLAGS += -DYOSYS_ENABLE_COVER
242 endif
243
244 define add_share_file
245 EXTRA_TARGETS += $(subst //,/,$(1)/$(notdir $(2)))
246 $(subst //,/,$(1)/$(notdir $(2))): $(2)
247 $$(P) mkdir -p $(1)
248 $$(Q) cp "$(YOSYS_SRC)"/$(2) $(subst //,/,$(1)/$(notdir $(2)))
249 endef
250
251 define add_gen_share_file
252 EXTRA_TARGETS += $(subst //,/,$(1)/$(notdir $(2)))
253 $(subst //,/,$(1)/$(notdir $(2))): $(2)
254 $$(P) mkdir -p $(1)
255 $$(Q) cp $(2) $(subst //,/,$(1)/$(notdir $(2)))
256 endef
257
258 define add_include_file
259 $(eval $(call add_share_file,$(dir share/include/$(1)),$(1)))
260 endef
261
262 ifeq ($(PRETTY), 1)
263 P_STATUS = 0
264 P_OFFSET = 0
265 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; }'))
266 P_SHOW = [$(shell gawk "BEGIN { N=$(words $(OBJS) yosys$(EXE)); printf \"%3d\", $(P_OFFSET)+90*$(P_STATUS)/N; exit; }")%]
267 P = @echo "$(if $(findstring $@,$(TARGETS) $(EXTRA_TARGETS)),$(eval P_OFFSET = 10))$(call P_UPDATE)$(call P_SHOW) Building $@";
268 Q = @
269 S = -s
270 else
271 P_SHOW = ->
272 P =
273 Q =
274 S =
275 endif
276
277 $(eval $(call add_include_file,kernel/yosys.h))
278 $(eval $(call add_include_file,kernel/hashlib.h))
279 $(eval $(call add_include_file,kernel/log.h))
280 $(eval $(call add_include_file,kernel/rtlil.h))
281 $(eval $(call add_include_file,kernel/register.h))
282 $(eval $(call add_include_file,kernel/celltypes.h))
283 $(eval $(call add_include_file,kernel/celledges.h))
284 $(eval $(call add_include_file,kernel/consteval.h))
285 $(eval $(call add_include_file,kernel/sigtools.h))
286 $(eval $(call add_include_file,kernel/modtools.h))
287 $(eval $(call add_include_file,kernel/macc.h))
288 $(eval $(call add_include_file,kernel/utils.h))
289 $(eval $(call add_include_file,kernel/satgen.h))
290 $(eval $(call add_include_file,libs/ezsat/ezsat.h))
291 $(eval $(call add_include_file,libs/ezsat/ezminisat.h))
292 $(eval $(call add_include_file,libs/sha1/sha1.h))
293 $(eval $(call add_include_file,passes/fsm/fsmdata.h))
294 $(eval $(call add_include_file,frontends/ast/ast.h))
295 $(eval $(call add_include_file,backends/ilang/ilang_backend.h))
296
297 OBJS += kernel/driver.o kernel/register.o kernel/rtlil.o kernel/log.o kernel/calc.o kernel/yosys.o
298 OBJS += kernel/cellaigs.o kernel/celledges.o
299
300 kernel/log.o: CXXFLAGS += -DYOSYS_SRC='"$(YOSYS_SRC)"'
301 kernel/yosys.o: CXXFLAGS += -DYOSYS_DATDIR='"$(DATDIR)"'
302
303 OBJS += libs/bigint/BigIntegerAlgorithms.o libs/bigint/BigInteger.o libs/bigint/BigIntegerUtils.o
304 OBJS += libs/bigint/BigUnsigned.o libs/bigint/BigUnsignedInABase.o
305
306 OBJS += libs/sha1/sha1.o
307
308 ifneq ($(SMALL),1)
309
310 OBJS += libs/subcircuit/subcircuit.o
311
312 OBJS += libs/ezsat/ezsat.o
313 OBJS += libs/ezsat/ezminisat.o
314
315 OBJS += libs/minisat/Options.o
316 OBJS += libs/minisat/SimpSolver.o
317 OBJS += libs/minisat/Solver.o
318 OBJS += libs/minisat/System.o
319
320 include $(YOSYS_SRC)/frontends/*/Makefile.inc
321 include $(YOSYS_SRC)/passes/*/Makefile.inc
322 include $(YOSYS_SRC)/backends/*/Makefile.inc
323 include $(YOSYS_SRC)/techlibs/*/Makefile.inc
324
325 else
326
327 include frontends/verilog/Makefile.inc
328 include frontends/ilang/Makefile.inc
329 include frontends/ast/Makefile.inc
330 include frontends/blif/Makefile.inc
331
332 OBJS += passes/hierarchy/hierarchy.o
333 OBJS += passes/cmds/select.o
334 OBJS += passes/cmds/show.o
335 OBJS += passes/cmds/stat.o
336 OBJS += passes/cmds/cover.o
337 OBJS += passes/cmds/design.o
338 OBJS += passes/cmds/plugin.o
339
340 include passes/proc/Makefile.inc
341 include passes/opt/Makefile.inc
342 include passes/techmap/Makefile.inc
343
344 include backends/verilog/Makefile.inc
345 include backends/ilang/Makefile.inc
346
347 include techlibs/common/Makefile.inc
348
349 endif
350
351 top-all: $(TARGETS) $(EXTRA_TARGETS)
352 @echo ""
353 @echo " Build successful."
354 @echo ""
355
356 ifeq ($(CONFIG),emcc)
357 yosys.js: $(filter-out yosysjs-$(YOSYS_VER).zip,$(EXTRA_TARGETS))
358 endif
359
360 yosys$(EXE): $(OBJS)
361 $(P) $(LD) -o yosys$(EXE) $(LDFLAGS) $(OBJS) $(LDLIBS)
362
363 libyosys.so: $(filter-out kernel/driver.o,$(OBJS))
364 $(P) $(LD) -o libyosys.so -shared -Wl,-soname,libyosys.so $(LDFLAGS) $^ $(LDLIBS)
365
366 %.o: %.cc
367 $(Q) mkdir -p $(dir $@)
368 $(P) $(CXX) -o $@ -c $(CPPFLAGS) $(CXXFLAGS) $<
369
370 %.o: %.cpp
371 $(Q) mkdir -p $(dir $@)
372 $(P) $(CXX) -o $@ -c $(CPPFLAGS) $(CXXFLAGS) $<
373
374 kernel/version_$(GIT_REV).cc: $(YOSYS_SRC)/Makefile
375 $(P) rm -f kernel/version_*.o kernel/version_*.d kernel/version_*.cc
376 $(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)) ` \
377 $(CXX) --version | tr ' ()' '\n' | grep '^[0-9]' | head -n1` $(filter -f% -m% -O% -DNDEBUG,$(CXXFLAGS)))\"; }" > kernel/version_$(GIT_REV).cc
378
379 yosys-config: misc/yosys-config.in
380 $(P) $(SED) -e 's#@CXXFLAGS@#$(subst -I. -I"$(YOSYS_SRC)",-I"$(DATDIR)/include",$(CXXFLAGS))#;' \
381 -e 's#@CXX@#$(CXX)#;' -e 's#@LDFLAGS@#$(LDFLAGS)#;' -e 's#@LDLIBS@#$(LDLIBS)#;' \
382 -e 's#@BINDIR@#$(BINDIR)#;' -e 's#@DATDIR@#$(DATDIR)#;' < $< > yosys-config
383 $(Q) chmod +x yosys-config
384
385 abc/abc-$(ABCREV)$(EXE):
386 $(P)
387 ifneq ($(ABCREV),default)
388 $(Q) if ( cd abc 2> /dev/null && hg identify; ) | grep -q +; then \
389 echo 'REEBE: NOP pbagnvaf ybpny zbqvsvpngvbaf! Frg NOPERI=qrsnhyg va Lbflf Znxrsvyr!' | tr 'A-Za-z' 'N-ZA-Mn-za-m'; false; \
390 fi
391 $(Q) if test "`cd abc 2> /dev/null && hg identify | cut -f1 -d' '`" != "$(ABCREV)"; then \
392 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; }; \
393 echo "Pulling ABC from $(ABCURL):"; set -x; \
394 test -d abc || hg clone $(ABCURL) abc; \
395 cd abc && $(MAKE) DEP= clean && hg pull && hg update -r $(ABCREV); \
396 fi
397 endif
398 $(Q) rm -f abc/abc-[0-9a-f]*
399 $(Q) cd abc && $(MAKE) $(S) $(ABCMKARGS) PROG="abc-$(ABCREV)$(EXE)" MSG_PREFIX="$(eval P_OFFSET = 5)$(call P_SHOW)$(eval P_OFFSET = 10) ABC: "
400
401 ifeq ($(ABCREV),default)
402 .PHONY: abc/abc-$(ABCREV)$(EXE)
403 endif
404
405 yosys-abc$(EXE): abc/abc-$(ABCREV)$(EXE)
406 $(P) cp abc/abc-$(ABCREV)$(EXE) yosys-abc$(EXE)
407
408 ifneq ($(SEED),)
409 SEEDOPT="-S $(SEED)"
410 else
411 SEEDOPT=""
412 endif
413
414 test: $(TARGETS) $(EXTRA_TARGETS)
415 +cd tests/simple && bash run-test.sh $(SEEDOPT)
416 +cd tests/hana && bash run-test.sh $(SEEDOPT)
417 +cd tests/asicworld && bash run-test.sh $(SEEDOPT)
418 +cd tests/realmath && bash run-test.sh $(SEEDOPT)
419 +cd tests/share && bash run-test.sh $(SEEDOPT)
420 +cd tests/fsm && bash run-test.sh $(SEEDOPT)
421 +cd tests/techmap && bash run-test.sh
422 +cd tests/memories && bash run-test.sh $(SEEDOPT)
423 +cd tests/bram && bash run-test.sh $(SEEDOPT)
424 +cd tests/various && bash run-test.sh
425 +cd tests/sat && bash run-test.sh
426 @echo ""
427 @echo " Passed \"make test\"."
428 @echo ""
429
430 VALGRIND ?= valgrind --error-exitcode=1 --leak-check=full --show-reachable=yes --errors-for-leak-kinds=all
431
432 vgtest: $(TARGETS) $(EXTRA_TARGETS)
433 $(VALGRIND) ./yosys -p 'setattr -mod -unset top; synth' $$( ls tests/simple/*.v | grep -v repwhile.v )
434 @echo ""
435 @echo " Passed \"make vgtest\"."
436 @echo ""
437
438 vloghtb: $(TARGETS) $(EXTRA_TARGETS)
439 +cd tests/vloghtb && bash run-test.sh
440 @echo ""
441 @echo " Passed \"make vloghtb\"."
442 @echo ""
443
444 install: $(TARGETS) $(EXTRA_TARGETS)
445 $(INSTALL_SUDO) mkdir -p $(DESTDIR)$(BINDIR)
446 $(INSTALL_SUDO) install $(TARGETS) $(DESTDIR)$(BINDIR)
447 $(INSTALL_SUDO) mkdir -p $(DESTDIR)$(DATDIR)
448 $(INSTALL_SUDO) cp -r share/. $(DESTDIR)$(DATDIR)/.
449 ifeq ($(ENABLE_LIBYOSYS),1)
450 $(INSTALL_SUDO) cp libyosys.so $(DESTDIR)$(LIBDIR)
451 $(INSTALL_SUDO) ldconfig
452 endif
453
454 uninstall:
455 $(INSTALL_SUDO) rm -vf $(addprefix $(DESTDIR)$(BINDIR),$(notdir $(TARGETS)))
456 $(INSTALL_SUDO) rm -rvf $(DESTDIR)$(DATDIR)
457 ifeq ($(ENABLE_LIBYOSYS),1)
458 $(INSTALL_SUDO) rm -vf $(DESTDIR)$(LIBDIR)/libyosys.so
459 endif
460
461 update-manual: $(TARGETS) $(EXTRA_TARGETS)
462 cd manual && ../yosys -p 'help -write-tex-command-reference-manual'
463
464 manual: $(TARGETS) $(EXTRA_TARGETS)
465 cd manual && bash appnotes.sh
466 cd manual && bash presentation.sh
467 cd manual && bash manual.sh
468
469 clean:
470 rm -rf share
471 if test -d manual; then cd manual && sh clean.sh; fi
472 rm -f $(OBJS) $(GENFILES) $(TARGETS) $(EXTRA_TARGETS) $(EXTRA_OBJS)
473 rm -f kernel/version_*.o kernel/version_*.cc abc/abc-[0-9a-f]*
474 rm -f libs/*/*.d frontends/*/*.d passes/*/*.d backends/*/*.d kernel/*.d techlibs/*/*.d
475
476 clean-abc:
477 $(MAKE) -C abc DEP= clean
478 rm -f yosys-abc$(EXE) abc/abc-[0-9a-f]*
479
480 mrproper: clean
481 git clean -xdf
482
483 qtcreator:
484 { for file in $(basename $(OBJS)); do \
485 for prefix in cc y l; do if [ -f $${file}.$${prefix} ]; then echo $$file.$${prefix}; fi; done \
486 done; find backends frontends kernel libs passes -type f \( -name '*.h' -o -name '*.hh' \); } > qtcreator.files
487 { echo .; find backends frontends kernel libs passes -type f \( -name '*.h' -o -name '*.hh' \) -printf '%h\n' | sort -u; } > qtcreator.includes
488 touch qtcreator.config qtcreator.creator
489
490 vcxsrc: $(GENFILES) $(EXTRA_TARGETS)
491 rm -rf yosys-win32-vcxsrc-$(YOSYS_VER){,.zip}
492 set -e; for f in `ls $(filter %.cc %.cpp,$(GENFILES)) $(addsuffix .cc,$(basename $(OBJS))) $(addsuffix .cpp,$(basename $(OBJS))) 2> /dev/null`; do \
493 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
494 bash misc/create_vcxsrc.sh yosys-win32-vcxsrc $(YOSYS_VER) $(GIT_REV)
495 echo "namespace Yosys { extern const char *yosys_version_str; const char *yosys_version_str=\"Yosys (Version Information Unavailable)\"; }" > kernel/version.cc
496 zip yosys-win32-vcxsrc-$(YOSYS_VER)/genfiles.zip $(GENFILES) kernel/version.cc
497 zip -r yosys-win32-vcxsrc-$(YOSYS_VER).zip yosys-win32-vcxsrc-$(YOSYS_VER)/
498 rm -f srcfiles.txt kernel/version.cc
499
500 ifeq ($(CONFIG),mxe)
501 mxebin: $(TARGETS) $(EXTRA_TARGETS)
502 rm -rf yosys-win32-mxebin-$(YOSYS_VER){,.zip}
503 mkdir -p yosys-win32-mxebin-$(YOSYS_VER)
504 cp -r yosys.exe share/ yosys-win32-mxebin-$(YOSYS_VER)/
505 ifeq ($(ENABLE_ABC),1)
506 cp -r yosys-abc.exe abc/lib/x86/pthreadVC2.dll yosys-win32-mxebin-$(YOSYS_VER)/
507 endif
508 echo -en 'This is Yosys $(YOSYS_VER) for Win32.\r\n' > yosys-win32-mxebin-$(YOSYS_VER)/readme.txt
509 echo -en 'Documentation at http://www.clifford.at/yosys/.\r\n' >> yosys-win32-mxebin-$(YOSYS_VER)/readme.txt
510 zip -r yosys-win32-mxebin-$(YOSYS_VER).zip yosys-win32-mxebin-$(YOSYS_VER)/
511 endif
512
513 config-clean: clean
514 rm -f Makefile.conf
515
516 config-clang: clean
517 echo 'CONFIG := clang' > Makefile.conf
518
519 config-gcc: clean
520 echo 'CONFIG := gcc' > Makefile.conf
521
522 config-gcc-4.8: clean
523 echo 'CONFIG := gcc-4.8' > Makefile.conf
524
525 config-emcc: clean
526 echo 'CONFIG := emcc' > Makefile.conf
527 echo 'ENABLE_TCL := 0' >> Makefile.conf
528 echo 'ENABLE_ABC := 0' >> Makefile.conf
529 echo 'ENABLE_PLUGINS := 0' >> Makefile.conf
530 echo 'ENABLE_READLINE := 0' >> Makefile.conf
531
532 config-mxe: clean
533 echo 'CONFIG := mxe' > Makefile.conf
534 echo 'ENABLE_TCL := 0' >> Makefile.conf
535 echo 'ENABLE_PLUGINS := 0' >> Makefile.conf
536 echo 'ENABLE_READLINE := 0' >> Makefile.conf
537
538 config-msys2: clean
539 echo 'CONFIG := msys2' > Makefile.conf
540
541 config-gprof: clean
542 echo 'CONFIG := gcc' > Makefile.conf
543 echo 'ENABLE_GPROF := 1' >> Makefile.conf
544
545 config-sudo:
546 echo "INSTALL_SUDO := sudo" >> Makefile.conf
547
548 echo-yosys-ver:
549 @echo "$(YOSYS_VER)"
550
551 echo-git-rev:
552 @echo "$(GIT_REV)"
553
554 -include libs/*/*.d
555 -include frontends/*/*.d
556 -include passes/*/*.d
557 -include backends/*/*.d
558 -include kernel/*.d
559 -include techlibs/*/*.d
560
561 .PHONY: all top-all abc test install install-abc manual clean mrproper qtcreator
562 .PHONY: config-clean config-clang config-gcc config-gcc-4.8 config-gprof config-sudo
563