>From `man iverilog-vpi`;
> iverilog-vpi is a tool to simplify the compilation of VPI modules for use
> with Icarus Verilog. It takes on the command line a list of C or C++ source
> files, and generates as output a linked VPI module.

Fixes https://github.com/m-labs/migen/issues/11
---
 vpi/Makefile | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/vpi/Makefile b/vpi/Makefile
index dc2fa02..54ab175 100644
--- a/vpi/Makefile
+++ b/vpi/Makefile
@@ -1,15 +1,17 @@
-INSTDIR=/usr/lib/ivl
-INCDIRS=-I/usr/include/iverilog
+INSTDIR = $(shell iverilog-vpi --install-dir)
+
+CFLAGS = -Wall -O2 $(CFLAGS_$@)
+VPI_CFLAGS := $(shell iverilog-vpi --cflags)
 
 OBJ=ipc.o main.o
 
 all: migensim.vpi
 
 %.o: %.c
-       $(CC) -fPIC -Wall -O2 -c $(INCDIRS) -o $@ $<
+       $(CC) $(CFLAGS) $(VPI_CFLAGS) -c $(INCDIRS) -o $@ $<
 
 migensim.vpi: $(OBJ)
-       $(CC) -shared -o $@ $(OBJ) -lvpi
+       iverilog-vpi --name=migensim $^
 
 install: migensim.vpi
        install -m755 -t $(INSTDIR) $^
-- 
2.2.0.rc0.207.ga3a616c

_______________________________________________
M-Labs devel mailing list
https://ssl.serverraum.org/lists/listinfo/devel

Reply via email to