311 lines
11 KiB
Makefile
311 lines
11 KiB
Makefile
#
|
|
# This source code is free software; you can redistribute it
|
|
# and/or modify it in source code form under the terms of the GNU
|
|
# Library General Public License as published by the Free Software
|
|
# Foundation; either version 2 of the License, or (at your option)
|
|
# any later version.
|
|
#
|
|
# This program is distributed in the hope that it will be useful,
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
# GNU Library General Public License for more details.
|
|
#
|
|
# You should have received a copy of the GNU Library General Public
|
|
# License along with this program; if not, write to the Free
|
|
# Software Foundation, Inc.,
|
|
# 59 Temple Place - Suite 330
|
|
# Boston, MA 02111-1307, USA
|
|
|
|
SHELL = /bin/sh
|
|
|
|
# This string is used as an installation suffix. It modifies certain
|
|
# key install paths/files such that a build and install of Icarus Verilog
|
|
# with the same $(prefix) but a different $(suffix) will not interfere.
|
|
# The normal configuration leaves suffix empty
|
|
suffix = @install_suffix@
|
|
|
|
prefix = @prefix@
|
|
exec_prefix = @exec_prefix@
|
|
srcdir = @srcdir@
|
|
datarootdir = @datarootdir@
|
|
|
|
SUBDIRS = @subdirs@
|
|
|
|
VPATH = $(srcdir)
|
|
|
|
bindir = @bindir@
|
|
libdir = @libdir@
|
|
# This is actually the directory where we install our own header files.
|
|
# It is a little different from the generic includedir.
|
|
includedir = @includedir@/iverilog$(suffix)
|
|
mandir = @mandir@
|
|
|
|
libdir64 = @libdir64@
|
|
|
|
dllib=@DLLIB@
|
|
strip_dynamic=@strip_dynamic@
|
|
|
|
CC = @CC@
|
|
CXX = @CXX@
|
|
INSTALL = @INSTALL@
|
|
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
|
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
|
INSTALL_DATA = @INSTALL_DATA@
|
|
STRIP = @STRIP@
|
|
LEX = @LEX@
|
|
YACC = @YACC@
|
|
MAN = @MAN@
|
|
PS2PDF = @PS2PDF@
|
|
|
|
CPPFLAGS = @DEFS@ -I. -I$(srcdir) @CPPFLAGS@
|
|
CXXFLAGS = @WARNING_CXXFLAGS@ @CXXFLAGS@
|
|
PICFLAGS = @PICFLAG@
|
|
LDFLAGS = @rdynamic@ @LDFLAGS@
|
|
|
|
# The TARGETS variable lists the target modules that can be build and
|
|
# installed. Some of them depend on external things, so are only
|
|
# compiled if the prerequisites are installed.
|
|
TARGETS = tgt-null
|
|
|
|
all: dep ivl@EXEEXT@
|
|
for dir in $(SUBDIRS); do (cd $$dir ; $(MAKE) $@); done
|
|
for tgt in $(TARGETS); do (cd $$tgt ; $(MAKE) $@); done
|
|
for dir in ivlpp tgt-verilog tgt-stub; \
|
|
do (cd $$dir ; $(MAKE) $@); done
|
|
cd driver ; $(MAKE) $@
|
|
|
|
# In the windows world, the installer will need a dosify program to
|
|
# dosify text files.
|
|
ifeq (@WIN32@,yes)
|
|
all: dep dosify.exe
|
|
dosify.exe: $(srcdir)/dosify.c
|
|
$(CC) -o dosify.exe $(srcdir)/dosify.c
|
|
endif
|
|
|
|
# This rule rules the compiler in the trivial hello.vl program to make
|
|
# sure the basics were compiled properly.
|
|
check: all
|
|
for dir in $(SUBDIRS); do (cd $$dir ; $(MAKE) check); done
|
|
test -r check.conf || cp $(srcdir)/check.conf .
|
|
driver/iverilog -B. -BPivlpp -tcheck -ocheck.vvp $(srcdir)/examples/hello.vl
|
|
ifeq (@WIN32@,yes)
|
|
ifeq (@install_suffix@,)
|
|
vvp/vvp -M- -M./vpi ./check.vvp | grep 'Hello, World'
|
|
else
|
|
# On Windows if we have a suffix we must run the vvp part of
|
|
# the test with a suffix since it was built/linked that way.
|
|
ln vvp/vvp.exe vvp/vvp$(suffix).exe
|
|
vvp/vvp$(suffix) -M- -M./vpi ./check.vvp | grep 'Hello, World'
|
|
rm vvp/vvp$(suffix).exe
|
|
endif
|
|
else
|
|
vvp/vvp -M- -M./vpi ./check.vvp | grep 'Hello, World'
|
|
endif
|
|
|
|
clean:
|
|
for dir in $(SUBDIRS); do (cd $$dir ; $(MAKE) $@); done
|
|
for tgt in $(TARGETS); do (cd $$tgt ; $(MAKE) $@); done
|
|
for dir in vpi ivlpp tgt-verilog tgt-stub driver; \
|
|
do (cd $$dir ; $(MAKE) $@); done
|
|
rm -f *.o parse.cc parse.h lexor.cc
|
|
rm -f ivl.exp iverilog-vpi.pdf iverilog-vpi.ps parse.output
|
|
rm -f syn-rules.output dosify.exe ivl@EXEEXT@ check.vvp
|
|
rm -f lexor_keyword.cc libivl.a libvpi.a iverilog-vpi syn-rules.cc
|
|
rm -rf dep
|
|
|
|
distclean: clean
|
|
for dir in $(SUBDIRS); do (cd $$dir ; $(MAKE) $@); done
|
|
for tgt in $(TARGETS); do (cd $$tgt ; $(MAKE) $@); done
|
|
for dir in vpi ivlpp tgt-verilog tgt-stub driver; \
|
|
do (cd $$dir ; $(MAKE) $@); done
|
|
rm -f Makefile config.status config.log config.cache
|
|
rm -f config.h
|
|
rm -f _pli_types.h
|
|
ifneq (@srcdir@,.)
|
|
rm -f check.conf
|
|
rmdir $(SUBDIRS)
|
|
endif
|
|
rm -rf autom4te.cache
|
|
|
|
TT = t-dll.o t-dll-api.o t-dll-expr.o t-dll-proc.o t-xnf.o
|
|
FF = cprop.o nodangle.o synth.o synth2.o syn-rules.o xnfio.o
|
|
|
|
O = main.o async.o design_dump.o dup_expr.o elaborate.o elab_expr.o \
|
|
elab_lval.o elab_net.o elab_anet.o elab_pexpr.o elab_scope.o \
|
|
elab_sig.o emit.o eval.o eval_attrib.o \
|
|
eval_tree.o expr_synth.o functor.o lexor.o lexor_keyword.o link_const.o \
|
|
load_module.o netlist.o netmisc.o net_assign.o \
|
|
net_design.o net_event.o net_expr.o net_force.o net_func.o \
|
|
net_link.o net_modulo.o net_nex_input.o net_nex_output.o \
|
|
net_proc.o net_scope.o net_udp.o net_variable.o pad_to_width.o \
|
|
parse.o parse_misc.o pform.o pform_dump.o \
|
|
set_width.o symbol_search.o sync.o sys_funcs.o \
|
|
verinum.o verireal.o target.o targets.o \
|
|
Attrib.o HName.o LineInfo.o Module.o PData.o PDelays.o PEvent.o \
|
|
PExpr.o PGate.o \
|
|
PTask.o PUdp.o PFunction.o PWire.o Statement.o StringHeap.o \
|
|
$(FF) $(TT)
|
|
|
|
Makefile: Makefile.in config.h.in config.status
|
|
./config.status
|
|
|
|
|
|
ifeq (@WIN32@,yes)
|
|
# Under Windows (mingw) I need to make the ivl.exe in two steps.
|
|
# The first step makes an ivl.exe that dlltool can use to make an
|
|
# export and import library, and the last link makes a, ivl.exe
|
|
# that really exports the things that the import library imports.
|
|
ivl@EXEEXT@: $O $(srcdir)/ivl.def
|
|
$(CXX) -o ivl@EXEEXT@ $O $(dllib) @EXTRALIBS@
|
|
dlltool --dllname ivl@EXEEXT@ --def $(srcdir)/ivl.def \
|
|
--output-lib libivl.a --output-exp ivl.exp
|
|
$(CXX) $(LDFLAGS) -o ivl@EXEEXT@ ivl.exp $O $(dllib) @EXTRALIBS@
|
|
else
|
|
ivl@EXEEXT@: $O
|
|
$(CXX) $(LDFLAGS) -o ivl@EXEEXT@ $O $(dllib)
|
|
|
|
endif
|
|
|
|
ifeq (@MINGW32@,yes)
|
|
SUBDIRS += driver-vpi
|
|
else
|
|
all: dep iverilog-vpi
|
|
|
|
iverilog-vpi: iverilog-vpi.sh
|
|
sed -e 's;@SHARED@;@shared@;' -e 's;@PIC@;@PICFLAG@;' \
|
|
-e 's;@SUFFIX@;$(suffix);' \
|
|
-e 's;@IVCC@;$(CC);' \
|
|
-e 's;@IVCXX@;$(CXX);' \
|
|
-e 's;@IVCFLAGS@;$(CXXFLAGS);' \
|
|
-e 's;@LIBDIR64@;@libdir64@;' \
|
|
-e 's;@VPIDIR1@;@vpidir1@;' -e 's;@VPIDIR2@;@vpidir2@;' \
|
|
-e 's;@INCLUDEDIR@;$(includedir);' \
|
|
-e 's;@LIBDIR@;@libdir@;' $< > $@
|
|
chmod +x $@
|
|
endif
|
|
|
|
dep:
|
|
mkdir dep
|
|
|
|
%.o: %.cc
|
|
$(CXX) $(CPPFLAGS) $(CXXFLAGS) @DEPENDENCY_CPPFLAGS@ -c $< -o $*.o $(DEBUGFLAGS)
|
|
mv $*.d dep/$*.d
|
|
|
|
|
|
lexor.o: lexor.cc parse.h
|
|
|
|
parse.o: parse.cc
|
|
|
|
parse.cc parse.h: $(srcdir)/parse.y
|
|
$(YACC) --verbose -t -p VL -d -o parse.cc $(srcdir)/parse.y
|
|
mv parse.cc.h parse.h 2>/dev/null || mv parse.hh parse.h
|
|
|
|
syn-rules.cc: $(srcdir)/syn-rules.y
|
|
$(YACC) --verbose -p syn_ -o syn-rules.cc $(srcdir)/syn-rules.y
|
|
|
|
lexor.cc: $(srcdir)/lexor.lex
|
|
$(LEX) -PVL -s -olexor.cc $(srcdir)/lexor.lex
|
|
|
|
lexor_keyword.o: lexor_keyword.cc parse.h
|
|
|
|
lexor_keyword.cc: lexor_keyword.gperf
|
|
gperf -o -i 7 -C -k 1-3,$$ -L ANSI-C -H keyword_hash -N check_identifier -t $(srcdir)/lexor_keyword.gperf > lexor_keyword.cc || (rm -f lexor_keyword.cc ; false)
|
|
|
|
iverilog-vpi.ps: $(srcdir)/iverilog-vpi.man
|
|
$(MAN) -t $(srcdir)/iverilog-vpi.man > iverilog-vpi.ps
|
|
|
|
iverilog-vpi.pdf: iverilog-vpi.ps
|
|
$(PS2PDF) iverilog-vpi.ps iverilog-vpi.pdf
|
|
|
|
# Build and install the iverilog-vpi.pdf only if there is a man
|
|
# program *and* a ps2pdf program.
|
|
ifeq (@WIN32@,yes)
|
|
ifeq ($(MAN),none)
|
|
INSTALL_DOC = $(mandir)/man1/iverilog-vpi$(suffix).1
|
|
else
|
|
ifeq ($(PS2PDF),none)
|
|
INSTALL_DOC = $(mandir)/man1/iverilog-vpi$(suffix).1
|
|
else
|
|
INSTALL_DOC = $(prefix)/iverilog-vpi$(suffix).pdf $(mandir)/man1/iverilog-vpi$(suffix).1
|
|
all: dep iverilog-vpi.pdf
|
|
endif
|
|
endif
|
|
INSTALL_DOCDIR = $(mandir)/man1
|
|
else
|
|
INSTALL_DOC = $(mandir)/man1/iverilog-vpi$(suffix).1
|
|
INSTALL_DOCDIR = $(mandir)/man1
|
|
endif
|
|
|
|
ifeq (@MINGW32@,yes)
|
|
WIN32_INSTALL =
|
|
else
|
|
WIN32_INSTALL = $(bindir)/iverilog-vpi$(suffix)
|
|
endif
|
|
|
|
XNF_INSTALL = $(libdir)/ivl$(suffix)/xnf.conf $(libdir)/ivl$(suffix)/xnf-s.conf
|
|
|
|
install: all installdirs $(libdir)/ivl$(suffix)/ivl@EXEEXT@ $(includedir)/ivl_target.h $(includedir)/_pli_types.h $(includedir)/vpi_user.h $(includedir)/acc_user.h $(includedir)/veriuser.h $(WIN32_INSTALL) $(INSTALL_DOC) $(XNF_INSTALL)
|
|
for dir in $(SUBDIRS); do (cd $$dir ; $(MAKE) $@); done
|
|
for tgt in $(TARGETS); do (cd $$tgt ; $(MAKE) $@); done
|
|
for dir in vpi ivlpp driver; \
|
|
do (cd $$dir ; $(MAKE) $@); done
|
|
|
|
$(DESTDIR)$(bindir)/iverilog-vpi$(suffix): ./iverilog-vpi
|
|
$(INSTALL_SCRIPT) ./iverilog-vpi $(DESTDIR)$(bindir)/iverilog-vpi$(suffix)
|
|
|
|
$(libdir)/ivl$(suffix)/ivl@EXEEXT@: ./ivl@EXEEXT@
|
|
$(INSTALL_PROGRAM) ./ivl@EXEEXT@ $(DESTDIR)$(libdir)/ivl$(suffix)/ivl@EXEEXT@
|
|
|
|
$(DESTDIR)$(libdir)/ivl$(suffix)/xnf-s.conf: $(srcdir)/xnf-s.conf
|
|
$(INSTALL_DATA) $(srcdir)/xnf-s.conf $(DESTDIR)$(libdir)/ivl$(suffix)/xnf-s.conf
|
|
|
|
$(DESTDIR)$(libdir)/ivl$(suffix)/xnf.conf: $(srcdir)/xnf.conf
|
|
$(INSTALL_DATA) $(srcdir)/xnf.conf $(DESTDIR)$(libdir)/ivl$(suffix)/xnf.conf
|
|
|
|
$(DESTDIR)$(includedir)/ivl_target.h: $(srcdir)/ivl_target.h
|
|
$(INSTALL_DATA) $(srcdir)/ivl_target.h $(DESTDIR)$(includedir)/ivl_target.h
|
|
|
|
$(DESTDIR)$(includedir)/_pli_types.h: _pli_types.h
|
|
$(INSTALL_DATA) $< $(DESTDIR)$(includedir)/_pli_types.h
|
|
|
|
$(DESTDIR)$(includedir)/vpi_user.h: $(srcdir)/vpi_user.h
|
|
$(INSTALL_DATA) $(srcdir)/vpi_user.h $(DESTDIR)$(includedir)/vpi_user.h
|
|
|
|
$(DESTDIR)$(includedir)/acc_user.h: $(srcdir)/acc_user.h
|
|
$(INSTALL_DATA) $(srcdir)/acc_user.h $(DESTDIR)$(includedir)/acc_user.h
|
|
|
|
$(DESTDIR)$(includedir)/veriuser.h: $(srcdir)/veriuser.h
|
|
$(INSTALL_DATA) $(srcdir)/veriuser.h $(DESTDIR)$(includedir)/veriuser.h
|
|
|
|
$(DESTDIR)$(mandir)/man1/iverilog-vpi$(suffix).1: $(srcdir)/iverilog-vpi.man
|
|
$(INSTALL_DATA) $(srcdir)/iverilog-vpi.man $(DESTDIR)$(mandir)/man1/iverilog-vpi$(suffix).1
|
|
|
|
$(DESTDIR)$(prefix)/iverilog-vpi$(suffix).pdf: iverilog-vpi.pdf
|
|
$(INSTALL_DATA) iverilog-vpi.pdf $(DESTDIR)$(prefix)/iverilog-vpi$(suffix).pdf
|
|
|
|
|
|
installdirs: mkinstalldirs
|
|
$(srcdir)/mkinstalldirs $(DESTDIR)$(bindir) $(DESTDIR)$(includedir) $(DESTDIR)$(libdir)/ivl$(suffix) \
|
|
$(DESTDIR)$(libdir)/ivl$(suffix)/include $(DESTDIR)$(mandir) $(DESTDIR)$(mandir)/man1
|
|
|
|
uninstall:
|
|
for dir in $(SUBDIRS); do (cd $$dir ; $(MAKE) $@); done
|
|
for tgt in $(TARGETS); do (cd $$tgt ; $(MAKE) $@); done
|
|
for dir in vpi ivlpp driver; \
|
|
do (cd $$dir ; $(MAKE) $@); done
|
|
for f in xnf.conf xnf-s.conf ivl@EXEEXT@; \
|
|
do rm -f $(DESTDIR)$(libdir)/ivl$(suffix)/$$f; done
|
|
-rmdir $(DESTDIR)$(libdir)/ivl$(suffix)/include
|
|
-rmdir $(DESTDIR)$(libdir)/ivl$(suffix)
|
|
for f in verilog$(suffix) iverilog-vpi$(suffix); \
|
|
do rm -f $(DESTDIR)$(bindir)/$$f; done
|
|
for f in ivl_target.h vpi_user.h _pli_types.h acc_user.h veriuser.h; \
|
|
do rm -f $(DESTDIR)$(includedir)/$$f; done
|
|
-test X$(suffix) = X || rmdir $(DESTDIR)$(includedir)
|
|
rm -f $(DESTDIR)$(mandir)/man1/iverilog-vpi$(suffix).1
|
|
rm -f $(DESTDIR)$(prefix)/iverilog-vpi$(suffix).pdf
|
|
|
|
|
|
-include $(patsubst %.o, dep/%.d, $O)
|
|
-include $(patsubst %.o, dep/%.d, vpithunk.o)
|