6 # features (the more the better)
12 # other configuration flags
21 TARGETS
= yosys yosys-config
25 CXXFLAGS
= -Wall
-Wextra
-ggdb
-I
"$(shell pwd)" -MD
-D_YOSYS_
-fPIC
27 LDLIBS
= -lstdc
++ -lreadline
-lm
-ldl
-lrt
31 GIT_REV
:= $(shell git rev-parse
--short HEAD || echo UNKOWN
)
32 OBJS
= kernel
/version_
$(GIT_REV
).o
34 # set 'ABCREV = default' to use abc/ as it is
36 # Note: If you do ABC development, make sure that 'abc' in this directory
37 # is just a symlink to your actual ABC working directory, as 'make mrproper'
38 # will remove the 'abc' directory and you do not want to accidentally
39 # delete your work on ABC..
43 -include Makefile.conf
45 ifeq ($(CONFIG
),clang-debug
)
47 CXXFLAGS
+= -std
=c
++11 -Os
50 ifeq ($(CONFIG
),gcc-debug
)
52 CXXFLAGS
+= -std
=gnu
++0x
-Os
55 ifeq ($(CONFIG
),release
)
57 CXXFLAGS
+= -std
=gnu
++0x
-march
=native
-O3
-DNDEBUG
60 ifeq ($(ENABLE_TCL
),1)
61 CXXFLAGS
+= -I
/usr
/include/tcl8.5
-DYOSYS_ENABLE_TCL
65 ifeq ($(ENABLE_GPROF
),1)
66 CXXFLAGS
+= -pg
-fno-inline
70 ifeq ($(ENABLE_QT4
),1)
71 TARGETS
+= yosys-svgviewer
74 ifeq ($(ENABLE_ABC
),1)
78 OBJS
+= kernel
/driver.o kernel
/register.o kernel
/rtlil.o kernel
/log.o kernel
/calc.o
80 OBJS
+= libs
/bigint
/BigIntegerAlgorithms.o libs
/bigint
/BigInteger.o libs
/bigint
/BigIntegerUtils.o
81 OBJS
+= libs
/bigint
/BigUnsigned.o libs
/bigint
/BigUnsignedInABase.o
83 OBJS
+= libs
/sha1
/sha1.o
84 OBJS
+= libs
/subcircuit
/subcircuit.o
85 OBJS
+= libs
/ezsat
/ezsat.o
87 ifeq ($(ENABLE_MINISAT
),1)
88 CXXFLAGS
+= -DYOSYS_ENABLE_MINISAT
89 OBJS
+= libs
/ezsat
/ezminisat.o
93 include frontends
/*/Makefile.inc
94 include passes
/*/Makefile.inc
95 include backends
/*/Makefile.inc
96 include techlibs
/*/Makefile.inc
98 top-all
: $(TARGETS
) $(EXTRA_TARGETS
)
101 $(CXX
) -o yosys
$(LDFLAGS
) $(OBJS
) $(LDLIBS
)
103 kernel
/version_
$(GIT_REV
).
cc: Makefile
104 rm -f kernel
/version_
*.o kernel
/version_
*.d kernel
/version_
*.
cc
105 echo
"extern const char *yosys_version_str; const char *yosys_version_str=\"Yosys $(YOSYS_VER) (git sha1 $(GIT_REV))\";" > kernel
/version_
$(GIT_REV
).
cc
107 yosys-config
: yosys-config.in
108 sed
-e
's,@CXX@,$(CXX),;' -e
's,@CXXFLAGS@,$(CXXFLAGS),;' -e
's,@LDFLAGS@,$(LDFLAGS),;' -e
's,@LDLIBS@,$(LDLIBS),;' \
109 -e
's,@BINDIR@,$(DESTDIR)/bin,;' -e
's,@DATDIR@,$(DESTDIR)/share/yosys,;' < yosys-config.in
> yosys-config
110 chmod
+x yosys-config
112 yosys-svgviewer
: libs
/svgviewer
/*.h libs
/svgviewer
/*.
cpp
113 cd libs
/svgviewer
&& $(QMAKE
) && make
114 cp libs
/svgviewer
/svgviewer yosys-svgviewer
117 ifneq ($(ABCREV
),default
)
118 if
test "`cd abc && hg identify | cut -f1 -d' '`" != "$(ABCREV)"; then \
119 test $(ABCPULL
) -ne
0 ||
{ echo
; echo
"!!! ABC not up to date and ABCPULL set to 0 in Makefile !!!"; echo
; exit
1; }; \
120 test -d abc || hg clone https
://bitbucket.org
/alanmi
/abc abc
; \
121 cd abc
&& hg pull
&& hg update
-r
$(ABCREV
); \
124 rm -f abc
/abc-
[0-9a-f
]*
125 cd abc
&& $(MAKE
) PROG
="abc-$(ABCREV)" MSG_PREFIX
="YOSYS-ABC: "
127 ifeq ($(ABCREV
),default
)
128 .PHONY
: abc
/abc-
$(ABCREV
)
131 yosys-abc
: abc
/abc-
$(ABCREV
)
132 cp abc
/abc-
$(ABCREV
) yosys-abc
135 cd tests
/simple
&& bash run-test.sh
136 cd tests
/hana
&& bash run-test.sh
137 cd tests
/asicworld
&& bash run-test.sh
138 cd tests
/sat
&& bash run-test.sh
140 install: $(TARGETS
) $(EXTRA_TARGETS
)
141 $(INSTALL_SUDO
) mkdir
-p
$(DESTDIR
)/bin
142 $(INSTALL_SUDO
) install $(TARGETS
) $(DESTDIR
)/bin
/
143 $(INSTALL_SUDO
) mkdir
-p
$(DESTDIR
)/share
/yosys
144 $(INSTALL_SUDO
) cp
-r share
/.
$(DESTDIR
)/share
/yosys
/.
147 cd manual
&& bash manual.sh
151 rm -f
$(OBJS
) $(GENFILES
) $(TARGETS
)
152 rm -f kernel
/version_
*.o kernel
/version_
*.
cc abc
/abc-
[0-9a-f
]*
153 rm -f libs
/*/*.d frontends
/*/*.d passes
/*/*.d backends
/*/*.d kernel
/*.d
154 cd manual
&& rm -f
*.aux
*.bbl
*.blg
*.idx
*.log
*.out
*.pdf
*.toc
*.ok
155 test ! -f libs
/svgviewer
/Makefile || make
-C libs
/svgviewer
distclean
161 { for file in
$(basename $(OBJS
)); do \
162 for
prefix in
cc y l
; do if
[ -f
$${file}.
$${prefix} ]; then echo
$$file.
$${prefix}; fi
; done \
163 done
; find backends frontends kernel libs passes
-type f \
( -name
'*.h' -o
-name
'*.hh' \
); } > qtcreator.files
164 { echo .
; find backends frontends kernel libs passes
-type f \
( -name
'*.h' -o
-name
'*.hh' \
) -printf
'%h\n' |
sort -u
; } > qtcreator.includes
165 touch qtcreator.config qtcreator.creator
170 config-clang-debug
: clean
171 echo
'CONFIG := clang-debug' > Makefile.conf
173 config-gcc-debug
: clean
174 echo
'CONFIG := gcc-debug' > Makefile.conf
176 config-release
: clean
177 echo
'CONFIG := release' > Makefile.conf
180 echo
'CONFIG := gcc-debug' > Makefile.conf
181 echo
'ENABLE_GPROF := 1' >> Makefile.conf
184 echo
"INSTALL_SUDO := sudo" >> Makefile.conf
187 -include frontends
/*/*.d
188 -include passes
/*/*.d
189 -include backends
/*/*.d
192 .PHONY
: all top-all abc
test install install-abc manual
clean mrproper qtcreator
193 .PHONY
: config-clean config-clang-debug config-gcc-debug config-release