Merge branch 'master' into verilog-ams
[sverilog.git] / Makefile.in
blob3df9bb21bdd36d12580f154b3330f2dedda59f28
2 # This source code is free software; you can redistribute it
3 # and/or modify it in source code form under the terms of the GNU
4 # Library General Public License as published by the Free Software
5 # Foundation; either version 2 of the License, or (at your option)
6 # any later version.
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # GNU Library General Public License for more details.
13 # You should have received a copy of the GNU Library General Public
14 # License along with this program; if not, write to the Free
15 # Software Foundation, Inc.,
16 # 59 Temple Place - Suite 330
17 # Boston, MA 02111-1307, USA
19 SHELL = /bin/sh
21 # This version string is only used in the version message printed
22 # by the compiler. It reflects the assigned version number for the
23 # product as a whole. Most components also print the CVS Name: token
24 # in order to get a more automatic version stamp as well.
25 VERSION = 0.9.devel
27 prefix = @prefix@
28 exec_prefix = @exec_prefix@
29 srcdir = @srcdir@
30 datarootdir = @datarootdir@
32 SUBDIRS = @subdirs@
34 VPATH = $(srcdir)
36 bindir = @bindir@
37 libdir = @libdir@
38 includedir = @includedir@
39 mandir = @mandir@
41 dllib=@DLLIB@
43 CC = @CC@
44 CXX = @CXX@
45 INSTALL = @INSTALL@
46 INSTALL_SCRIPT = @INSTALL_SCRIPT@
47 INSTALL_PROGRAM = @INSTALL_PROGRAM@
48 INSTALL_DATA = @INSTALL_DATA@
49 LEX = @LEX@
50 YACC = @YACC@
51 MAN = @MAN@
52 PS2PDF = @PS2PDF@
53 GIT = @GIT@
55 CPPFLAGS = @ident_support@ @DEFS@ -I. -I$(srcdir) @CPPFLAGS@
56 CXXFLAGS = -Wall @CXXFLAGS@
57 PICFLAGS = @PICFLAG@
58 LDFLAGS = @rdynamic@ @LDFLAGS@
60 all: dep version.h ivl@EXEEXT@
61 for dir in $(SUBDIRS); do (cd $$dir ; $(MAKE) $@); done
62 for dir in ivlpp ; \
63 do (cd $$dir ; $(MAKE) $@); done
64 cd driver ; $(MAKE) VERSION=$(VERSION) $@
66 # In the windows world, the installer will need a dosify program to
67 # dosify text files.
68 ifeq (@MINGW32@,yes)
69 all: dep dosify.exe
70 dosify.exe: dosify.c
71 $(CC) -o dosify.exe dosify.c
72 endif
74 # This rule rules the compiler in the trivial hello.vl program to make
75 # sure the basics were compiled properly.
76 check: all
77 for dir in $(SUBDIRS); do (cd $$dir ; $(MAKE) check); done
78 test -r check.conf || cp $(srcdir)/check.conf .
79 driver/iverilog -B. -BPivlpp -tcheck -ocheck.vvp $(srcdir)/examples/hello.vl
80 vvp/vvp -M- -M./vpi ./check.vvp | grep 'Hello, World'
82 clean:
83 for dir in $(SUBDIRS); do (cd $$dir ; $(MAKE) $@); done
84 for dir in vpi ivlpp tgt-verilog tgt-pal driver driver-vpi; \
85 do (cd $$dir ; $(MAKE) $@); done
86 rm -f *.o parse.cc parse.cc.output parse.h lexor.cc
87 rm -f ivl.exp iverilog-vpi.pdf iverilog-vpi.ps parse.output
88 rm -f syn-rules.output dosify.exe ivl@EXEEXT@ check.vvp
89 rm -f lexor_keyword.cc libivl.a libvpi.a iverilog-vpi syn-rules.cc*
90 rm -rf dep
92 distclean: clean
93 for dir in $(SUBDIRS); do (cd $$dir ; $(MAKE) $@); done
94 for dir in vpi ivlpp tgt-verilog tgt-pal driver driver-vpi; \
95 do (cd $$dir ; $(MAKE) $@); done
96 rm -f Makefile config.status config.log config.cache config.h
97 rm -f _pli_types.h
99 TT = t-dll.o t-dll-api.o t-dll-expr.o t-dll-proc.o
100 FF = cprop.o nodangle.o synth.o synth2.o syn-rules.o
102 O = main.o async.o design_dump.o discipline.o dup_expr.o elaborate.o elab_expr.o \
103 elab_lval.o elab_net.o elab_pexpr.o elab_scope.o \
104 elab_sig.o emit.o eval.o eval_attrib.o \
105 eval_tree.o expr_synth.o functor.o lexor.o lexor_keyword.o link_const.o \
106 load_module.o netlist.o netmisc.o net_assign.o \
107 net_design.o net_event.o net_expr.o net_force.o net_func.o \
108 net_link.o net_modulo.o net_nex_input.o net_nex_output.o \
109 net_proc.o net_scope.o net_tran.o net_udp.o pad_to_width.o \
110 parse.o parse_misc.o pform.o pform_disciplines.o pform_dump.o pform_types.o \
111 set_width.o symbol_search.o sync.o sys_funcs.o \
112 verinum.o verireal.o target.o targets.o \
113 Attrib.o HName.o LineInfo.o Module.o PDelays.o PEvent.o \
114 PExpr.o PGate.o PGenerate.o PScope.o PSpec.o \
115 PTask.o PUdp.o PFunction.o PWire.o Statement.o StringHeap.o \
116 $(FF) $(TT)
118 Makefile: Makefile.in config.h.in config.status
119 ./config.status
122 ifeq (@WIN32@,yes)
123 # Under Windows (mingw) I need to make the ivl.exe in two steps.
124 # The first step makes an ivl.exe that dlltool can use to make an
125 # export and import library, and the last link makes a, ivl.exe
126 # that really exports the things that the import library imports.
127 ivl@EXEEXT@: $O $(srcdir)/ivl.def
128 $(CXX) -o ivl@EXEEXT@ $O $(dllib) @EXTRALIBS@
129 dlltool --dllname ivl@EXEEXT@ --def $(srcdir)/ivl.def \
130 --output-lib libivl.a --output-exp ivl.exp
131 $(CXX) $(LDFLAGS) -o ivl@EXEEXT@ ivl.exp $O $(dllib) @EXTRALIBS@
132 else
133 ivl@EXEEXT@: $O
134 $(CXX) $(LDFLAGS) -o ivl@EXEEXT@ $O $(dllib)
135 endif
137 ifeq (@MINGW32@,yes)
138 SUBDIRS += driver-vpi
139 else
140 all: dep iverilog-vpi
142 iverilog-vpi: iverilog-vpi.sh
143 sed -e 's;@SHARED@;@shared@;' -e 's;@PIC@;@PICFLAG@;' \
144 -e 's;@IVCC@;$(CC);' \
145 -e 's;@IVCXX@;$(CXX);' \
146 -e 's;@IVCFLAGS@;$(CXXFLAGS);' \
147 -e 's;@INCLUDEDIR@;@includedir@;' \
148 -e 's;@LIBDIR@;@libdir@;' $< > $@
149 chmod +x $@
150 endif
152 dep:
153 mkdir dep
155 %.o: %.cc
156 $(CXX) $(CPPFLAGS) $(CXXFLAGS) -MD -c $< -o $*.o
157 mv $*.d dep/$*.d
160 lexor.o: lexor.cc parse.h
162 parse.o: parse.cc
164 parse.cc parse.h: $(srcdir)/parse.y
165 $(YACC) --verbose -t -p VL -d -o parse.cc $(srcdir)/parse.y
166 mv parse.cc.h parse.h 2>/dev/null || mv parse.hh parse.h
168 syn-rules.cc: $(srcdir)/syn-rules.y
169 $(YACC) --verbose -p syn_ -o syn-rules.cc $(srcdir)/syn-rules.y
171 lexor.cc: $(srcdir)/lexor.lex
172 $(LEX) -PVL -s -olexor.cc $(srcdir)/lexor.lex
174 lexor_keyword.o: lexor_keyword.cc parse.h
176 lexor_keyword.cc: lexor_keyword.gperf
177 gperf -o -i 7 -C -k 1-4,$$ -L ANSI-C -H keyword_hash -N check_identifier -t $(srcdir)/lexor_keyword.gperf > lexor_keyword.cc || (rm -f lexor_keyword.cc ; false)
179 iverilog-vpi.ps: $(srcdir)/iverilog-vpi.man
180 $(MAN) -t $(srcdir)/iverilog-vpi.man > iverilog-vpi.ps
182 iverilog-vpi.pdf: iverilog-vpi.ps
183 $(PS2PDF) iverilog-vpi.ps iverilog-vpi.pdf
185 # For VERSION_TAG in driver/main.c, first try git-describe, then look for a
186 # version.h file in the source tree (included in snapshots and releases), and
187 # finally use nothing.
188 .PHONY: version.h
189 version.h:
190 ifeq ($(GIT),none)
191 @echo '#define VERSION_TAG ""' > $@;
192 else
193 @if test -d $(srcdir)/.git; then \
194 echo "Using git-describe for VERSION_TAG"; \
195 tmp=`$(GIT) --git-dir $(srcdir)/.git describe \
196 | sed -e 's;\(.*\);#define VERSION_TAG "\1";'`; \
197 echo "$$tmp" | diff - $@ > /dev/null 2>&1 || echo "$$tmp" > $@ || exit 1; \
198 elif test -r $(srcdir)/$@; then \
199 echo "Using $(srcdir)/$@ for VERSION_TAG"; \
200 diff $(srcdir)/$@ $@ > /dev/null 2>&1 || cp $(srcdir)/$@ $@; \
201 else \
202 echo "Using empty VERSION_TAG"; \
203 echo '#define VERSION_TAG ""' > $@; \
205 endif
207 ifeq (@MINGW32@,yes)
208 ifeq ($(MAN),none)
209 INSTALL_DOC = $(mandir)/man1/iverilog-vpi.1
210 else
211 ifeq ($(PS2PDF),none)
212 INSTALL_DOC = $(mandir)/man1/iverilog-vpi.1
213 else
214 INSTALL_DOC = $(prefix)/iverilog-vpi.pdf $(mandir)/man1/iverilog-vpi.1
215 all: dep iverilog-vpi.pdf
216 endif
217 endif
218 INSTALL_DOCDIR = $(mandir)/man1
219 else
220 INSTALL_DOC = $(mandir)/man1/iverilog-vpi.1
221 INSTALL_DOCDIR = $(mandir)/man1
222 endif
224 ifeq (@MINGW32@,yes)
225 WIN32_INSTALL = $(prefix)/hello.vl $(prefix)/sqrt.vl $(prefix)/sqrt-virtex.v $(prefix)/QUICK_START.txt
226 else
227 WIN32_INSTALL = $(bindir)/iverilog-vpi
228 endif
230 XNF_INSTALL = $(libdir)/ivl/xnf.conf $(libdir)/ivl/xnf-s.conf
232 install: all installdirs $(libdir)/ivl/ivl@EXEEXT@ $(libdir)/ivl/include/constants.vams $(libdir)/ivl/include/disciplines.vams $(includedir)/ivl_target.h $(includedir)/_pli_types.h $(includedir)/vpi_user.h $(includedir)/acc_user.h $(includedir)/veriuser.h $(WIN32_INSTALL) $(INSTALL_DOC)
233 for dir in $(SUBDIRS); do (cd $$dir ; $(MAKE) $@); done
234 for dir in vpi ivlpp driver; \
235 do (cd $$dir ; $(MAKE) $@); done
237 $(bindir)/iverilog-vpi: ./iverilog-vpi
238 $(INSTALL_SCRIPT) ./iverilog-vpi $(DESTDIR)$(bindir)/iverilog-vpi
240 $(libdir)/ivl/ivl@EXEEXT@: ./ivl@EXEEXT@
241 $(INSTALL_PROGRAM) ./ivl@EXEEXT@ $(DESTDIR)$(libdir)/ivl/ivl@EXEEXT@
243 $(libdir)/ivl/include/constants.vams: $(srcdir)/constants.vams
244 $(INSTALL_DATA) $(srcdir)/constants.vams $@
246 $(libdir)/ivl/include/disciplines.vams: $(srcdir)/disciplines.vams
247 $(INSTALL_DATA) $(srcdir)/disciplines.vams $@
249 $(libdir)/ivl/xnf-s.conf: $(srcdir)/xnf-s.conf
250 $(INSTALL_DATA) $(srcdir)/xnf-s.conf $(DESTDIR)$(libdir)/ivl/xnf-s.conf
252 $(libdir)/ivl/xnf.conf: $(srcdir)/xnf.conf
253 $(INSTALL_DATA) $(srcdir)/xnf.conf $(DESTDIR)$(libdir)/ivl/xnf.conf
255 $(includedir)/ivl_target.h: $(srcdir)/ivl_target.h
256 $(INSTALL_DATA) $(srcdir)/ivl_target.h $(DESTDIR)$(includedir)/ivl_target.h
258 $(includedir)/_pli_types.h: _pli_types.h
259 $(INSTALL_DATA) $< $(DESTDIR)$(includedir)/_pli_types.h
261 $(includedir)/vpi_user.h: $(srcdir)/vpi_user.h
262 $(INSTALL_DATA) $(srcdir)/vpi_user.h $(DESTDIR)$(includedir)/vpi_user.h
264 $(includedir)/acc_user.h: $(srcdir)/acc_user.h
265 $(INSTALL_DATA) $(srcdir)/acc_user.h $(DESTDIR)$(includedir)/acc_user.h
267 $(includedir)/veriuser.h: $(srcdir)/veriuser.h
268 $(INSTALL_DATA) $(srcdir)/veriuser.h $(DESTDIR)$(includedir)/veriuser.h
270 $(mandir)/man1/iverilog-vpi.1: $(srcdir)/iverilog-vpi.man
271 $(INSTALL_DATA) $(srcdir)/iverilog-vpi.man $(DESTDIR)$(mandir)/man1/iverilog-vpi.1
273 $(prefix)/iverilog-vpi.pdf: iverilog-vpi.pdf
274 $(INSTALL_DATA) iverilog-vpi.pdf $(DESTDIR)$(prefix)/iverilog-vpi.pdf
276 # In windows installations, put a few examples and the quick_start
277 # into the destination directory.
278 ifeq (@MINGW32@,yes)
279 $(prefix)/hello.vl: $(srcdir)/examples/hello.vl
280 ./dosify.exe $(srcdir)/examples/hello.vl tmp.vl
281 mv tmp.vl $(prefix)/hello.vl
283 $(prefix)/sqrt.vl: $(srcdir)/examples/sqrt.vl
284 ./dosify.exe $(srcdir)/examples/sqrt.vl tmp.vl
285 mv tmp.vl $(prefix)/sqrt.vl
287 $(prefix)/sqrt-virtex.v: $(srcdir)/examples/sqrt-virtex.v
288 ./dosify.exe $(srcdir)/examples/sqrt-virtex.v tmp.vl
289 mv tmp.vl $(prefix)/sqrt-virtex.v
291 $(prefix)/QUICK_START.txt: $(srcdir)/QUICK_START.txt
292 ./dosify.exe $(srcdir)/QUICK_START.txt tmp.txt
293 mv tmp.txt $(prefix)/QUICK_START.txt
294 endif
296 installdirs: mkinstalldirs
297 $(srcdir)/mkinstalldirs $(DESTDIR)$(bindir) $(DESTDIR)$(includedir) $(DESTDIR)$(libdir)/ivl \
298 $(DESTDIR)$(libdir)/ivl/include $(DESTDIR)$(mandir) $(DESTDIR)$(mandir)/man1
300 uninstall:
301 for dir in $(SUBDIRS); do (cd $$dir ; $(MAKE) $@); done
302 for dir in vpi ivlpp driver; \
303 do (cd $$dir ; $(MAKE) $@); done
304 for f in xnf.conf xnf-s.conf ivl@EXEEXT@ include/constants.vams include/disciplines.vams; \
305 do rm -f $(DESTDIR)$(libdir)/ivl/$$f; done
306 -rmdir $(DESTDIR)$(libdir)/ivl/include
307 -rmdir $(DESTDIR)$(libdir)/ivl
308 for f in verilog iverilog-vpi gverilog@EXEEXT@; \
309 do rm -f $(DESTDIR)$(bindir)/$$f; done
310 for f in ivl_target.h vpi_user.h _pli_types.h acc_user.h veriuser.h; \
311 do rm -f $(DESTDIR)$(includedir)/$$f; done
312 rm -f $(DESTDIR)$(mandir)/man1/iverilog-vpi.1 $(DESTDIR)$(prefix)/iverilog-vpi.pdf
315 -include $(patsubst %.o, dep/%.d, $O)
316 -include $(patsubst %.o, dep/%.d, vpithunk.o)