ID photo of Ciro Santilli taken in 2013 right eyeCiro Santilli OurBigBook logoOurBigBook.com  Sponsor 中国独裁统治 China Dictatorship 新疆改造中心、六四事件、法轮功、郝海东、709大抓捕、2015巴拿马文件 邓家贵、低端人口、西藏骚乱
verilog/Makefile
.POSIX:

-include params.makefile

VERILATOR_IN_EXT ?= .cpp
VERILATOR_OUT_DIR ?= obj_dir/
VERILATOR_OUTS := $(addprefix $(VERILATOR_OUT_DIR)V, $(basename $(wildcard *$(VERILATOR_IN_EXT))))

.PHONY: all all-verilator clean run run-verilator

all: $(VERILATOR_OUTS)

# -f is mainly for -G parameters, which must be known at compile time and cannot be set from C:
# https://www.veripool.org/boards/2/topics/276-Verilator-Efficient-Usage-of-Verilog-Parameters
$(VERILATOR_OUT_DIR)V%: %$(VERILATOR_IN_EXT) %.v
	verilator -CFLAGS "-ggdb3 --std=c++11" --cc '$(basename $<)'.v --exe -f $(basename $<).params --trace '$<'
	make -C '$(VERILATOR_OUT_DIR)' -f V$(basename $<).mk -j"$$(($$(nproc) - 2))" V$(basename $<)

clean:
	git clean -Xdf .

run: run-verilator

run-verilator: $(VERILATOR_OUTS)
	./run-many run-verilator-one $^

run-verilator-%: $(VERILATOR_OUT_DIR)V%
	./run-verilator-one '$<'