What is a Makefile?

A Makefile is a special text file used to tell a computer how to build or compile a program from its source code. It contains a list of rules that define the relationships between different files and the commands needed to create the final executable or output.

When you run the "make" command in the terminal or command prompt, it reads the Makefile and follows the instructions to build the program step by step. If any changes are made to the source code files, "make" will only recompile the necessary parts, saving time and avoiding unnecessary work.

A simple Linux Makefile has been provided to help run the testbench code which you have been reading so far.

Code
TESTNAME?=sample_sanity_test
FILENAME?=top_tb.sv

# Labels
# ------
all: clean qv

# Cleaning all the generated run files ( cleaning database )
# ----------------------------------------------------------
clean:
    rm -rf qverilog.* *.log work vsim*;

# For the Qverilog Command
# --------------------------------------------
qv:
    qverilog \
    -64 \
    +acc \
    -l compile.log \
    -sv \
    +incdir+$(UVM_HOME) \
    +incdir+./ \
    +define+UVM_NO_DPI \
    +UVM_TESTNAME="$(TESTNAME)" \
    $(FILENAME);

qvc: clean qv