2008-06-10 01:25:10 +00:00
|
|
|
# -*- Makefile -*-
|
2006-08-26 11:35:28 +00:00
|
|
|
######################################################################
|
|
|
|
# DESCRIPTION: Makefile commands for all verilated target files
|
|
|
|
#
|
2023-01-01 15:18:39 +00:00
|
|
|
# Copyright 2003-2023 by Wilson Snyder. This program is free software; you
|
2020-03-21 15:24:24 +00:00
|
|
|
# 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-License-Identifier: LGPL-3.0-only OR Artistic-2.0
|
2006-08-26 11:35:28 +00:00
|
|
|
######################################################################
|
|
|
|
|
2021-06-19 14:00:31 +00:00
|
|
|
AR = @AR@
|
2006-08-26 11:35:28 +00:00
|
|
|
CXX = @CXX@
|
|
|
|
LINK = @CXX@
|
2020-04-05 20:10:33 +00:00
|
|
|
OBJCACHE ?= @OBJCACHE@
|
2021-06-19 14:00:31 +00:00
|
|
|
PERL = @PERL@
|
|
|
|
PYTHON3 = @PYTHON3@
|
2006-08-26 11:35:28 +00:00
|
|
|
|
2011-10-07 10:48:40 +00:00
|
|
|
CFG_WITH_CCWARN = @CFG_WITH_CCWARN@
|
|
|
|
CFG_WITH_LONGTESTS = @CFG_WITH_LONGTESTS@
|
|
|
|
|
2021-07-07 23:12:52 +00:00
|
|
|
# Compiler flags to enable profiling
|
|
|
|
CFG_CXXFLAGS_PROFILE = @CFG_CXXFLAGS_PROFILE@
|
2023-01-22 14:44:50 +00:00
|
|
|
# Select language required to compile (often empty)
|
|
|
|
CFG_CXXFLAGS_STD = @CFG_CXXFLAGS_STD@
|
|
|
|
# Select newest language (unused by this Makefile, for some test's Makefiles)
|
2017-10-08 01:29:57 +00:00
|
|
|
CFG_CXXFLAGS_STD_NEWEST = @CFG_CXXFLAGS_STD_NEWEST@
|
2011-10-12 23:04:57 +00:00
|
|
|
# Compiler flags to use to turn off unused and generated code warnings, such as -Wno-div-by-zero
|
|
|
|
CFG_CXXFLAGS_NO_UNUSED = @CFG_CXXFLAGS_NO_UNUSED@
|
2017-09-15 03:28:02 +00:00
|
|
|
# Compiler flags that turn on extra warnings
|
|
|
|
CFG_CXXFLAGS_WEXTRA = @CFG_CXXFLAGS_WEXTRA@
|
Timing support (#3363)
Adds timing support to Verilator. It makes it possible to use delays,
event controls within processes (not just at the start), wait
statements, and forks.
Building a design with those constructs requires a compiler that
supports C++20 coroutines (GCC 10, Clang 5).
The basic idea is to have processes and tasks with delays/event controls
implemented as C++20 coroutines. This allows us to suspend and resume
them at any time.
There are five main runtime classes responsible for managing suspended
coroutines:
* `VlCoroutineHandle`, a wrapper over C++20's `std::coroutine_handle`
with move semantics and automatic cleanup.
* `VlDelayScheduler`, for coroutines suspended by delays. It resumes
them at a proper simulation time.
* `VlTriggerScheduler`, for coroutines suspended by event controls. It
resumes them if its corresponding trigger was set.
* `VlForkSync`, used for syncing `fork..join` and `fork..join_any`
blocks.
* `VlCoroutine`, the return type of all verilated coroutines. It allows
for suspending a stack of coroutines (normally, C++ coroutines are
stackless).
There is a new visitor in `V3Timing.cpp` which:
* scales delays according to the timescale,
* simplifies intra-assignment timing controls and net delays into
regular timing controls and assignments,
* simplifies wait statements into loops with event controls,
* marks processes and tasks with timing controls in them as
suspendable,
* creates delay, trigger scheduler, and fork sync variables,
* transforms timing controls and fork joins into C++ awaits
There are new functions in `V3SchedTiming.cpp` (used by `V3Sched.cpp`)
that integrate static scheduling with timing. This involves providing
external domains for variables, so that the necessary combinational
logic gets triggered after coroutine resumption, as well as statements
that need to be injected into the design eval function to perform this
resumption at the correct time.
There is also a function that transforms forked processes into separate
functions.
See the comments in `verilated_timing.h`, `verilated_timing.cpp`,
`V3Timing.cpp`, and `V3SchedTiming.cpp`, as well as the internals
documentation for more details.
Signed-off-by: Krzysztof Bieganski <kbieganski@antmicro.com>
2022-08-22 12:26:32 +00:00
|
|
|
# Compiler flags that enable coroutine support
|
|
|
|
CFG_CXXFLAGS_COROUTINES = @CFG_CXXFLAGS_COROUTINES@
|
2018-05-13 23:47:35 +00:00
|
|
|
# Linker libraries for multithreading
|
|
|
|
CFG_LDLIBS_THREADS = @CFG_LDLIBS_THREADS@
|
2011-10-12 23:04:57 +00:00
|
|
|
|
2006-08-26 11:35:28 +00:00
|
|
|
######################################################################
|
|
|
|
# Programs
|
|
|
|
|
2014-11-27 15:52:38 +00:00
|
|
|
VERILATOR_COVERAGE = $(PERL) $(VERILATOR_ROOT)/bin/verilator_coverage
|
2023-01-21 19:40:22 +00:00
|
|
|
VERILATOR_INCLUDER = $(PYTHON3) $(VERILATOR_ROOT)/bin/verilator_includer
|
2021-06-06 23:56:30 +00:00
|
|
|
VERILATOR_CCACHE_REPORT = $(PYTHON3) $(VERILATOR_ROOT)/bin/verilator_ccache_report
|
2006-08-26 11:35:28 +00:00
|
|
|
|
2010-10-28 13:51:36 +00:00
|
|
|
######################################################################
|
|
|
|
# Make checks
|
|
|
|
|
|
|
|
ifneq ($(words $(CURDIR)),1)
|
|
|
|
$(error Unsupported: GNU Make cannot build in directories containing spaces, build elsewhere: '$(CURDIR)')
|
|
|
|
endif
|
|
|
|
|
2022-12-20 16:17:43 +00:00
|
|
|
######################################################################
|
|
|
|
# OS detection
|
|
|
|
UNAME_S := $(shell uname -s)
|
|
|
|
|
2006-08-26 11:35:28 +00:00
|
|
|
######################################################################
|
|
|
|
# C Preprocessor flags
|
|
|
|
|
2006-08-31 15:29:15 +00:00
|
|
|
# Add -MMD -MP if you're using a recent version of GCC.
|
2006-08-26 11:35:28 +00:00
|
|
|
VK_CPPFLAGS_ALWAYS += \
|
|
|
|
-MMD \
|
|
|
|
-I$(VERILATOR_ROOT)/include \
|
2010-02-02 02:39:50 +00:00
|
|
|
-I$(VERILATOR_ROOT)/include/vltstd \
|
2008-09-17 15:11:24 +00:00
|
|
|
-DVM_COVERAGE=$(VM_COVERAGE) \
|
2016-08-23 22:05:29 +00:00
|
|
|
-DVM_SC=$(VM_SC) \
|
|
|
|
-DVM_TRACE=$(VM_TRACE) \
|
2020-10-11 01:17:39 +00:00
|
|
|
-DVM_TRACE_FST=$(VM_TRACE_FST) \
|
2022-05-20 15:02:43 +00:00
|
|
|
-DVM_TRACE_VCD=$(VM_TRACE_VCD) \
|
2014-09-12 01:28:53 +00:00
|
|
|
$(CFG_CXXFLAGS_NO_UNUSED) \
|
2006-08-26 11:35:28 +00:00
|
|
|
|
2023-01-30 03:39:22 +00:00
|
|
|
ifeq ($(CFG_WITH_CCWARN),yes) # Local... Else don't burden users
|
2017-09-15 03:28:02 +00:00
|
|
|
VK_CPPFLAGS_WALL += -Wall $(CFG_CXXFLAGS_WEXTRA) -Werror
|
2006-08-26 11:35:28 +00:00
|
|
|
endif
|
|
|
|
|
2014-09-12 01:28:53 +00:00
|
|
|
CPPFLAGS += -I. $(VK_CPPFLAGS_WALL) $(VK_CPPFLAGS_ALWAYS)
|
2006-08-26 11:35:28 +00:00
|
|
|
|
|
|
|
VPATH += ..
|
|
|
|
VPATH += $(VERILATOR_ROOT)/include
|
2010-02-02 02:39:50 +00:00
|
|
|
VPATH += $(VERILATOR_ROOT)/include/vltstd
|
2006-08-26 11:35:28 +00:00
|
|
|
|
2008-06-10 01:25:10 +00:00
|
|
|
#OPT = -ggdb -DPRINTINITSTR -DDETECTCHANGE
|
2006-08-26 11:35:28 +00:00
|
|
|
#OPT = -ggdb -DPRINTINITSTR
|
|
|
|
CPPFLAGS += $(OPT)
|
|
|
|
|
2006-11-02 19:13:07 +00:00
|
|
|
CPPFLAGS += $(M32)
|
2007-04-19 18:39:47 +00:00
|
|
|
LDFLAGS += $(M32)
|
|
|
|
|
2022-12-20 16:17:43 +00:00
|
|
|
# On macOS, specify all weak symbols as dynamic_lookup.
|
|
|
|
# Otherwise, you get undefined symbol errors.
|
|
|
|
ifeq ($(UNAME_S),Darwin)
|
|
|
|
LDFLAGS += -Wl,-U,__Z15vl_time_stamp64v,-U,__Z13sc_time_stampv
|
|
|
|
endif
|
|
|
|
|
2007-04-19 18:39:47 +00:00
|
|
|
# Allow upper level user makefiles to specify flags they want.
|
|
|
|
# These aren't ever set by Verilator, so users are free to override them.
|
|
|
|
CPPFLAGS += $(USER_CPPFLAGS)
|
|
|
|
LDFLAGS += $(USER_LDFLAGS)
|
2010-01-30 15:05:21 +00:00
|
|
|
LDLIBS += $(USER_LDLIBS)
|
|
|
|
|
|
|
|
# Add flags from -CFLAGS and -LDFLAGS on Verilator command line
|
|
|
|
CPPFLAGS += $(VM_USER_CFLAGS)
|
|
|
|
LDFLAGS += $(VM_USER_LDFLAGS)
|
|
|
|
LDLIBS += $(VM_USER_LDLIBS)
|
2006-11-02 19:13:07 +00:00
|
|
|
|
2020-05-27 23:57:49 +00:00
|
|
|
######################################################################
|
|
|
|
# Optimization control.
|
|
|
|
|
|
|
|
# See also the BENCHMARKING & OPTIMIZATION section of the manual.
|
|
|
|
|
|
|
|
# Optimization flags for non performance-critical/rarely executed code.
|
|
|
|
# No optimization by default, which improves compilation speed.
|
|
|
|
OPT_SLOW =
|
|
|
|
# Optimization for performance critical/hot code. Most time is spent in these
|
|
|
|
# routines. Optimizing by default for improved execution speed.
|
|
|
|
OPT_FAST = -Os
|
2020-05-27 00:52:08 +00:00
|
|
|
# Optimization applied to the common run-time library used by verilated models.
|
|
|
|
# For compatibility this is called OPT_GLOBAL even though it only applies to
|
|
|
|
# files in the run-time library. Normally there should be no need for the user
|
2020-05-27 23:57:49 +00:00
|
|
|
# to change this as the library is small, but can have significant speed impact.
|
2020-05-27 00:52:08 +00:00
|
|
|
OPT_GLOBAL = -Os
|
2006-08-26 11:35:28 +00:00
|
|
|
|
2021-07-07 23:12:52 +00:00
|
|
|
#######################################################################
|
|
|
|
##### Profile builds
|
|
|
|
|
|
|
|
ifeq ($(VM_PROFC),1)
|
|
|
|
CPPFLAGS += $(CFG_CXXFLAGS_PROFILE)
|
|
|
|
LDFLAGS += $(CFG_CXXFLAGS_PROFILE)
|
|
|
|
endif
|
|
|
|
|
2006-08-26 11:35:28 +00:00
|
|
|
#######################################################################
|
2017-09-08 01:08:49 +00:00
|
|
|
##### SystemC builds
|
2006-08-26 11:35:28 +00:00
|
|
|
|
2017-09-08 01:08:49 +00:00
|
|
|
ifeq ($(VM_SC),1)
|
2020-05-28 22:51:46 +00:00
|
|
|
CPPFLAGS += $(SYSTEMC_CXX_FLAGS) $(addprefix -I, $(SYSTEMC_INCLUDE))
|
|
|
|
LDFLAGS += $(SYSTEMC_CXX_FLAGS) $(addprefix -L, $(SYSTEMC_LIBDIR))
|
2006-08-26 11:35:28 +00:00
|
|
|
SC_LIBS = -lsystemc
|
2012-01-20 01:30:41 +00:00
|
|
|
ifneq ($(wildcard $(SYSTEMC_LIBDIR)/*numeric_bit*),)
|
2006-08-26 11:35:28 +00:00
|
|
|
# Systemc 1.2.1beta
|
|
|
|
SC_LIBS += -lnumeric_bit -lqt
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
2017-10-21 20:41:43 +00:00
|
|
|
#######################################################################
|
|
|
|
##### Threaded builds
|
|
|
|
|
2023-01-22 14:44:50 +00:00
|
|
|
CPPFLAGS += $(CFG_CXXFLAGS_STD)
|
2022-11-05 12:47:34 +00:00
|
|
|
LDLIBS += $(CFG_LDLIBS_THREADS)
|
2019-05-03 00:33:05 +00:00
|
|
|
|
Timing support (#3363)
Adds timing support to Verilator. It makes it possible to use delays,
event controls within processes (not just at the start), wait
statements, and forks.
Building a design with those constructs requires a compiler that
supports C++20 coroutines (GCC 10, Clang 5).
The basic idea is to have processes and tasks with delays/event controls
implemented as C++20 coroutines. This allows us to suspend and resume
them at any time.
There are five main runtime classes responsible for managing suspended
coroutines:
* `VlCoroutineHandle`, a wrapper over C++20's `std::coroutine_handle`
with move semantics and automatic cleanup.
* `VlDelayScheduler`, for coroutines suspended by delays. It resumes
them at a proper simulation time.
* `VlTriggerScheduler`, for coroutines suspended by event controls. It
resumes them if its corresponding trigger was set.
* `VlForkSync`, used for syncing `fork..join` and `fork..join_any`
blocks.
* `VlCoroutine`, the return type of all verilated coroutines. It allows
for suspending a stack of coroutines (normally, C++ coroutines are
stackless).
There is a new visitor in `V3Timing.cpp` which:
* scales delays according to the timescale,
* simplifies intra-assignment timing controls and net delays into
regular timing controls and assignments,
* simplifies wait statements into loops with event controls,
* marks processes and tasks with timing controls in them as
suspendable,
* creates delay, trigger scheduler, and fork sync variables,
* transforms timing controls and fork joins into C++ awaits
There are new functions in `V3SchedTiming.cpp` (used by `V3Sched.cpp`)
that integrate static scheduling with timing. This involves providing
external domains for variables, so that the necessary combinational
logic gets triggered after coroutine resumption, as well as statements
that need to be injected into the design eval function to perform this
resumption at the correct time.
There is also a function that transforms forked processes into separate
functions.
See the comments in `verilated_timing.h`, `verilated_timing.cpp`,
`V3Timing.cpp`, and `V3SchedTiming.cpp`, as well as the internals
documentation for more details.
Signed-off-by: Krzysztof Bieganski <kbieganski@antmicro.com>
2022-08-22 12:26:32 +00:00
|
|
|
ifneq ($(VM_TIMING),0)
|
|
|
|
ifneq ($(VM_TIMING),)
|
|
|
|
CPPFLAGS += $(CFG_CXXFLAGS_COROUTINES)
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
2017-10-21 20:41:43 +00:00
|
|
|
|
2006-08-26 11:35:28 +00:00
|
|
|
#######################################################################
|
2020-05-25 10:35:06 +00:00
|
|
|
### Aggregates
|
2017-09-08 01:08:49 +00:00
|
|
|
|
2020-05-25 10:35:06 +00:00
|
|
|
VM_FAST += $(VM_CLASSES_FAST) $(VM_SUPPORT_FAST)
|
|
|
|
VM_SLOW += $(VM_CLASSES_SLOW) $(VM_SUPPORT_SLOW)
|
2006-08-26 11:35:28 +00:00
|
|
|
|
|
|
|
#######################################################################
|
2020-05-25 10:35:06 +00:00
|
|
|
### Overall Objects Linking
|
2006-08-26 11:35:28 +00:00
|
|
|
|
2020-05-25 10:35:06 +00:00
|
|
|
VK_FAST_OBJS = $(addsuffix .o, $(VM_FAST))
|
|
|
|
VK_SLOW_OBJS = $(addsuffix .o, $(VM_SLOW))
|
2006-08-26 11:35:28 +00:00
|
|
|
|
2022-07-04 17:20:03 +00:00
|
|
|
VK_USER_OBJS = $(addsuffix .o, $(VM_USER_CLASSES))
|
2006-08-26 11:35:28 +00:00
|
|
|
|
2020-05-27 00:52:08 +00:00
|
|
|
# Note VM_GLOBAL_FAST and VM_GLOBAL_SLOW holds the files required from the
|
|
|
|
# run-time library. In practice everything is actually in VM_GLOBAL_FAST,
|
|
|
|
# but keeping the distinction for compatibility for now.
|
2009-12-03 02:15:56 +00:00
|
|
|
VK_GLOBAL_OBJS = $(addsuffix .o, $(VM_GLOBAL_FAST) $(VM_GLOBAL_SLOW))
|
|
|
|
|
2022-03-26 21:29:03 +00:00
|
|
|
# Need to re-build if the generated makefile changes, as compiler options might
|
|
|
|
# have changed.
|
|
|
|
$(VK_GLOBAL_OBJS): $(VM_PREFIX).mk
|
|
|
|
|
2015-01-17 18:31:27 +00:00
|
|
|
ifneq ($(VM_PARALLEL_BUILDS),1)
|
2020-05-25 10:35:06 +00:00
|
|
|
# Fast build for small designs: All .cpp files in one fell swoop. This
|
|
|
|
# saves total compute, but can be slower if only a little changes. It is
|
|
|
|
# also a lot slower for medium to large designs when the speed of the C
|
|
|
|
# compiler dominates, which in this mode is not parallelizable.
|
|
|
|
|
|
|
|
VK_OBJS += $(VM_PREFIX)__ALL.o
|
|
|
|
$(VM_PREFIX)__ALL.cpp: $(addsuffix .cpp, $(VM_FAST) $(VM_SLOW))
|
2014-11-27 15:52:38 +00:00
|
|
|
$(VERILATOR_INCLUDER) -DVL_INCLUDE_OPT=include $^ > $@
|
2020-05-25 10:35:06 +00:00
|
|
|
all_cpp: $(VM_PREFIX)__ALL.cpp
|
2006-08-26 11:35:28 +00:00
|
|
|
else
|
2020-05-25 10:35:06 +00:00
|
|
|
# Parallel build: Each .cpp file by itself. This can be somewhat slower for
|
|
|
|
# very small designs and examples, but is a lot faster for large designs.
|
|
|
|
|
|
|
|
VK_OBJS += $(VK_FAST_OBJS) $(VK_SLOW_OBJS)
|
2006-08-26 11:35:28 +00:00
|
|
|
endif
|
|
|
|
|
2021-03-13 20:09:10 +00:00
|
|
|
# When archiving just objects (.o), use single $(AR) run
|
2021-05-06 16:07:15 +00:00
|
|
|
# 1. Make .verilator_deplist.tmp file with list of objects so don't exceed
|
|
|
|
# the command line limits when calling $(AR).
|
|
|
|
# The approach to write the dependency file is compatible with GNU Make 3,
|
|
|
|
# and can be simplified using the file function once GNU Make 4.x becomes
|
|
|
|
# the minimum supported version.
|
2021-03-13 20:09:10 +00:00
|
|
|
# When merging objects (.o) and archives (.a) additionally:
|
2020-08-26 22:52:48 +00:00
|
|
|
# 1. Extract object files from .a
|
|
|
|
# 2. Create a new archive from extracted .o and given .o
|
2021-05-06 16:07:15 +00:00
|
|
|
%.a: | %.verilator_deplist.tmp
|
2021-03-13 20:09:10 +00:00
|
|
|
$(info Archive $(AR) -rcs $@ $^)
|
2021-05-06 16:07:15 +00:00
|
|
|
$(foreach L, $(filter-out %.a,$^), $(shell echo $L >>$@.verilator_deplist.tmp))
|
2021-03-20 00:58:42 +00:00
|
|
|
@if test $(words $(filter %.a,$^)) -eq 0; then \
|
2022-01-17 19:04:43 +00:00
|
|
|
$(RM) -f $@; \
|
|
|
|
cat $@.verilator_deplist.tmp | xargs $(AR) -rc $@; \
|
|
|
|
$(AR) -s $@; \
|
2020-08-15 13:43:53 +00:00
|
|
|
else \
|
2021-03-13 20:09:10 +00:00
|
|
|
$(RM) -rf $@.tmpdir; \
|
2020-08-26 22:52:48 +00:00
|
|
|
for archive in $(filter %.a,$^); do \
|
2021-03-13 20:09:10 +00:00
|
|
|
mkdir -p $@.tmpdir/$$(basename $${archive}); \
|
|
|
|
cd $@.tmpdir/$$(basename $${archive}); \
|
2020-08-26 22:52:48 +00:00
|
|
|
$(AR) -x ../../$${archive}; \
|
|
|
|
cd ../..; \
|
|
|
|
done; \
|
2022-01-17 19:04:43 +00:00
|
|
|
$(RM) -f $@; \
|
|
|
|
cat $@.verilator_deplist.tmp | xargs $(AR) -rc $@; \
|
|
|
|
$(AR) -rcs $@ $@.tmpdir/*/*.o; \
|
2021-03-13 20:09:10 +00:00
|
|
|
fi \
|
2021-05-06 16:07:15 +00:00
|
|
|
; $(RM) -rf $@.verilator_deplist.tmp $@.tmpdir
|
|
|
|
|
|
|
|
# Truncate the dependency list file used in the %.a target above.
|
|
|
|
%.verilator_deplist.tmp:
|
|
|
|
echo "" > $@
|
2020-08-15 13:43:53 +00:00
|
|
|
|
|
|
|
$(VM_PREFIX)__ALL.a: $(VK_OBJS) $(VM_HIER_LIBS)
|
|
|
|
|
2006-08-26 11:35:28 +00:00
|
|
|
|
|
|
|
######################################################################
|
|
|
|
### Compile rules
|
|
|
|
|
2016-09-19 23:31:09 +00:00
|
|
|
ifneq ($(VM_DEFAULT_RULES),0)
|
2020-05-27 00:52:08 +00:00
|
|
|
# Anything not in $(VK_SLOW_OBJS) or $(VK_GLOBAL_OBJS), including verilated.o
|
|
|
|
# and user files passed on the Verilator command line use this rule.
|
2018-11-30 01:35:21 +00:00
|
|
|
%.o: %.cpp
|
2006-08-26 11:35:28 +00:00
|
|
|
$(OBJCACHE) $(CXX) $(CXXFLAGS) $(CPPFLAGS) $(OPT_FAST) -c -o $@ $<
|
|
|
|
|
2020-05-25 10:35:06 +00:00
|
|
|
$(VK_SLOW_OBJS): %.o: %.cpp
|
2016-09-19 23:31:09 +00:00
|
|
|
$(OBJCACHE) $(CXX) $(CXXFLAGS) $(CPPFLAGS) $(OPT_SLOW) -c -o $@ $<
|
2020-05-27 00:52:08 +00:00
|
|
|
|
|
|
|
$(VK_GLOBAL_OBJS): %.o: %.cpp
|
|
|
|
$(OBJCACHE) $(CXX) $(CXXFLAGS) $(CPPFLAGS) $(OPT_GLOBAL) -c -o $@ $<
|
2016-09-19 23:31:09 +00:00
|
|
|
endif
|
|
|
|
|
|
|
|
#Default rule embedded in make:
|
|
|
|
#.cpp.o:
|
|
|
|
# $(CXX) $(CXXFLAGS) $(CPPFLAGS) -c -o $@ $<
|
|
|
|
|
2021-06-06 23:56:30 +00:00
|
|
|
######################################################################
|
|
|
|
### ccache report
|
|
|
|
|
|
|
|
ifneq ($(findstring ccache-report,$(MAKECMDGOALS)),)
|
|
|
|
ifneq ($(OBJCACHE),ccache)
|
|
|
|
$(error ccache-report requires OBJCACHE to equal 'ccache')
|
|
|
|
endif
|
|
|
|
VK_OTHER_GOALS := $(strip $(subst ccache-report,,$(MAKECMDGOALS)))
|
|
|
|
ifeq ($(VK_OTHER_GOALS),)
|
|
|
|
$(error ccache-report must be used with at least one other explicit target)
|
|
|
|
endif
|
|
|
|
|
|
|
|
# Report ccache behaviour for this invocation of make
|
2021-06-09 17:26:29 +00:00
|
|
|
VK_CCACHE_LOGDIR := ccache-logs
|
2021-06-06 23:56:30 +00:00
|
|
|
VK_CCACHE_REPORT := $(VM_PREFIX)__ccache_report.txt
|
2021-06-09 17:26:29 +00:00
|
|
|
# Remove previous logfiles and report
|
|
|
|
$(shell rm -rf $(VK_CCACHE_LOGDIR) $(VK_CCACHE_REPORT))
|
|
|
|
|
|
|
|
$(VK_CCACHE_LOGDIR):
|
|
|
|
mkdir -p $@
|
|
|
|
|
|
|
|
$(VK_OBJS): | $(VK_CCACHE_LOGDIR)
|
|
|
|
|
|
|
|
$(VK_OBJS): export CCACHE_LOGFILE=$(VK_CCACHE_LOGDIR)/$@.log
|
2021-06-06 23:56:30 +00:00
|
|
|
|
|
|
|
$(VK_CCACHE_REPORT): $(VK_OBJS)
|
2021-06-09 17:26:29 +00:00
|
|
|
$(VERILATOR_CCACHE_REPORT) -o $@ $(VK_CCACHE_LOGDIR)
|
2021-06-06 23:56:30 +00:00
|
|
|
|
|
|
|
.PHONY: ccache-report
|
|
|
|
ccache-report: $(VK_CCACHE_REPORT)
|
|
|
|
@cat $<
|
|
|
|
|
|
|
|
# ccache-report runs last
|
|
|
|
ccache-report: $(VK_OTHER_GOALS)
|
|
|
|
endif
|
|
|
|
|
2006-08-26 11:35:28 +00:00
|
|
|
######################################################################
|
|
|
|
### Debugging
|
|
|
|
|
2009-12-03 02:15:56 +00:00
|
|
|
debug-make::
|
2006-08-26 11:35:28 +00:00
|
|
|
@echo
|
2018-11-30 01:35:21 +00:00
|
|
|
@echo CXXFLAGS: $(CXXFLAGS)
|
2018-04-13 02:00:34 +00:00
|
|
|
@echo CPPFLAGS: $(CPPFLAGS)
|
2018-11-30 01:35:21 +00:00
|
|
|
@echo OPT_FAST: $(OPT_FAST)
|
|
|
|
@echo OPT_SLOW: $(OPT_SLOW)
|
2006-08-26 11:35:28 +00:00
|
|
|
@echo VM_PREFIX: $(VM_PREFIX)
|
2018-04-13 02:00:34 +00:00
|
|
|
@echo VM_PARALLEL_BUILDS: $(VM_PARALLEL_BUILDS)
|
2006-08-26 11:35:28 +00:00
|
|
|
@echo VM_CLASSES_FAST: $(VM_CLASSES_FAST)
|
|
|
|
@echo VM_CLASSES_SLOW: $(VM_CLASSES_SLOW)
|
|
|
|
@echo VM_SUPPORT_FAST: $(VM_SUPPORT_FAST)
|
|
|
|
@echo VM_SUPPORT_SLOW: $(VM_SUPPORT_SLOW)
|
2009-12-03 02:15:56 +00:00
|
|
|
@echo VM_GLOBAL_FAST: $(VM_GLOBAL_FAST)
|
|
|
|
@echo VM_GLOBAL_SLOW: $(VM_GLOBAL_SLOW)
|
2018-04-13 02:00:34 +00:00
|
|
|
@echo VK_OBJS: $(VK_OBJS)
|
2006-08-26 11:35:28 +00:00
|
|
|
@echo
|
|
|
|
|
|
|
|
######################################################################
|
|
|
|
### Detect out of date files and rebuild.
|
|
|
|
|
|
|
|
DEPS := $(wildcard *.d)
|
|
|
|
ifneq ($(DEPS),)
|
|
|
|
include $(DEPS)
|
|
|
|
endif
|