88a55f87ea
ysyx_22040000 李心杨 Linux calcite 6.1.65 #1-NixOS SMP PREEMPT_DYNAMIC Sun Dec 3 06:32:13 UTC 2023 x86_64 GNU/Linux 20:21:56 up 23:19, 2 users, load average: 0.30, 0.29, 0.42
31 lines
736 B
Makefile
31 lines
736 B
Makefile
VSRC := $(wildcard vsrc/*.v)
|
|
CPPSRC := $(addprefix $(PWD)/,$(wildcard csrc/*.cpp))
|
|
PREFIX ?= build
|
|
OBJDIR := $(PREFIX)/obj
|
|
SUBMAKE := $(OBJDIR)/Vexample.mk
|
|
VERILATOR_FLAGS := --cc --exe
|
|
|
|
all: sim
|
|
|
|
sim: VERILATOR_FLAGS += --trace
|
|
sim: $(VSRC) $(CPPSRC) $(OBJDIR)/Vexample
|
|
$(call git_commit, "sim RTL") # DO NOT REMOVE THIS LINE!!!
|
|
@echo "Running" $(OBJDIR)/Vexample "..."
|
|
@echo "================================"
|
|
@$(OBJDIR)/Vexample
|
|
|
|
$(OBJDIR)/Vexample: $(SUBMAKE)
|
|
$(MAKE) -C $(OBJDIR) -f $(notdir $(SUBMAKE)) Vexample
|
|
|
|
$(SUBMAKE): $(VSRC) $(CPPSRC) $(OBJDIR)
|
|
verilator $(VERILATOR_FLAGS) --Mdir $(PWD)/$(OBJDIR) $(VSRC) $(CPPSRC)
|
|
|
|
$(OBJDIR):
|
|
mkdir -p $(OBJDIR)
|
|
|
|
include ../Makefile
|
|
|
|
.PHONY: clean
|
|
|
|
clean:
|
|
$(RM) -r $(OBJDIR)
|