From: Matt Johnston Date: Wed, 11 Aug 2021 07:17:39 +0000 (+0800) Subject: Makefile: detect when ghdl is a yosys plugin X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=2ec0d5fccda3f4d5cdf49cbf04236e6b1198a311;p=microwatt.git Makefile: detect when ghdl is a yosys plugin oss-cad-suite builds it as a plugin, some other toolchains have it built in. Signed-off-by: Matt Johnston --- diff --git a/Makefile b/Makefile index bbd3f46..0725755 100644 --- a/Makefile +++ b/Makefile @@ -6,7 +6,8 @@ VERILATOR_FLAGS=-O3 -Wno-fatal -Wno-CASEOVERLAP -Wno-UNOPTFLAT #--trace # It takes forever to build with optimisation, so disable by default #VERILATOR_CFLAGS=-O3 -GHDLSYNTH ?= ghdl.so +# some yosys builds have ghdl plugin built in, otherwise need "-m ghdl" +GHDLSYNTH ?= $(shell ($(YOSYS) -H | grep -q ghdl) || echo -m ghdl) YOSYS ?= yosys NEXTPNR ?= nextpnr-ecp5 ECPPACK ?= ecppack @@ -35,7 +36,7 @@ PWD = $(shell pwd) DOCKERARGS = run --rm -v $(PWD):/src:z -w /src GHDL = $(DOCKERBIN) $(DOCKERARGS) ghdl/ghdl:buster-llvm-7 ghdl CC = $(DOCKERBIN) $(DOCKERARGS) ghdl/ghdl:buster-llvm-7 gcc -GHDLSYNTH = ghdl +GHDLSYNTH = -m ghdl YOSYS = $(DOCKERBIN) $(DOCKERARGS) hdlc/ghdl:yosys yosys NEXTPNR = $(DOCKERBIN) $(DOCKERARGS) hdlc/nextpnr:ecp5 nextpnr-ecp5 ECPPACK = $(DOCKERBIN) $(DOCKERARGS) hdlc/prjtrellis ecppack @@ -211,10 +212,10 @@ fpga_files = fpga/soc_reset.vhdl \ synth_files = $(core_files) $(soc_files) $(fpga_files) $(clkgen) $(toplevel) $(dmi_dtm) microwatt.json: $(synth_files) $(RAM_INIT_FILE) - $(YOSYS) -m $(GHDLSYNTH) -p "ghdl --std=08 --no-formal $(GHDL_IMAGE_GENERICS) $(synth_files) -e toplevel; read_verilog $(uart_files); synth_ecp5 -abc9 -nowidelut -json $@ $(SYNTH_ECP5_FLAGS)" + $(YOSYS) $(GHDLSYNTH) -p "ghdl --std=08 --no-formal $(GHDL_IMAGE_GENERICS) $(synth_files) -e toplevel; read_verilog $(uart_files); synth_ecp5 -abc9 -nowidelut -json $@ $(SYNTH_ECP5_FLAGS)" microwatt.v: $(synth_files) $(RAM_INIT_FILE) - $(YOSYS) -m $(GHDLSYNTH) -p "ghdl --std=08 --no-formal $(GHDL_IMAGE_GENERICS) $(synth_files) -e toplevel; write_verilog $@" + $(YOSYS) $(GHDLSYNTH) -p "ghdl --std=08 --no-formal $(GHDL_IMAGE_GENERICS) $(synth_files) -e toplevel; write_verilog $@" microwatt-verilator: microwatt.v verilator/microwatt-verilator.cpp verilator/uart-verilator.c $(VERILATOR) $(VERILATOR_FLAGS) -CFLAGS "$(VERILATOR_CFLAGS) -DCLK_FREQUENCY=$(CLK_FREQUENCY)" -Iuart16550 --assert --cc --exe --build $^ -o $@ -top-module toplevel