2008-06-10 01:25:10 +00:00
|
|
|
# -*- Makefile -*-
|
2006-08-26 11:35:28 +00:00
|
|
|
#*****************************************************************************
|
|
|
|
#
|
|
|
|
# DESCRIPTION: Verilator: Makefile for verilog source
|
|
|
|
#
|
2019-11-08 03:33:59 +00:00
|
|
|
# Code available from: https://verilator.org
|
2006-08-26 11:35:28 +00:00
|
|
|
#
|
|
|
|
#*****************************************************************************
|
|
|
|
#
|
2020-01-06 23:05:53 +00:00
|
|
|
# Copyright 2003-2020 by Wilson Snyder. This program is free software; you can
|
2006-08-26 11:35:28 +00:00
|
|
|
# redistribute it and/or modify it under the terms of either the GNU
|
2009-05-04 21:07:57 +00:00
|
|
|
# Lesser General Public License Version 3 or the Perl Artistic License
|
|
|
|
# Version 2.0.
|
2006-08-26 11:35:28 +00:00
|
|
|
#
|
|
|
|
# Verilator 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 General Public License for more details.
|
|
|
|
#
|
|
|
|
#****************************************************************************/
|
|
|
|
|
|
|
|
#### Start of system configuration section. ####
|
|
|
|
|
|
|
|
srcdir = @srcdir@
|
|
|
|
PERL = @PERL@
|
2011-10-05 21:07:10 +00:00
|
|
|
EXEEXT = @EXEEXT@
|
2018-08-25 11:55:48 +00:00
|
|
|
# VPATH only does sources; fix install_test's not creating ../bin
|
|
|
|
vpath %.h @srcdir@
|
2006-08-26 11:35:28 +00:00
|
|
|
|
|
|
|
#### End of system configuration section. ####
|
|
|
|
|
|
|
|
|
|
|
|
default: dbg opt
|
|
|
|
debug: dbg
|
|
|
|
optimize: opt
|
|
|
|
|
2010-10-28 13:51:36 +00:00
|
|
|
ifneq ($(words $(CURDIR)),1)
|
|
|
|
$(error Unsupported: GNU Make cannot build in directories containing spaces, build elsewhere: '$(CURDIR)')
|
|
|
|
endif
|
|
|
|
|
2011-10-05 22:36:44 +00:00
|
|
|
UNDER_GIT = $(wildcard ${srcdir}/../.git/logs/HEAD)
|
2008-07-14 14:48:57 +00:00
|
|
|
|
|
|
|
#*********************************************************************
|
|
|
|
|
2006-08-26 11:35:28 +00:00
|
|
|
obj_opt:
|
2018-08-25 11:55:48 +00:00
|
|
|
mkdir -p $@
|
2006-08-26 11:35:28 +00:00
|
|
|
obj_dbg:
|
2018-08-25 11:55:48 +00:00
|
|
|
mkdir -p $@
|
|
|
|
../bin:
|
|
|
|
mkdir -p $@
|
2006-08-26 11:35:28 +00:00
|
|
|
|
2015-11-28 22:33:01 +00:00
|
|
|
.SUFFIXES:
|
|
|
|
|
2017-10-14 20:01:27 +00:00
|
|
|
.PHONY: ../bin/verilator_bin ../bin/verilator_bin_dbg ../bin/verilator_coverage_bin_dbg
|
2006-08-26 11:35:28 +00:00
|
|
|
|
2017-10-14 20:01:27 +00:00
|
|
|
opt: ../bin/verilator_bin
|
2006-08-26 11:35:28 +00:00
|
|
|
ifeq ($(VERILATOR_NO_OPT_BUILD),1) # Faster laptop development... One build
|
2018-08-25 17:11:28 +00:00
|
|
|
../bin/verilator_bin: ../bin/verilator_bin_dbg
|
2010-02-04 13:15:33 +00:00
|
|
|
-rm -rf $@ $@.exe
|
2011-10-05 21:07:10 +00:00
|
|
|
-cp -p $<$(EXEEXT) $@$(EXEEXT)
|
2006-08-26 11:35:28 +00:00
|
|
|
else
|
2018-08-25 11:55:48 +00:00
|
|
|
../bin/verilator_bin: obj_opt ../bin prefiles
|
|
|
|
$(MAKE) -C obj_opt -j 1 TGT=../$@ -f ../Makefile_obj serial
|
|
|
|
$(MAKE) -C obj_opt TGT=../$@ -f ../Makefile_obj
|
2006-08-26 11:35:28 +00:00
|
|
|
endif
|
|
|
|
|
2017-10-14 20:01:27 +00:00
|
|
|
dbg: ../bin/verilator_bin_dbg ../bin/verilator_coverage_bin_dbg
|
2018-08-25 11:55:48 +00:00
|
|
|
../bin/verilator_bin_dbg: obj_dbg ../bin prefiles
|
|
|
|
$(MAKE) -C obj_dbg -j 1 TGT=../$@ VL_DEBUG=1 -f ../Makefile_obj serial
|
|
|
|
$(MAKE) -C obj_dbg TGT=../$@ VL_DEBUG=1 -f ../Makefile_obj
|
2006-08-26 11:35:28 +00:00
|
|
|
|
2018-08-25 11:55:48 +00:00
|
|
|
../bin/verilator_coverage_bin_dbg: obj_dbg ../bin prefiles
|
|
|
|
$(MAKE) -C obj_dbg TGT=../$@ VL_DEBUG=1 VL_VLCOV=1 -f ../Makefile_obj serial_vlcov
|
|
|
|
$(MAKE) -C obj_dbg TGT=../$@ VL_DEBUG=1 VL_VLCOV=1 -f ../Makefile_obj
|
2014-11-24 02:06:10 +00:00
|
|
|
|
2006-08-26 11:35:28 +00:00
|
|
|
prefiles::
|
|
|
|
prefiles:: config_rev.h
|
2012-07-22 23:51:14 +00:00
|
|
|
ifneq ($(UNDER_GIT),) # If local git tree... Else don't burden users
|
2011-10-05 22:36:44 +00:00
|
|
|
# This output goes into srcdir if locally configured, as we need to distribute it as part of the kit.
|
|
|
|
config_rev.h: ${srcdir}/config_rev.pl ${srcdir}/../.git/logs/HEAD
|
|
|
|
$(PERL) ${srcdir}/config_rev.pl ${srcdir} >$@
|
2012-07-22 23:51:14 +00:00
|
|
|
else
|
|
|
|
config_rev.h: ${srcdir}/config_rev.pl
|
|
|
|
$(PERL) ${srcdir}/config_rev.pl ${srcdir} >$@
|
2006-08-26 11:35:28 +00:00
|
|
|
endif
|
|
|
|
|
|
|
|
maintainer-copy::
|
|
|
|
clean mostlyclean distclean maintainer-clean::
|
|
|
|
-rm -rf obj_* *.log *.dmp *.vpd core
|
|
|
|
-rm -f *.o *.d perlxsi.c *_gen_*
|
|
|
|
-rm -f *__gen*
|
|
|
|
-rm -f .objcache*
|
2006-09-25 15:58:17 +00:00
|
|
|
|
|
|
|
distclean maintainer-clean::
|
2006-12-18 19:20:45 +00:00
|
|
|
-rm -f Makefile Makefile_obj config_build.h
|
2011-10-05 22:36:44 +00:00
|
|
|
|
|
|
|
maintainer-clean::
|
|
|
|
-rm -f config_rev.h
|