mirror of
https://github.com/steveicarus/iverilog.git
synced 2026-08-30 01:28:30 +02:00
Bison reports shift/reduce and reduce/reduce parser conflicts as warnings by default. This allows parser changes to introduce new conflicts while the normal build still succeeds. Pass the conflict warning classes as errors to Bison when generating the parsers. This makes the regular build fail if either parser has unresolved conflicts. Signed-off-by: Lars-Peter Clausen <[email protected]>
335 lines
12 KiB
Makefile
335 lines
12 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., 51 Franklin Street, Fifth Floor,
|
|
# Boston, MA 02110-1301, USA.
|
|
#
|
|
SHELL = /bin/sh
|
|
|
|
# The interesting make targets are:
|
|
#
|
|
# make version
|
|
# Force the version_tag.h file to be rebuilt. Otherwise, it will only
|
|
# be built if it is missing.
|
|
#
|
|
# make all
|
|
# make install
|
|
#
|
|
# The "suffix" 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@
|
|
VERSION_MAJOR = @VERSION_MAJOR@
|
|
VERSION_MINOR = @VERSION_MINOR@
|
|
|
|
SUBDIRS = ivlpp vhdlpp vvp vpi tgt-null tgt-stub tgt-vvp \
|
|
tgt-vhdl tgt-vlog95 tgt-pcb tgt-blif tgt-sizer driver \
|
|
ivtest
|
|
# Only run distclean for these directories.
|
|
NOTUSED = tgt-fpga tgt-pal tgt-verilog
|
|
|
|
ifeq (@LIBVERIUSER@,yes)
|
|
SUBDIRS += libveriuser cadpli
|
|
else
|
|
NOTUSED += libveriuser cadpli
|
|
endif
|
|
|
|
SUBDIRS += driver-vpi
|
|
|
|
# To get the version headers to build correctly we only want to look
|
|
# for C++ files in the source directory. All other files will require
|
|
# an explicit $(srcdir). The one exception to this is if we need to
|
|
# rebuild the lexor_keyword.cc file. If we do, then we want to use the
|
|
# local version instead of the one is $(srcdir).
|
|
vpath lexor_keyword.cc .
|
|
vpath %.cc $(srcdir)/libmisc
|
|
vpath %.cc $(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.
|
|
ivl_includedir = @includedir@/iverilog$(suffix)
|
|
|
|
dllib=@DLLIB@
|
|
|
|
# For a cross compile these defines will need to be set accordingly.
|
|
HOSTCC = @CC@
|
|
HOSTCFLAGS = @WARNING_FLAGS@ @WARNING_FLAGS_CC@ @CFLAGS@
|
|
|
|
BUILDCC = @CC_FOR_BUILD@
|
|
BUILDEXT = @BUILD_EXEEXT@
|
|
CC = @CC@
|
|
CXX = @CXX@
|
|
ENV_VVP=@ENV_VVP@
|
|
INSTALL = @INSTALL@
|
|
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
|
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
|
INSTALL_DATA = @INSTALL_DATA@
|
|
LEX = @LEX@
|
|
YACC = @YACC@
|
|
YACC_CONFLICT_FLAGS = -Werror=conflicts-sr -Werror=conflicts-rr
|
|
MAN = @MAN@
|
|
PS2PDF = @PS2PDF@
|
|
GROFF = @GROFF@
|
|
GIT = @GIT@
|
|
|
|
ifeq (@srcdir@,.)
|
|
INCLUDE_PATH = -I. -Ilibmisc
|
|
else
|
|
INCLUDE_PATH = -I. -I$(srcdir) -I$(srcdir)/libmisc
|
|
endif
|
|
|
|
CPPFLAGS = @DEFS@ $(INCLUDE_PATH) @CPPFLAGS@
|
|
CFLAGS = @WARNING_FLAGS@ @WARNING_FLAGS_CC@ @CFLAGS@
|
|
CXXFLAGS = @WARNING_FLAGS@ @WARNING_FLAGS_CXX@ @CXXFLAGS@
|
|
PICFLAGS = @PICFLAG@
|
|
LDFLAGS = @rdynamic@ @LDFLAGS@
|
|
CTARGETFLAGS = @CTARGETFLAGS@
|
|
|
|
# Source files in the libmisc directory
|
|
M = LineInfo.o StringHeap.o
|
|
|
|
TT = t-dll.o t-dll-api.o t-dll-expr.o t-dll-proc.o t-dll-analog.o
|
|
FF = cprop.o exposenodes.o nodangle.o synth.o synth2.o syn-rules.o
|
|
|
|
O = main.o async.o design_dump.o discipline.o dup_expr.o elaborate.o \
|
|
elab_expr.o elaborate_analog.o elab_lval.o elab_net.o \
|
|
elab_scope.o elab_sig.o elab_sig_analog.o elab_type.o \
|
|
emit.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 nettypes.o net_analog.o net_assign.o \
|
|
net_design.o netclass.o netdarray.o \
|
|
netenum.o netparray.o netqueue.o netscalar.o netstruct.o netvector.o \
|
|
net_event.o net_expr.o net_func.o \
|
|
net_func_eval.o net_link.o net_modulo.o \
|
|
net_nex_input.o net_nex_output.o net_proc.o net_scope.o net_tran.o \
|
|
net_udp.o map_named_args.o \
|
|
pad_to_width.o parse.o parse_misc.o pform.o pform_analog.o \
|
|
pform_disciplines.o pform_dump.o pform_package.o pform_pclass.o \
|
|
pform_types.o \
|
|
symbol_search.o sync.o sys_funcs.o verinum.o verireal.o vpi_modules.o target.o \
|
|
Attrib.o HName.o Module.o PClass.o PDelays.o PEvent.o PExpr.o PFunction.o \
|
|
PGate.o PGenerate.o PModport.o PNamedItem.o PPackage.o PScope.o PSpec.o PTimingCheck.o \
|
|
PTask.o PUdp.o PWire.o Statement.o AStatement.o $M $(FF) $(TT)
|
|
|
|
all: dep config.h _pli_types.h version_tag.h version_base.h ivl@EXEEXT@
|
|
$(foreach dir,$(SUBDIRS),$(MAKE) -C $(dir) $@ && ) true
|
|
|
|
# In the windows world, the installer will need a dosify program to
|
|
# dosify text files.
|
|
ifeq (@MINGW32@,yes)
|
|
all: dosify$(BUILDEXT)
|
|
dosify$(BUILDEXT): $(srcdir)/dosify.c
|
|
$(BUILDCC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -o dosify$(BUILDEXT) $(srcdir)/dosify.c
|
|
endif
|
|
|
|
# This rule runs the compiler using the trivial hello.vl program to make sure
|
|
# the base programs are compiled properly.
|
|
check: all
|
|
$(foreach dir,$(SUBDIRS),$(MAKE) -C $(dir) $@ && ) true
|
|
rm -f check.vvp
|
|
test -r check.conf || cp $(srcdir)/check.conf .
|
|
driver/iverilog@EXEEXT@ -B. -BMvpi -BPivlpp -tcheck -ocheck.vvp $(srcdir)/examples/hello.vl && \
|
|
$(ENV_VVP) vvp/vvp$(suffix)@EXEEXT@ -M- -M./vpi ./check.vvp | grep 'Hello, World'
|
|
|
|
check-installed check-installed-vpi check-installed-vvp check-installed-vvp-py:
|
|
$(MAKE) -C ivtest $@
|
|
|
|
clean:
|
|
$(foreach dir,$(SUBDIRS),$(MAKE) -C $(dir) $@ && ) true
|
|
rm -f *.o parse.cc parse.h lexor.cc
|
|
rm -f ivl.exp
|
|
rm -f iverilog_man.ps iverilog_man.pdf iverilog_man_$(VERSION_MAJOR)_$(VERSION_MINOR).pdf
|
|
rm -f parse.output syn-rules.output dosify$(BUILDEXT) ivl@EXEEXT@ check.vvp
|
|
rm -f lexor_keyword.cc libivl.a libvpi.a syn-rules.cc
|
|
rm -rf dep
|
|
|
|
distclean: clean
|
|
$(foreach dir,$(SUBDIRS),$(MAKE) -C $(dir) $@ && ) true
|
|
$(foreach dir,$(NOTUSED),$(MAKE) -C $(dir) $@ && ) true
|
|
rm -f Makefile config.status config.log config.cache
|
|
rm -f stamp-config-h config.h
|
|
rm -f stamp-_pli_types-h _pli_types.h
|
|
rm -f stamp-version_base-h version_base.h
|
|
ifneq (@srcdir@,.)
|
|
rm -f version_tag.h check.conf
|
|
rmdir $(SUBDIRS) $(NOTUSED)
|
|
endif
|
|
rm -rf autom4te.cache
|
|
|
|
cppcheck: $(O:.o=.cc) $(srcdir)/dosify.c
|
|
cppcheck --enable=all --std=c99 --std=c++11 -f \
|
|
--check-level=exhaustive \
|
|
--suppressions-list=$(srcdir)/cppcheck-global.sup \
|
|
--suppressions-list=$(srcdir)/cppcheck.sup \
|
|
-UYYPARSE_PARAM -UYYPRINT -Ushort -Usize_t -Uyyoverflow \
|
|
-UYYTYPE_INT8 -UYYTYPE_INT16 -UYYTYPE_UINT8 -UYYTYPE_UINT16 \
|
|
-UYYSTYPE -U__SIZE_TYPE__ -Umalloc -Ufree \
|
|
--relative-paths=$(srcdir) $(INCLUDE_PATH) $^
|
|
|
|
cppcheck-all:
|
|
$(foreach dir,$(SUBDIRS),$(MAKE) -C $(dir) cppcheck && ) true
|
|
$(foreach dir,$(NOTUSED),$(MAKE) -C $(dir) cppcheck && ) true
|
|
$(MAKE) cppcheck
|
|
|
|
Makefile: $(srcdir)/Makefile.in config.status
|
|
./config.status --file=$@
|
|
|
|
dep:
|
|
mkdir dep
|
|
|
|
stamp-config-h: $(srcdir)/config.h.in config.status
|
|
@rm -f $@
|
|
./config.status config.h
|
|
config.h: stamp-config-h
|
|
|
|
stamp-_pli_types-h: $(srcdir)/_pli_types.h.in config.status
|
|
@rm -f $@
|
|
./config.status _pli_types.h
|
|
_pli_types.h: stamp-_pli_types-h
|
|
|
|
stamp-version_base-h: $(srcdir)/version_base.h.in config.status
|
|
@rm -f $@
|
|
./config.status version_base.h
|
|
version_base.h: stamp-version_base-h
|
|
|
|
$(srcdir)/configure: $(srcdir)/configure.ac $(srcdir)/aclocal.m4
|
|
cd $(srcdir) && autoconf
|
|
|
|
config.status: $(srcdir)/configure
|
|
./config.status --recheck
|
|
./config.status
|
|
|
|
ifeq (@WIN32@,yes)
|
|
# Under Windows we need to create an import library to allow the target code
|
|
# generators to access the items exported by ivl.exe. The .def file controls
|
|
# what is visible in the import library.
|
|
ivl@EXEEXT@: $O $(srcdir)/ivl.def
|
|
$(CXX) $(LDFLAGS) -o ivl@EXEEXT@ -Wl,--out-implib=libivl.a $(srcdir)/ivl.def $O $(dllib) @EXTRALIBS@
|
|
else
|
|
ivl@EXEEXT@: $O
|
|
$(CXX) $(LDFLAGS) -o ivl@EXEEXT@ $O $(dllib)
|
|
endif
|
|
|
|
%.o: %.cc config.h | dep
|
|
$(CXX) $(CPPFLAGS) $(CXXFLAGS) @DEPENDENCY_FLAG@ -c $< -o $*.o
|
|
mv $*.d dep/$*.d
|
|
|
|
# Here are some explicit dependencies needed to get things going.
|
|
main.o: main.cc version_tag.h
|
|
|
|
lexor.o: lexor.cc parse.h
|
|
|
|
parse.o: parse.cc
|
|
|
|
# Use pattern rules to avoid parallel build issues (see pr3462585)
|
|
parse%cc parse%h: $(srcdir)/parse%y
|
|
$(YACC) --verbose $(YACC_CONFLICT_FLAGS) -t -p VL --defines=parse.h -o parse.cc $<
|
|
|
|
syn-rules.cc: $(srcdir)/syn-rules.y
|
|
$(YACC) --verbose $(YACC_CONFLICT_FLAGS) -t -p syn_ -o $@ $<
|
|
|
|
lexor.cc: $(srcdir)/lexor.lex
|
|
$(LEX) -s -t $< > $@
|
|
|
|
lexor_keyword.o: lexor_keyword.cc parse.h
|
|
|
|
lexor_keyword.cc: $(srcdir)/lexor_keyword.gperf
|
|
gperf -o -i 7 -C -k 1-4,6,9,$$ -H keyword_hash -N check_identifier -t $< > $@ || (rm -f $@ ; false)
|
|
|
|
iverilog_man.ps: driver/iverilog.man vvp/vvp.man driver-vpi/iverilog-vpi.man
|
|
$(GROFF) -man -rC1 -rD1 -T ps $^ > $@
|
|
|
|
iverilog_man.pdf: iverilog_man.ps
|
|
$(PS2PDF) $< $@
|
|
cp $@ iverilog_man_$(VERSION_MAJOR)_$(VERSION_MINOR).pdf
|
|
|
|
# For VERSION_TAG in driver/main.c, first try git-describe, then look for a
|
|
# release_tag.h file in the source tree (included in snapshots and releases),
|
|
# and finally use nothing.
|
|
|
|
# "true" and "false" in the next few lines are Unix shell command names
|
|
ifeq ($(GIT),none)
|
|
GIT_PRESENT = false
|
|
else
|
|
GIT_PRESENT = true
|
|
endif
|
|
version_tag.h version:
|
|
@if $(GIT_PRESENT) && test -d $(srcdir)/.git; then \
|
|
echo "Using git-describe for VERSION_TAG"; \
|
|
tmp=`(cd $(srcdir) && $(GIT) describe --always --dirty) \
|
|
| sed -e 's;\(.*\);#define VERSION_TAG "\1";'`; \
|
|
echo "$$tmp" | diff - version_tag.h > /dev/null 2>&1 || echo "$$tmp" > version_tag.h || exit 1; \
|
|
elif test -r $(srcdir)/release_tag.h; then \
|
|
echo "Using $(srcdir)/release_tag.h for VERSION_TAG"; \
|
|
diff $(srcdir)/release_tag.h version_tag.h > /dev/null 2>&1 || cp $(srcdir)/release_tag.h version_tag.h; \
|
|
else \
|
|
echo "Using empty VERSION_TAG"; \
|
|
echo '#define VERSION_TAG ""' > version_tag.h; \
|
|
fi
|
|
|
|
install: all installdirs installfiles
|
|
$(foreach dir,$(SUBDIRS),$(MAKE) -C $(dir) $@ && ) true
|
|
|
|
F = ./ivl@EXEEXT@ \
|
|
$(srcdir)/constants.vams \
|
|
$(srcdir)/disciplines.vams \
|
|
$(srcdir)/ivl_target.h \
|
|
./_pli_types.h \
|
|
$(srcdir)/sv_vpi_user.h \
|
|
$(srcdir)/vpi_user.h \
|
|
$(srcdir)/acc_user.h \
|
|
$(srcdir)/veriuser.h
|
|
|
|
installfiles: $(F) | installdirs
|
|
$(INSTALL_PROGRAM) ./ivl@EXEEXT@ "$(DESTDIR)$(libdir)/ivl$(suffix)/ivl@EXEEXT@"
|
|
$(INSTALL_DATA) $(srcdir)/constants.vams "$(DESTDIR)$(libdir)/ivl$(suffix)/include/constants.vams"
|
|
$(INSTALL_DATA) $(srcdir)/disciplines.vams "$(DESTDIR)$(libdir)/ivl$(suffix)/include/disciplines.vams"
|
|
$(INSTALL_DATA) $(srcdir)/ivl_target.h "$(DESTDIR)$(ivl_includedir)/ivl_target.h"
|
|
$(INSTALL_DATA) ./_pli_types.h "$(DESTDIR)$(ivl_includedir)/_pli_types.h"
|
|
$(INSTALL_DATA) $(srcdir)/sv_vpi_user.h "$(DESTDIR)$(ivl_includedir)/sv_vpi_user.h"
|
|
$(INSTALL_DATA) $(srcdir)/vpi_user.h "$(DESTDIR)$(ivl_includedir)/vpi_user.h"
|
|
$(INSTALL_DATA) $(srcdir)/acc_user.h "$(DESTDIR)$(ivl_includedir)/acc_user.h"
|
|
$(INSTALL_DATA) $(srcdir)/veriuser.h "$(DESTDIR)$(ivl_includedir)/veriuser.h"
|
|
|
|
installdirs: $(srcdir)/mkinstalldirs
|
|
$(srcdir)/mkinstalldirs "$(DESTDIR)$(bindir)" \
|
|
"$(DESTDIR)$(ivl_includedir)" \
|
|
"$(DESTDIR)$(libdir)/ivl$(suffix)" \
|
|
"$(DESTDIR)$(libdir)/ivl$(suffix)/include"
|
|
|
|
uninstall:
|
|
$(foreach dir,$(SUBDIRS),$(MAKE) -C $(dir) $@ && ) true
|
|
for f in ivl@EXEEXT@ include/constants.vams include/disciplines.vams; \
|
|
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) gverilog$(suffix)@EXEEXT@; \
|
|
do rm -f "$(DESTDIR)$(bindir)/$$f"; done
|
|
for f in ivl_target.h vpi_user.h _pli_types.h sv_vpi_user.h acc_user.h veriuser.h; \
|
|
do rm -f "$(DESTDIR)$(ivl_includedir)/$$f"; done
|
|
-test X$(suffix) = X || rmdir "$(DESTDIR)$(ivl_includedir)"
|
|
|
|
|
|
-include $(patsubst %.o, dep/%.d, $O)
|
|
|
|
.PHONY: check-installed check-installed-vpi check-installed-vvp check-installed-vvp-py
|