2006-08-26 13:35:28 +02:00
#*****************************************************************************
# DESCRIPTION: Verilator top level: Makefile pre-configure version
2008-06-10 03:25:10 +02:00
#
# This file is part of Verilator.
#
2019-11-08 04:33:59 +01:00
# Code available from: https://verilator.org
2008-06-10 03:25:10 +02:00
#
2006-08-26 13:35:28 +02:00
#*****************************************************************************
2008-06-10 03:25:10 +02:00
#
2026-01-27 02:24:34 +01:00
# This program is free software; you can redistribute it and/or modify it
# under the terms of either the GNU Lesser General Public License Version 3
# or the Perl Artistic License Version 2.0.
# SPDX-FileCopyrightText: 2025-2026 Wilson Snyder
2020-03-21 16:24:24 +01:00
# SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
2008-06-10 03:25:10 +02:00
#
2006-08-26 13:35:28 +02:00
#****************************************************************************/
#
2023-01-30 04:39:22 +01:00
# make all to compile and build Verilator.
# make install to install it.
# make TAGS to update tags tables.
2006-08-26 13:35:28 +02:00
#
# make clean or make mostlyclean
# Delete all files from the current directory that are normally
2023-01-30 04:39:22 +01:00
# created by building the program. Don't delete the files that
2006-08-26 13:35:28 +02:00
# record the configuration. Also preserve files that could be made
# by building, but normally aren't because the distribution comes
# with them.
#
# make distclean
# Delete all files from the current directory that are created by
# configuring or building the program. If you have unpacked the
# source and built the program without creating any other files,
# `make distclean' should leave only the files that were in the
# distribution.
2008-06-10 03:25:10 +02:00
#
2006-08-26 13:35:28 +02:00
# make maintainer-clean
# Delete everything from the current directory that can be
# reconstructed with this Makefile. This typically includes
# everything deleted by distclean, plus more: C source files
# produced by Bison, tags tables, info files, and so on.
#### Start of system configuration section. ####
srcdir = @srcdir@
VPATH = @srcdir@
HOST = @HOST@
2021-06-04 18:04:55 +02:00
EXEEXT = @EXEEXT@
2006-08-26 13:35:28 +02:00
2012-04-15 21:44:32 +02:00
DOXYGEN = doxygen
2006-08-26 13:35:28 +02:00
INSTALL = @INSTALL@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_DATA = @INSTALL_DATA@
MAKEINFO = makeinfo
2009-11-03 15:22:47 +01:00
POD2TEXT = pod2text
2024-09-08 19:00:03 +02:00
PYTHON3 = @PYTHON3@
2018-09-14 01:09:35 +02:00
MKINSTALLDIRS = $( SHELL) $( srcdir) /src/mkinstalldirs
2006-08-26 13:35:28 +02:00
2021-04-12 02:38:37 +02:00
# Version (for docs/guide/conf.py)
PACKAGE_VERSION_NUMBER = @PACKAGE_VERSION_NUMBER@
2008-05-07 19:46:33 +02:00
# Destination prefix for RPMs
2008-06-10 03:25:10 +02:00
DESTDIR =
2008-05-07 19:46:33 +02:00
2006-08-26 13:35:28 +02:00
#### Don't edit: You're much better using configure switches to set these
prefix = @prefix@
exec_prefix = @exec_prefix@
# Directory in which to install scripts.
bindir = @bindir@
2016-11-09 00:12:05 +01:00
# Directory in which to install manpages.
2006-08-26 13:35:28 +02:00
mandir = @mandir@
# Directory in which to install library files.
datadir = @datadir@
# Directory in which to install documentation info files.
infodir = @infodir@
2024-09-11 01:04:55 +02:00
# Directory in which to install package-specific files
2008-03-18 21:26:37 +01:00
# Generally ${prefix}/share/verilator
2006-08-26 13:35:28 +02:00
pkgdatadir = @pkgdatadir@
2015-05-14 03:21:29 +02:00
# Directory in which to install pkgconfig file
2019-07-26 18:58:13 +02:00
# Generally ${prefix}/share/pkgconfig
2015-05-14 03:21:29 +02:00
pkgconfigdir = @pkgconfigdir@
2008-04-29 16:14:20 +02:00
# Directory in which to install data across multiple architectures
datarootdir = @datarootdir@
2009-06-21 19:17:12 +02:00
# Compile options
2011-10-07 12:48:40 +02:00
CFG_WITH_CCWARN = @CFG_WITH_CCWARN@
2009-06-21 19:17:12 +02:00
CFG_WITH_DEFENV = @CFG_WITH_DEFENV@
2025-10-03 18:18:24 +02:00
CFG_WITH_DEV_GCOV = @CFG_WITH_DEV_GCOV@
2011-10-07 12:48:40 +02:00
CFG_WITH_LONGTESTS = @CFG_WITH_LONGTESTS@
2024-05-17 16:38:34 +02:00
CFG_WITH_SOLVER = @CFG_WITH_SOLVER@
2011-10-07 12:48:40 +02:00
PACKAGE_VERSION = @PACKAGE_VERSION@
2009-06-21 19:17:12 +02:00
2006-08-26 13:35:28 +02:00
#### End of system configuration section. ####
######################################################################
2024-09-15 19:55:43 +02:00
# Main build targets
2006-08-26 13:35:28 +02:00
2015-11-28 23:33:01 +01:00
.SUFFIXES :
2006-08-26 13:35:28 +02:00
SHELL = /bin/sh
2020-01-11 12:53:52 +01:00
SUBDIRS = docs src test_regress \
2025-06-24 23:58:55 +02:00
examples/cmake_hello_c \
examples/cmake_hello_sc \
examples/cmake_tracing_c \
examples/cmake_tracing_sc \
examples/cmake_protect_lib \
examples/make_hello_binary \
examples/make_hello_c \
examples/make_hello_sc \
examples/make_tracing_c \
examples/make_tracing_sc \
examples/make_protect_lib \
examples/json_py \
2006-08-26 13:35:28 +02:00
2021-04-12 00:55:06 +02:00
INFOS = verilator.html verilator.pdf
2019-11-08 01:52:56 +01:00
INFOS_OLD = README README.html README.pdf
2006-08-26 13:35:28 +02:00
2019-08-05 02:20:29 +02:00
EXAMPLES_FIRST = \
2025-06-24 23:58:55 +02:00
examples/make_hello_c \
examples/make_hello_sc \
2019-08-05 02:20:29 +02:00
EXAMPLES = $( EXAMPLES_FIRST) $( filter-out $( EXAMPLES_FIRST) , $( sort $( wildcard examples/*) ) )
2019-09-11 16:01:18 +02:00
# See uninstall also - don't put wildcards in this variable, it might uninstall other stuff
2023-01-18 01:15:54 +01:00
# No verilator_ccache_report.1, verilator_difftree.1 as those are not bin/ installed
VL_INST_MAN_FILES = \
2025-06-24 23:58:55 +02:00
verilator.1 \
verilator_coverage.1 \
verilator_gantt.1 \
verilator_profcfunc.1 \
2019-09-11 16:01:18 +02:00
2009-11-02 14:06:04 +01:00
default : all
2006-08-26 13:35:28 +02:00
all : all_nomsg msg_test
2008-07-14 19:41:00 +02:00
all_nomsg : verilator_exe $( VL_INST_MAN_FILES )
2006-08-26 13:35:28 +02:00
2025-06-24 23:58:55 +02:00
.PHONY : verilator_exe
.PHONY : verilator_bin $( EXEEXT )
.PHONY : verilator_bin_dbg $( EXEEXT )
.PHONY : verilator_coverage_bin_dbg $( EXEEXT )
2021-06-04 18:04:55 +02:00
verilator_exe verilator_bin$(EXEEXT) verilator_bin_dbg$(EXEEXT) verilator_coverage_bin_dbg$(EXEEXT) :
2006-08-26 13:35:28 +02:00
@echo ------------------------------------------------------------
2018-08-25 13:55:48 +02:00
@echo "making verilator in src"
2021-06-13 18:32:49 +02:00
$( MAKE) -C src $( OBJCACHE_JOBS)
2006-08-26 13:35:28 +02:00
2024-09-15 19:55:43 +02:00
######################################################################
# Tests
2025-06-24 23:58:55 +02:00
.PHONY : msg_test
2012-02-17 02:39:13 +01:00
msg_test : all_nomsg
2006-08-26 13:35:28 +02:00
@echo "Build complete!"
@echo
2017-09-24 03:18:07 +02:00
@echo "Now type 'make test' to test."
2006-08-26 13:35:28 +02:00
@echo
2017-09-24 03:18:07 +02:00
.PHONY : test
2023-01-30 04:39:22 +01:00
i f e q ( $( CFG_WITH_LONGTESTS ) , y e s ) # Local... Else don't burden users
2019-10-06 16:58:16 +02:00
test : smoke -test test_regress
2024-09-08 19:00:03 +02:00
# examples is part of test_regress's test_regress/t/t_a2_examples.py
2019-10-06 16:58:16 +02:00
# (because that allows it to run in parallel with other test_regress's)
2006-08-26 13:35:28 +02:00
e l s e
2017-09-24 03:18:07 +02:00
test : smoke -test examples
2006-08-26 13:35:28 +02:00
e n d i f
@echo "Tests passed!"
@echo
2017-09-24 03:18:07 +02:00
@echo "Now type 'make install' to install."
@echo "Or type 'make' inside an examples subdirectory."
2006-08-26 13:35:28 +02:00
@echo
2017-09-24 03:18:07 +02:00
smoke-test : all_nomsg
2024-09-08 19:00:03 +02:00
test_regress/t/t_a1_first_cc.py
test_regress/t/t_a2_first_sc.py
2017-09-24 03:18:07 +02:00
2006-08-26 13:35:28 +02:00
test_regress : all_nomsg
2018-08-25 13:55:48 +02:00
$( MAKE) -C test_regress
2006-08-26 13:35:28 +02:00
2023-10-28 16:58:29 +02:00
.PHONY : test -snap test -diff
test-snap test-diff :
$( MAKE) -C test_regress $@
2017-09-24 03:18:07 +02:00
examples : all_nomsg
2019-08-05 02:20:29 +02:00
for p in $( EXAMPLES) ; do \
2025-11-01 19:12:47 +01:00
$( MAKE) -C $$ p VERILATOR_ROOT = ` pwd ` || exit 10; \
2017-09-24 03:18:07 +02:00
done
2024-09-15 19:55:43 +02:00
######################################################################
# Docs
2019-06-13 13:19:44 +02:00
.PHONY : docs
2025-01-03 16:00:56 +01:00
docs : info $( VL_INST_MAN_FILES )
2019-06-13 13:19:44 +02:00
2006-08-26 13:35:28 +02:00
info : $( INFOS )
2023-01-18 01:15:54 +01:00
verilator.1 : ${srcdir }/bin /verilator
pod2man $< $@
verilator_coverage.1 : ${srcdir }/bin /verilator_coverage
2014-11-27 17:44:06 +01:00
pod2man $< $@
2023-01-18 01:15:54 +01:00
%.1 : ${srcdir }/bin /%
2025-01-03 15:58:33 +01:00
help2man --no-info --no-discard-stderr --version-string= - \
-n " $( shell $< --help | head -n 3 | tail -n 1) " $< -o $@
2014-11-27 17:44:06 +01:00
2021-04-12 00:55:06 +02:00
.PHONY : verilator .html
verilator.html :
$( MAKE) -C docs html
2006-08-26 13:35:28 +02:00
2011-10-05 15:50:14 +02:00
# PDF needs DIST variables; but having configure.ac as dependency isn't detected
2021-04-12 00:55:06 +02:00
.PHONY : verilator .pdf
verilator.pdf : Makefile
$( MAKE) -C docs verilator.pdf
2006-08-26 13:35:28 +02:00
2025-06-24 23:58:55 +02:00
TAGFILES = ${ srcdir } /*/*.cpp ${ srcdir } /*/*.h ${ srcdir } /*/*.in \
${ srcdir } /*.in ${ srcdir } /*.pod
2024-09-15 19:55:43 +02:00
TAGS : $( TAGFILES )
etags $( TAGFILES)
.PHONY : doxygen
doxygen :
$( MAKE) -C docs doxygen
2025-05-10 19:22:26 +02:00
.PHONY : spelling
spelling :
$( MAKE) -C docs spelling
2024-09-15 19:55:43 +02:00
######################################################################
# Install
2024-03-01 01:08:28 +01:00
# Public executables intended to be invoked directly by the user
# Don't put wildcards in these variables, it might cause an uninstall of other stuff
2025-06-24 23:58:55 +02:00
VL_INST_PUBLIC_SCRIPT_FILES = \
verilator \
verilator_coverage \
verilator_gantt \
verilator_profcfunc \
2024-03-01 01:08:28 +01:00
2025-06-24 23:58:55 +02:00
VL_INST_PUBLIC_BIN_FILES = \
verilator_bin$( EXEEXT) \
verilator_bin_dbg$( EXEEXT) \
verilator_coverage_bin_dbg$( EXEEXT) \
2024-03-01 01:08:28 +01:00
# Private executabels intended to be invoked by internals
# Don't put wildcards in these variables, it might cause an uninstall of other stuff
2025-06-24 23:58:55 +02:00
VL_INST_PRIVATE_SCRIPT_FILES = \
verilator_ccache_report \
verilator_includer \
2010-02-08 15:28:40 +01:00
2010-03-18 01:20:40 +01:00
VL_INST_INC_BLDDIR_FILES = \
2025-06-24 23:58:55 +02:00
include/verilated_config.h \
include/verilated.mk \
2010-03-18 01:20:40 +01:00
# Files under srcdir, instead of build time
VL_INST_INC_SRCDIR_FILES = \
2025-06-24 23:58:55 +02:00
include/*.[ chv] * \
include/*.vlt \
include/*.sv \
include/gtkwave/*.[ chv] * \
include/vltstd/*.[ chv] * \
2010-02-08 15:28:40 +01:00
2010-03-18 01:20:40 +01:00
VL_INST_DATA_SRCDIR_FILES = \
2025-06-24 23:58:55 +02:00
examples/*/*.[ chv] * \
examples/*/CMakeLists.txt \
examples/*/Makefile* \
examples/*/vl_* \
2010-02-08 15:28:40 +01:00
2024-03-01 01:08:28 +01:00
mkbindirs :
2018-09-14 01:09:35 +02:00
$( MKINSTALLDIRS) $( DESTDIR) $( pkgdatadir) /bin
2024-03-01 01:08:28 +01:00
$( MKINSTALLDIRS) $( DESTDIR) $( bindir)
installbin : | mkbindirs
cd $( srcdir) /bin; \
for p in $( VL_INST_PUBLIC_SCRIPT_FILES) ; do \
2025-11-01 19:12:47 +01:00
$( INSTALL_PROGRAM) $$ p $( DESTDIR) $( bindir) /$$ p; \
2024-03-01 01:08:28 +01:00
done
2024-10-18 11:06:28 +02:00
perl -p -i -e 'use File::Spec;' \
-e' $$path = File::Spec->abs2rel("$(realpath $(DESTDIR)$(pkgdatadir))", "$(realpath $(DESTDIR)$(bindir))");' \
-e 's/my \$$verilator_pkgdatadir_relpath = .*/my \$$verilator_pkgdatadir_relpath = "$$path";/g' \
-- " $( DESTDIR) / $( bindir) /verilator "
2024-03-01 01:08:28 +01:00
cd bin; \
for p in $( VL_INST_PUBLIC_BIN_FILES) ; do \
2025-11-01 19:12:47 +01:00
$( INSTALL_PROGRAM) $$ p $( DESTDIR) $( bindir) /$$ p; \
2024-03-01 01:08:28 +01:00
done
cd $( srcdir) /bin; \
for p in $( VL_INST_PRIVATE_SCRIPT_FILES) ; do \
2025-11-01 19:12:47 +01:00
$( INSTALL_PROGRAM) $$ p $( DESTDIR) $( pkgdatadir) /bin/$$ p; \
2024-03-01 01:08:28 +01:00
done
installredirect : installbin | mkbindirs
cp ${ srcdir } /bin/redirect ${ srcdir } /bin/redirect.tmp
perl -p -i -e 'use File::Spec;' \
2024-10-18 11:06:28 +02:00
-e' $$path = File::Spec->abs2rel("$(realpath $(DESTDIR)$(bindir))", "$(realpath $(DESTDIR)$(pkgdatadir)/bin)");' \
2024-03-01 01:08:28 +01:00
-e 's/RELPATH.*/"$$path";/g' -- " ${ srcdir } /bin/redirect.tmp "
cd $( srcdir) /bin; \
for p in $( VL_INST_PUBLIC_SCRIPT_FILES) $( VL_INST_PUBLIC_BIN_FILES) ; do \
2025-11-01 19:12:47 +01:00
$( INSTALL_PROGRAM) redirect.tmp $( DESTDIR) $( pkgdatadir) /bin/$$ p; \
2024-03-01 01:08:28 +01:00
done
rm ${ srcdir } /bin/redirect.tmp
2006-08-26 13:35:28 +02:00
2011-10-07 12:48:40 +02:00
# Man files can either be part of the original kit, or built in current directory
2018-09-14 01:09:35 +02:00
# So important we use $^ so VPATH is searched
2011-10-07 12:48:40 +02:00
installman : $( VL_INST_MAN_FILES )
2018-09-14 01:09:35 +02:00
$( MKINSTALLDIRS) $( DESTDIR) $( mandir) /man1
for p in $^ ; do \
2025-11-01 19:12:47 +01:00
$( INSTALL_DATA) $$ p $( DESTDIR) $( mandir) /man1/$$ p; \
2006-08-26 13:35:28 +02:00
done
2008-03-18 21:26:37 +01:00
installdata :
2018-10-02 00:29:04 +02:00
$( MKINSTALLDIRS) $( DESTDIR) $( pkgdatadir) /include/gtkwave
2018-09-14 01:09:35 +02:00
$( MKINSTALLDIRS) $( DESTDIR) $( pkgdatadir) /include/vltstd
2010-03-18 01:20:40 +01:00
for p in $( VL_INST_INC_BLDDIR_FILES) ; do \
2025-11-01 19:12:47 +01:00
$( INSTALL_DATA) $$ p $( DESTDIR) $( pkgdatadir) /$$ p; \
2010-03-18 01:20:40 +01:00
done
cd $( srcdir) \
; for p in $( VL_INST_INC_SRCDIR_FILES) ; do \
2010-04-10 02:21:00 +02:00
$( INSTALL_DATA) $$ p $( DESTDIR) $( pkgdatadir) /$$ p; \
2010-02-08 15:28:40 +01:00
done
2022-09-28 15:04:14 +02:00
$( MKINSTALLDIRS) $( DESTDIR) $( pkgdatadir) /examples/make_hello_binary
2019-10-06 16:32:49 +02:00
$( MKINSTALLDIRS) $( DESTDIR) $( pkgdatadir) /examples/make_hello_c
$( MKINSTALLDIRS) $( DESTDIR) $( pkgdatadir) /examples/make_hello_sc
$( MKINSTALLDIRS) $( DESTDIR) $( pkgdatadir) /examples/make_tracing_c
$( MKINSTALLDIRS) $( DESTDIR) $( pkgdatadir) /examples/make_tracing_sc
2019-10-09 12:47:26 +02:00
$( MKINSTALLDIRS) $( DESTDIR) $( pkgdatadir) /examples/make_protect_lib
2019-10-18 01:44:10 +02:00
$( MKINSTALLDIRS) $( DESTDIR) $( pkgdatadir) /examples/cmake_hello_c
$( MKINSTALLDIRS) $( DESTDIR) $( pkgdatadir) /examples/cmake_hello_sc
$( MKINSTALLDIRS) $( DESTDIR) $( pkgdatadir) /examples/cmake_tracing_c
$( MKINSTALLDIRS) $( DESTDIR) $( pkgdatadir) /examples/cmake_tracing_sc
$( MKINSTALLDIRS) $( DESTDIR) $( pkgdatadir) /examples/cmake_protect_lib
2024-02-09 23:50:09 +01:00
$( MKINSTALLDIRS) $( DESTDIR) $( pkgdatadir) /examples/json_py
2010-03-18 01:20:40 +01:00
cd $( srcdir) \
; for p in $( VL_INST_DATA_SRCDIR_FILES) ; do \
2017-09-24 03:18:07 +02:00
$( INSTALL_DATA) $$ p $( DESTDIR) $( pkgdatadir) /$$ p; \
2010-02-08 15:28:40 +01:00
done
2018-09-14 01:09:35 +02:00
$( MKINSTALLDIRS) $( DESTDIR) $( pkgconfigdir)
2015-05-14 03:21:29 +02:00
$( INSTALL_DATA) verilator.pc $( DESTDIR) $( pkgconfigdir)
2019-10-18 01:44:10 +02:00
$( INSTALL_DATA) verilator-config.cmake $( DESTDIR) $( pkgdatadir)
$( INSTALL_DATA) verilator-config-version.cmake $( DESTDIR) $( pkgdatadir)
2010-02-08 15:28:40 +01:00
# We don't trust rm -rf, so rmdir instead as it will fail if user put in other files
uninstall :
2024-03-01 01:08:28 +01:00
-cd $( DESTDIR) $( bindir) && rm -f $( VL_INST_PUBLIC_SCRIPT_FILES)
-cd $( DESTDIR) $( bindir) && rm -f $( VL_INST_PUBLIC_BIN_FILES)
-cd $( DESTDIR) $( pkgdatadir) /bin && rm -f $( VL_INST_PUBLIC_SCRIPT_FILES)
-cd $( DESTDIR) $( pkgdatadir) /bin && rm -f $( VL_INST_PUBLIC_BIN_FILES)
-cd $( DESTDIR) $( pkgdatadir) /bin && rm -f $( VL_INST_PRIVATE_SCRIPT_FILES)
2010-02-08 15:28:40 +01:00
-cd $( DESTDIR) $( mandir) /man1 && rm -f $( VL_INST_MAN_FILES)
2010-03-18 01:20:40 +01:00
-cd $( DESTDIR) $( pkgdatadir) && rm -f $( VL_INST_INC_BLDDIR_FILES)
-cd $( DESTDIR) $( pkgdatadir) && rm -f $( VL_INST_INC_SRCDIR_FILES)
2017-09-24 03:18:07 +02:00
-cd $( DESTDIR) $( pkgdatadir) && rm -f $( VL_INST_DATA_SRCDIR_FILES)
2015-05-14 03:21:29 +02:00
-rm $( DESTDIR) $( pkgconfigdir) /verilator.pc
2019-10-18 01:44:10 +02:00
-rm $( DESTDIR) $( pkgdatadir) /verilator-config.cmake
-rm $( DESTDIR) $( pkgdatadir) /verilator-config-version.cmake
2010-02-08 15:28:40 +01:00
-rmdir $( DESTDIR) $( pkgdatadir) /bin
2018-10-02 00:29:04 +02:00
-rmdir $( DESTDIR) $( pkgdatadir) /include/gtkwave
2010-02-08 15:28:40 +01:00
-rmdir $( DESTDIR) $( pkgdatadir) /include/vltstd
-rmdir $( DESTDIR) $( pkgdatadir) /include
2022-09-28 15:04:14 +02:00
-rmdir $( DESTDIR) $( pkgdatadir) /examples/make_hello_binary
2019-10-06 16:32:49 +02:00
-rmdir $( DESTDIR) $( pkgdatadir) /examples/make_hello_c
-rmdir $( DESTDIR) $( pkgdatadir) /examples/make_hello_sc
-rmdir $( DESTDIR) $( pkgdatadir) /examples/make_tracing_c
-rmdir $( DESTDIR) $( pkgdatadir) /examples/make_tracing_sc
2019-10-09 12:47:26 +02:00
-rmdir $( DESTDIR) $( pkgdatadir) /examples/make_protect_lib
2019-10-18 01:44:10 +02:00
-rmdir $( DESTDIR) $( pkgdatadir) /examples/cmake_hello_c
-rmdir $( DESTDIR) $( pkgdatadir) /examples/cmake_hello_sc
-rmdir $( DESTDIR) $( pkgdatadir) /examples/cmake_tracing_c
-rmdir $( DESTDIR) $( pkgdatadir) /examples/cmake_tracing_sc
-rmdir $( DESTDIR) $( pkgdatadir) /examples/cmake_protect_lib
2024-02-09 23:50:09 +01:00
-rmdir $( DESTDIR) $( pkgdatadir) /examples/json_py
2010-02-08 15:28:40 +01:00
-rmdir $( DESTDIR) $( pkgdatadir) /examples
-rmdir $( DESTDIR) $( pkgdatadir)
2015-05-14 03:21:29 +02:00
-rmdir $( DESTDIR) $( pkgconfigdir)
2010-02-08 15:28:40 +01:00
2011-12-16 00:39:51 +01:00
install : all_nomsg install -all
2024-03-01 01:08:28 +01:00
install-all : installbin installredirect installman installdata install -msg
2006-08-26 13:35:28 +02:00
2021-07-11 16:25:24 +02:00
install-here : installman info
2006-08-26 13:35:28 +02:00
2024-09-15 19:55:43 +02:00
install-msg :
@echo
@echo " Installed binaries to $( DESTDIR) $( bindir) /verilator "
@echo " Installed man to $( DESTDIR) $( mandir) /man1 "
@echo " Installed examples to $( DESTDIR) $( pkgdatadir) /examples "
@echo
@echo "For documentation see 'man verilator' or 'verilator --help'"
@echo "For forums and to report bugs see https://verilator.org"
@echo
######################################################################
# Format/Lint
2025-08-20 19:49:59 +02:00
CPPCHECK_VERILATOR_CPP = $( wildcard $( srcdir) /src/V3*.cpp $( srcdir) /src/Verilator*.cpp)
CPPCHECK_RUNTIME_CPP = $( wildcard $( srcdir) /include/*.cpp)
CPPCHECK_VLC_CPP = $( wildcard $( srcdir) /src/Vlc*.cpp)
CPPCHECK_EXAMPLES_CPP = $( wildcard $( srcdir) /examples/*/*.cpp)
CHECK_CPP = $( CPPCHECK_VERILATOR_CPP) $( CPPCHECK_RUNTIME_CPP) $( CPPCHECK_VLC_CPP) $( CPPCHECK_EXAMPLES_CPP)
2026-03-24 10:02:04 +01:00
CHECK_H = $( filter-out \
$( srcdir) /src/config_package.h \
$( srcdir) /src/config_rev.h, \
$( wildcard \
2025-06-24 23:58:55 +02:00
$( srcdir) /include/*.h \
2026-03-24 10:02:04 +01:00
$( srcdir) /src/*.h ) )
2022-11-27 11:52:40 +01:00
CHECK_YL = $( wildcard \
2025-06-24 23:58:55 +02:00
$( srcdir) /src/*.y \
$( srcdir) /src/*.l )
2025-08-19 23:02:10 +02:00
CPPCHECK = cppcheck
2025-08-20 19:49:59 +02:00
CPPCHECK_JOBS = $( shell nproc)
2025-08-19 23:02:10 +02:00
CPPCHECK_CACHE = $( srcdir) /src/obj_dbg/cppcheck-cache
CPPCHECK_FLAGS = --enable= all
CPPCHECK_FLAGS += --inline-suppr
CPPCHECK_FLAGS += --suppressions-list= $( srcdir) /src/cppcheck-suppressions.txt
CPPCHECK_FLAGS += --cppcheck-build-dir= $( CPPCHECK_CACHE)
2025-08-22 02:06:43 +02:00
CPPCHECK_FLAGS += -DVL_DEBUG= 1 -DVL_CPPCHECK= 1 -DINFILTER_PIPE= 1 -D__GNUC__= 1
2025-08-20 19:49:59 +02:00
CPPCHECK_FLAGS += -j$( CPPCHECK_JOBS)
2025-08-19 23:02:10 +02:00
CPPCHECK_INC = -I$( srcdir) /include
CPPCHECK_INC += -I$( srcdir) /include/gtkwave
CPPCHECK_INC += -I$( srcdir) /include/vltstd
CPPCHECK_INC += -I$( srcdir) /src/obj_dbg
CPPCHECK_INC += -I$( srcdir) /src
2025-08-20 03:36:52 +02:00
$(CPPCHECK_CACHE) : $( CHECK_CPP ) $( CHECK_H ) $( CHECK_YL )
/bin/rm -rf $@
/bin/mkdir -p $@
2011-08-05 03:58:45 +02:00
2025-08-20 19:49:59 +02:00
cppcheck-verilator : | $( CPPCHECK_CACHE )
$( CPPCHECK) $( CPPCHECK_FLAGS) $( CPPCHECK_INC) $( CPPCHECK_VERILATOR_CPP)
cppcheck-runtime : | $( CPPCHECK_CACHE )
$( CPPCHECK) $( CPPCHECK_FLAGS) $( CPPCHECK_INC) $( CPPCHECK_RUNTIME_CPP)
cppcheck-vlc : | $( CPPCHECK_CACHE )
$( CPPCHECK) $( CPPCHECK_FLAGS) $( CPPCHECK_INC) $( CPPCHECK_VLC_CPP)
cppcheck-examples : | $( CPPCHECK_CACHE )
$( CPPCHECK) $( CPPCHECK_FLAGS) $( CPPCHECK_INC) $( CPPCHECK_EXAMPLES_CPP)
cppcheck :
$( MAKE) cppcheck-vlc
$( MAKE) cppcheck-examples
$( MAKE) cppcheck-runtime
$( MAKE) cppcheck-verilator
2011-08-05 03:58:45 +02:00
2018-10-15 00:39:33 +02:00
CLANGTIDY = clang-tidy
2022-07-30 17:52:35 +02:00
CLANGTIDY_FLAGS = -config= '' \
2025-06-24 23:58:55 +02:00
-header-filter= '.*' \
2026-03-28 04:14:18 +01:00
-checks= '*,-abseil-*,-fuchsia-*,-cppcoreguidelines-avoid-c-arrays,-cppcoreguidelines-init-variables,-cppcoreguidelines-avoid-goto,-modernize-avoid-c-arrays,-readability-magic-numbers,-readability-simplify-boolean-expr,-cppcoreguidelines-macro-usage' \
# Good checks: -checks='-*,bugprone-assignment-in-if-condition,google-build-using-namespace,google-readability-casting,modernize-use-default-member-init,modernize-use-emplace,modernize-use-equals-default,modernize-use-equals-delete,modernize-use-nullptr,performance-faster-string-find,readability-isolate-declaration,readability-redundant-control-flow,readability-redundant-member-init,readability-redundant-string-cstr,readability-uppercase-literal-suffix
2022-07-30 17:52:35 +02:00
2022-11-27 11:52:40 +01:00
CLANGTIDY_DEP = $( subst .cpp,.cpp.tidy,$( CHECK_CPP) )
2022-11-05 13:47:34 +01:00
CLANGTIDY_DEFS = -DVL_DEBUG= 1 -DVL_CPPCHECK= 1
2018-10-15 00:39:33 +02:00
2020-11-11 03:40:14 +01:00
clang-tidy : $( CLANGTIDY_DEP )
2018-10-15 00:39:33 +02:00
%.cpp.tidy : %.cpp
2020-11-17 01:56:16 +01:00
$( CLANGTIDY) $( CLANGTIDY_FLAGS) $< -- $( CLANGTIDY_DEFS) $( CPPCHECK_INC) | 2>& 1 tee $@
2018-10-15 00:39:33 +02:00
%.h.tidy : %.h
2022-08-02 17:31:45 +02:00
$( CLANGTIDY) $( CLANGTIDY_FLAGS) $< -- $( CLANGTIDY_DEFS) $( CPPCHECK_INC) -x c++-header | 2>& 1 tee $@
2018-10-15 00:39:33 +02:00
2017-11-25 21:41:49 +01:00
analyzer-src :
-rm -rf src/obj_dbg
2021-06-04 18:04:55 +02:00
scan-build $( MAKE) -k verilator_coverage_bin_dbg$( EXEEXT) verilator_bin_dbg$( EXEEXT)
2017-11-25 21:41:49 +01:00
analyzer-include :
-rm -rf examples/*/obj*
scan-build $( MAKE) -k examples
2025-11-22 18:30:29 +01:00
# Bash/sh files
BASH_FILES = \
ci/ci-install.bash \
ci/ci-pages-notify.bash \
ci/ci-pages.bash \
ci/ci-script.bash \
ci/docker/run/hooks/post_push \
ci/docker/run/verilator-docker \
ci/docker/run/verilator-wrap.sh \
nodist/fuzzer/all \
nodist/fuzzer/run \
nodist/fuzzer/setup_root \
nodist/fuzzer/setup_user \
2024-09-25 02:43:19 +02:00
# CMake files
CMAKE_FILES = \
2025-06-24 23:58:55 +02:00
CMakeLists.txt \
examples/*/CMakeLists.txt \
src/CMakeLists.txt \
test_regress/CMakeLists.txt \
*.cmake.in \
# Makefiles
MAKE_FILES = \
Makefile*.in \
docs/Makefile* \
include/verilated.mk.in \
examples/*/Makefile* \
src/Makefile*.in \
test_regress/Makefile* \
2024-09-25 02:43:19 +02:00
2025-11-22 18:22:39 +01:00
# Perl programs
PERL_PROGRAMS = \
bin/redirect \
bin/verilator \
bin/verilator_coverage \
2024-09-08 19:00:03 +02:00
# Python programs, subject to format and lint
2021-03-06 03:59:00 +01:00
PY_PROGRAMS = \
2025-06-24 23:58:55 +02:00
bin/verilator_ccache_report \
bin/verilator_difftree \
bin/verilator_gantt \
bin/verilator_includer \
bin/verilator_profcfunc \
docs/bin/vl_sphinx_extract \
docs/bin/vl_sphinx_fix \
2025-11-22 18:22:39 +01:00
docs/guide/conf.py \
examples/json_py/vl_file_copy \
examples/json_py/vl_hier_graph \
nodist/clang_check_attributes \
nodist/dot_importer \
nodist/fuzzer/actual_fail \
nodist/fuzzer/generate_dictionary \
nodist/install_test \
nodist/lint_py_test_filter \
nodist/log_changes \
nodist/uvm_pkg_packer \
2026-03-21 11:13:27 +01:00
nodist/verilator_bisect \
2025-11-22 18:22:39 +01:00
nodist/verilator_saif_diff \
src/.gdbinit.py \
2025-06-24 23:58:55 +02:00
src/astgen \
src/bisonpre \
src/config_rev \
src/flexfix \
src/vlcovgen \
test_regress/*.py \
test_regress/t/*.pf \
2020-12-19 04:34:14 +01:00
2024-09-08 19:00:03 +02:00
# Python files, subject to format but not lint
2021-03-06 03:59:00 +01:00
PY_FILES = \
2025-06-24 23:58:55 +02:00
$( PY_PROGRAMS) \
test_regress/t/*.py \
2021-03-06 03:59:00 +01:00
2024-09-08 19:00:03 +02:00
# Python files, test_regress tests
2025-06-24 23:58:55 +02:00
PY_TEST_FILES = test_regress/t/*.py
2024-08-27 03:28:20 +02:00
2025-12-19 03:45:43 +01:00
# YAML files
YAML_FILES = \
.*.yaml \
.*.yml \
.github/*.yml \
.github/*/*.yml \
2025-12-21 04:19:15 +01:00
CITATION.cff \
2025-12-19 03:45:43 +01:00
2025-11-22 02:02:46 +01:00
######################################################################
# Format
2021-03-06 03:59:00 +01:00
2025-11-22 02:02:46 +01:00
format :
2025-12-19 03:45:43 +01:00
$( MAKE) -j 5 format-c format-cmake format-exec format-py format-yaml
2025-11-22 02:02:46 +01:00
2025-11-22 18:30:29 +01:00
BEAUTYSH = beautysh
BEAUTYSH_FLAGS = --indent-size 2
format-bash :
$( BEAUTYSH) --version
$( BEAUTYSH) $( BEAUTYSH_FLAGS) $( BASH_FILES)
2025-11-22 02:02:46 +01:00
CLANGFORMAT = clang-format-18
CLANGFORMAT_FLAGS = -i
CLANGFORMAT_FILES = $( CHECK_CPP) $( CHECK_H) $( CHECK_YL) test_regress/t/*.c* test_regress/t/*.h
format-c clang-format :
$( CLANGFORMAT) --version
@$( CLANGFORMAT) --version | fgrep 'version 18' > /dev/null \
|| echo "*** You are not using clang-format-18, indents may differ from master's ***"
$( CLANGFORMAT) $( CLANGFORMAT_FLAGS) $( CLANGFORMAT_FILES)
2021-03-06 03:59:00 +01:00
2024-09-25 02:43:19 +02:00
GERSEMI = gersemi
2025-06-26 23:36:56 +02:00
GERSEMI_FLAGS = -i --no-warn-about-unknown-commands
2024-09-25 02:43:19 +02:00
format-cmake :
2025-11-22 02:02:46 +01:00
$( GERSEMI) --version
2024-09-25 02:43:19 +02:00
$( GERSEMI) $( GERSEMI_FLAGS) $( CMAKE_FILES)
2025-06-24 23:58:55 +02:00
MBAKE = mbake
MBAKE_FLAGS = format --config ./.bake.toml
2025-11-22 02:02:46 +01:00
format-exec :
2026-03-12 16:21:02 +01:00
-chmod a+x test_regress/t/t_*.py
2026-02-02 14:28:46 +01:00
-chmod a-x test_regress/t/*.v
2025-11-22 02:02:46 +01:00
format-make mbake :
$( MBAKE) --version
2025-06-24 23:58:55 +02:00
$( MBAKE) $( MBAKE_FLAGS) $( MAKE_FILES)
2025-12-14 12:18:32 +01:00
YAPF = yapf
2025-11-22 02:02:46 +01:00
YAPF_FLAGS = -i --parallel
format-py yapf :
$( YAPF) --version
$( YAPF) $( YAPF_FLAGS) $( PY_FILES)
YAMLFIX = YAMLFIX_WHITELINES = 1 YAMLFIX_LINE_LENGTH = 200 YAMLFIX_preserve_quotes = true yamlfix
2025-12-19 03:45:43 +01:00
YAMLFIX_FLAGS =
2025-11-22 02:02:46 +01:00
format-yaml yamlfix :
$( YAMLFIX) --version
2025-12-19 03:45:43 +01:00
$( YAMLFIX) $( YAMLFIX_FLAGS) $( YAML_FILES)
2025-11-22 02:02:46 +01:00
######################################################################
# Lint
2025-04-16 13:34:57 +02:00
2025-11-01 19:14:56 +01:00
MYPY = mypy
MYPY_FLAGS = --strict --no-error-summary
2021-03-06 04:52:39 +01:00
PYLINT = pylint
2024-09-08 19:00:03 +02:00
PYLINT_FLAGS = --recursive= n --score= n --disable= R0801
PYLINT_TEST_FLAGS = $( PYLINT_FLAGS) --disable= C0103,C0114,C0116,C0209,C0411,C0413,C0301,R0801,R0912,R0915,R0916,R1702,W0511,W0621
2021-03-06 04:52:39 +01:00
2023-05-06 12:08:32 +02:00
RUFF = ruff
RUFF_FLAGS = check --ignore= E402,E501,E701
2023-10-30 13:02:54 +01:00
# "make -k" so can see all tool result errors
2021-03-06 03:59:00 +01:00
lint-py :
2025-11-01 19:15:39 +01:00
$( MAKE) -k lint-py-mypy lint-py-mypy-none lint-py-pylint lint-py-pylint-tests lint-py-ruff
lint-py-mypy :
for filename in ` fgrep -l '# mypy' $( PY_PROGRAMS) ` ; do \
echo " $( MYPY) $( MYPY_FLAGS) $$ filename " ; \
$( MYPY) $( MYPY_FLAGS) $$ filename ; \
done
2025-11-01 19:14:56 +01:00
lint-py-mypy-none :
@echo "mypy not checking: " ` fgrep -L '# mypy' $( PY_PROGRAMS) `
2023-10-30 13:02:54 +01:00
lint-py-pylint :
$( PYLINT) $( PYLINT_FLAGS) $( PY_PROGRAMS)
2024-09-08 19:00:03 +02:00
lint-py-pylint-tests :
$( PYLINT) $( PYLINT_TEST_FLAGS) $( PY_TEST_FILES) | $( PYTHON3) nodist/lint_py_test_filter
2023-10-30 13:02:54 +01:00
lint-py-ruff :
$( RUFF) $( RUFF_FLAGS) $( PY_PROGRAMS)
2020-12-19 04:34:14 +01:00
2024-09-15 19:55:43 +02:00
######################################################################
# Configure
2006-08-26 13:35:28 +02:00
2010-02-15 13:34:55 +01:00
IN_WILD := ${ srcdir } /*.in ${ srcdir } /*/*.in
2006-08-26 13:35:28 +02:00
2023-07-27 11:42:35 +02:00
# autoheader might not change config_package.h.in, so touch it
${srcdir}/config_package.h : ${srcdir }/config_package .h .in configure
2006-08-26 13:35:28 +02:00
cd ${ srcdir } && autoheader
2010-02-15 13:34:55 +01:00
touch $@
Makefile : Makefile .in config .status $( IN_WILD )
2006-08-26 13:35:28 +02:00
./config.status
2010-02-15 13:34:55 +01:00
src/Makefile : src /Makefile .in Makefile
2006-08-26 13:35:28 +02:00
config.status : configure
./config.status --recheck
2011-10-04 16:07:46 +02:00
2006-12-15 22:18:41 +01:00
configure : configure .ac
2023-01-30 04:39:22 +01:00
i f e q ( $( CFG_WITH_CCWARN ) , y e s ) # Local... Else don't burden users
2011-10-04 16:07:46 +02:00
autoconf --warnings= all
e l s e
2006-08-26 13:35:28 +02:00
autoconf
2011-10-04 16:07:46 +02:00
e n d i f
2006-08-26 13:35:28 +02:00
2025-10-03 18:18:24 +02:00
######################################################################
# Coverage collection and reporting
COVERAGE_DIR := obj_coverage
i f e q ( $( CFG_WITH_DEV_GCOV ) , y e s )
2025-10-04 17:19:29 +02:00
# Figure out base and head refs for coverage report
COVERAGE_REF_BASE := $( if $( COVERAGE_BASE) ,$( shell git rev-parse --short $( COVERAGE_BASE) ) )
COVERAGE_REF_HEAD := $( shell git rev-parse --short HEAD)
o v e r r i d e u n d e f i n e C O V E R A G E _ B A S E # Use the above variabels instead
2025-10-03 18:18:24 +02:00
2025-10-04 17:19:29 +02:00
# 'fastcov' setup
FASTCOV := nodist/fastcov.py
2025-10-03 18:18:24 +02:00
FASTCOV_OPT := -j $( shell nproc)
2025-10-04 17:19:29 +02:00
FASTCOV_OPT += --lcov
2025-10-03 18:18:24 +02:00
FASTCOV_OPT += --process-gcno
FASTCOV_OPT += --branch-coverage
FASTCOV_OPT += --dump-statistic
# Files matching the following glob patterns will be excluded from coverage
FASTCOV_OPT += --exclude-glob
FASTCOV_OPT += '/usr/*'
2025-10-10 04:33:04 +02:00
FASTCOV_OPT += '*examples/*'
FASTCOV_OPT += '*include/gtkwave/*'
2025-10-03 18:18:24 +02:00
FASTCOV_OPT += '*src/obj_dbg/*'
FASTCOV_OPT += '*src/obj_opt/*.yy.cpp'
FASTCOV_OPT += '*src/obj_opt/V3Ast*'
FASTCOV_OPT += '*src/obj_opt/V3Dfg*'
FASTCOV_OPT += '*src/obj_opt/V3ParseBison.c'
FASTCOV_OPT += '*test_regress/*'
# Lines *containing* these substrings will be excluded from *all* coverage
FASTCOV_OPT += --custom-exclusion-marker
2025-10-10 04:33:04 +02:00
FASTCOV_OPT += ASTGEN_MEMBERS
FASTCOV_OPT += ERROR_RSVD_WORD
2025-10-03 18:18:24 +02:00
FASTCOV_OPT += LCOV_EXCL_LINE
2025-10-10 04:33:04 +02:00
FASTCOV_OPT += V3ERROR_NA
2025-10-03 18:18:24 +02:00
FASTCOV_OPT += VL_DEFINE_DEBUG_FUNCTIONS
2025-10-10 04:33:04 +02:00
FASTCOV_OPT += VL_FATAL
2025-10-03 18:18:24 +02:00
FASTCOV_OPT += VL_RTTI_IMPL
2025-10-10 04:33:04 +02:00
FASTCOV_OPT += VL_UNREACHABLE
2025-10-03 18:18:24 +02:00
FASTCOV_OPT += v3fatalSrc
# Lines *starting* with these substrings will be ecluded from *branch* coverage
FASTCOV_OPT += --exclude-br-lines-starting-with
2025-10-10 04:33:04 +02:00
FASTCOV_OPT += BROKEN_BASE_RTN
FASTCOV_OPT += BROKEN_RTN
2025-10-03 18:18:24 +02:00
FASTCOV_OPT += NUM_ASSERT
FASTCOV_OPT += SELF_CHECK
2025-10-10 04:33:04 +02:00
FASTCOV_OPT += UASSERT
FASTCOV_OPT += UINFO
FASTCOV_OPT += assert
2025-10-03 18:18:24 +02:00
FASTCOV_OPT += 'if (VL_UNCOVERABLE'
FASTCOV_OPT += '} else if (VL_UNCOVERABLE'
2025-10-04 17:19:29 +02:00
# 'genhtml' setup
2025-10-03 18:18:24 +02:00
GENHTML := genhtml
GENHTML_OPT := -j $( shell nproc)
GENHTML_OPT += --branch-coverage
GENHTML_OPT += --demangle-cpp
2025-10-11 18:54:55 +02:00
GENHTML_OPT += --missed
2025-10-03 18:18:24 +02:00
GENHTML_OPT += --rc branch_coverage = 1
GENHTML_OPT += --rc genhtml_hi_limit = 100
GENHTML_OPT += --ignore-errors negative
2025-10-04 17:19:29 +02:00
i f e q ( $( COVERAGE_REF_BASE ) , )
GENHTML_OPT += --header-title " Code coverage for Verilator $( shell git describe --dirty) "
e l s e
2025-10-07 18:03:13 +02:00
GENHTML_OPT += --header-title " Patch coverage for Verilator $( COVERAGE_REF_BASE) .. $( COVERAGE_REF_HEAD) $( if $( shell git status --porcelain) ,-dirty) "
2025-10-04 17:19:29 +02:00
e n d i f
GENHTML_OPT += --flat
GENHTML_OPT += --precision 2
GENHTML_OPT += --legend
GENHTML_OPT += --show-proportion
GENHTML_OPT += --filter brace,blank,range
2025-10-03 18:18:24 +02:00
# There are loads (~20k combined), but using this seems fine on modern hardware
GCNO_FILES = $( shell find . -name '*.gcno' )
GCDA_FILES = $( shell find . -name '*.gcda' )
# Combine all .gcda coverage date files into lcov .info file
2025-10-07 18:03:13 +02:00
$(COVERAGE_DIR)/verilator.info : $( GCNO_FILES ) $( GCDA_FILES )
2025-10-03 18:18:24 +02:00
@echo "####################################################################"
@echo "# fastcov: combining all .gcda files into lcov .info"
@echo "####################################################################"
2025-10-07 18:03:13 +02:00
@mkdir -p $( COVERAGE_DIR)
2025-10-03 18:18:24 +02:00
/usr/bin/time -f "That took %E" \
2025-11-01 19:12:47 +01:00
$( FASTCOV) $( FASTCOV_OPT) --output $@
2025-10-07 18:03:13 +02:00
# Filter combined .info file for patch coverage
$(COVERAGE_DIR)/verilator-patch.info : $( COVERAGE_DIR ) /verilator .info
@echo "####################################################################"
@echo "# fastcov: Filtering for patch coverage"
@echo "####################################################################"
rm -f $( COVERAGE_DIR) /empty-patch
git diff $( COVERAGE_REF_BASE) -- include src > $( COVERAGE_DIR) /filter.patch
[ -s $( COVERAGE_DIR) /filter.patch ] ] || touch $( COVERAGE_DIR) /empty-patch
$( FASTCOV) -C $^ --lcov -o $@ --diff-filter $( COVERAGE_DIR) /filter.patch
2025-10-03 18:18:24 +02:00
# Build coverage report
2025-10-07 18:03:13 +02:00
$(COVERAGE_DIR)/report/index.html : $( COVERAGE_DIR ) /verilator $( if $ ( COVERAGE_REF_BASE ) ,-patch ) .info
2025-10-03 18:18:24 +02:00
@echo "####################################################################"
@echo "# genhtml: Generating coverage report"
@echo "####################################################################"
2025-10-07 18:03:13 +02:00
@rm -rf $( COVERAGE_DIR) /report
[ -f $( COVERAGE_DIR) /empty-patch ] ] || /usr/bin/time -f "That took %E" \
2025-11-01 19:12:47 +01:00
$( GENHTML) $( GENHTML_OPT) --output-directory $( COVERAGE_DIR) /report $^ || true
2025-10-07 18:03:13 +02:00
@# Uncommitted changes not tracked, force rebuild on next run if patch coverage
@$( if $( COVERAGE_REF_BASE) ,mv $( COVERAGE_DIR) /verilator-patch.info $( COVERAGE_DIR) /verilator-patch-last.info)
2025-10-03 18:18:24 +02:00
# Convenience targets
.PHONY : coverage -combine
coverage-combine : $( COVERAGE_DIR ) /verilator .info
# Via recursive make, so the message is always printed
.PHONY : coverage -report
coverage-report :
2025-10-07 18:03:13 +02:00
@$( MAKE) --no-print-directory $( COVERAGE_DIR) /report/index.html || true
@if [ -f $( COVERAGE_DIR) /report/index.html ] ; then \
2025-11-01 19:12:47 +01:00
echo "####################################################################" ; \
echo " # Coverage report is at: $( COVERAGE_DIR) /report/index.html " ; \
echo "# Use 'make coverage-view' to open it in your default browser" ; \
echo "####################################################################" ; \
elif [ -f $( COVERAGE_DIR) /empty-patch ] ; then \
echo "####################################################################" ; \
echo "# Patch is empty" ; \
echo "####################################################################" ; \
else \
echo "####################################################################" ; \
echo "# Failed to create coverage report. Maybe no data, or error?" ; \
echo "####################################################################" ; \
false; \
fi
2025-10-03 18:18:24 +02:00
# Open covarage report in default web browser
.PHONY : coverage -view
2025-10-07 18:03:13 +02:00
coverage-view : coverage -report
@test -f $( COVERAGE_DIR) /report/index.html && open $( COVERAGE_DIR) /report/index.html || true
2025-10-03 18:18:24 +02:00
# Deletes all coverage data files (.gcda)
.PHONY : coverage -zero
coverage-zero : # 'rm $(GCDA_FILES)' might fail with too many args
$( FASTCOV) --zerocounters
e n d i f
2024-09-15 19:55:43 +02:00
######################################################################
# Clean
2006-08-26 13:35:28 +02:00
maintainer-clean ::
@echo "This command is intended for maintainers to use;"
2018-10-27 14:26:25 +02:00
@echo "rebuilding the deleted files requires autoconf."
rm -f configure
2006-08-26 13:35:28 +02:00
clean mostlyclean distclean maintainer-clean maintainer-copy ::
for dir in $( SUBDIRS) ; do \
2025-11-01 19:12:47 +01:00
echo making $@ in $$ dir ; \
$( MAKE) -C $$ dir $@ ; \
2006-08-26 13:35:28 +02:00
done
clean mostlyclean distclean maintainer-clean ::
2008-06-10 03:25:10 +02:00
rm -f $( SCRIPTS) *.tmp
2006-08-26 13:35:28 +02:00
rm -f *.aux *.cp *.cps *.dvi *.fn *.fns *.ky *.kys *.log
rm -f *.pg *.pgs *.toc *.tp *.tps *.vr *.vrs *.idx
rm -f *.ev *.evs *.ov *.ovs *.cv *.cvs *.ma *.mas
rm -f *.tex
2019-10-09 12:47:26 +02:00
rm -rf examples/*/obj_dir* examples/*/logs
2019-07-01 04:37:03 +02:00
rm -rf test_*/obj_dir
2025-03-30 17:02:05 +02:00
rm -rf src/*.tidy include/*.tidy examples/*/*.tidy
rm -rf .ruff_cache
2020-01-11 12:53:52 +01:00
rm -rf nodist/fuzzer/dictionary
2025-10-03 18:18:24 +02:00
rm -rf $( COVERAGE_DIR)
2021-04-12 00:55:06 +02:00
rm -rf verilator.txt
2006-08-26 13:35:28 +02:00
distclean maintainer-clean ::
2019-11-08 01:52:56 +01:00
rm -f *.info* *.1 $( INFOS) $( INFOS_OLD) $( VL_INST_MAN_FILES)
2025-11-04 00:36:20 +01:00
rm -f Makefile config.status config.cache config.log configure~ TAGS
2014-11-24 03:06:10 +01:00
rm -f verilator_bin* verilator_coverage_bin*
2017-10-14 22:01:27 +02:00
rm -f bin/verilator_bin* bin/verilator_coverage_bin*
2013-01-18 03:40:37 +01:00
rm -f include/verilated.mk include/verilated_config.h
2006-08-26 13:35:28 +02:00
######################################################################
# Distributions
2011-10-21 03:13:33 +02:00
DISTTITLE := Verilator $( word 1,$( PACKAGE_VERSION) )
2011-10-07 12:48:40 +02:00
DISTNAME := verilator-$( word 1,$( PACKAGE_VERSION) )
2011-10-21 03:13:33 +02:00
DISTDATEPRE := $( word 2,$( PACKAGE_VERSION) )
DISTDATE := $( subst /,-,$( DISTDATEPRE) )
2006-08-26 13:35:28 +02:00
DISTTAGNAME := $( subst .,_,$( subst -,_,$( DISTNAME) ) )
tag :
svnorcvs tag $( DISTTAGNAME)
maintainer-diff :
svnorcvs diff $( DISTTAGNAME)
preexist :
2008-05-07 20:32:00 +02:00
svnorcvs nexists $( DISTTAGNAME)
2006-08-26 13:35:28 +02:00
2021-07-11 16:25:24 +02:00
maintainer-dist : preexist tag
svnorcvs release $( DISTTAGNAME)
2025-12-14 12:18:32 +01:00
######################################################################
# Python venv
VENV_PATH ?= .venv
.PHONY : venv
venv :
# Create virtual environment using the python3 picked up by configure
[ -e $( VENV_PATH) ] || @PYTHON3@ -m venv --system-site-packages $( VENV_PATH)
2026-01-25 16:27:52 +01:00
# Install python3 dependencies, with explicit retry
$( VENV_PATH) /bin/pip3 install -r python-dev-requirements.txt || \
2025-12-14 12:18:32 +01:00
$( VENV_PATH) /bin/pip3 install -r python-dev-requirements.txt
@echo
@echo "Installed Python virtual environment, in:"
@echo " $( VENV_PATH) "
@echo "To activate, run:"
@echo " source $( VENV_PATH) /bin/activate "