aboutsummaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2019-08-15 05:52:40 +0200
committerTristan Gingold <tgingold@free.fr>2019-08-15 05:52:40 +0200
commitd9ce5d06ecefc5cd3c3a8cbd6cb77afcee5185e9 (patch)
tree61a0bbe6e903b9073d89982a83317425c1346d41 /Makefile
parent3dad306e1d7159b21dbd2aeadae016b634d26692 (diff)
downloadghdl-yosys-plugin-d9ce5d06ecefc5cd3c3a8cbd6cb77afcee5185e9.tar.gz
ghdl-yosys-plugin-d9ce5d06ecefc5cd3c3a8cbd6cb77afcee5185e9.tar.bz2
ghdl-yosys-plugin-d9ce5d06ecefc5cd3c3a8cbd6cb77afcee5185e9.zip
Use libghdl to build the module. Update instructions.
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile18
1 files changed, 8 insertions, 10 deletions
diff --git a/Makefile b/Makefile
index 72c297e..9973d52 100644
--- a/Makefile
+++ b/Makefile
@@ -1,12 +1,7 @@
# Build ghdl module for yosys
-# Prefix where ghdl has been installed
-GHDL_PREFIX=
-
-# GHDL_PREFIX must be defined.
-ifeq ($(GHDL_PREFIX),)
-$(error GHDL_PREFIX not defined)
-endif
+# Name or path to the ghdl executable.
+GHDL=ghdl
YOSYS_CONFIG=yosys-config
SOEXT=so
@@ -14,16 +9,19 @@ SOEXT=so
LDFLAGS=
CFLAGS=-O
-ALL_LDFLAGS=$(GHDL_PREFIX)/lib/libghdl-*.so -Wl,-rpath,$(GHDL_PREFIX)/lib $(LDFLAGS)
+LIBGHDL_LIB:=$(shell $(GHDL) --libghdl-library-path)
+LIBGHDL_INC:=$(shell $(GHDL) --libghdl-include-dir)
+
+ALL_LDFLAGS=$(LIBGHDL_LIB) -Wl,-rpath,$(dir $(LIBGHDL_LIB)) $(LDFLAGS)
-ALL_CFLAGS=-fPIC -DYOSYS_ENABLE_GHDL -I$(GHDL_PREFIX)/include $(CFLAGS)
+ALL_CFLAGS=-fPIC -DYOSYS_ENABLE_GHDL -I$(LIBGHDL_INC) $(CFLAGS)
COMPILE=$(YOSYS_CONFIG) --exec --cxx
all: ghdl.$(SOEXT)
ghdl.$(SOEXT): ghdl.o
- $(COMPILE) -o $@ -shared $< -shared $(ALL_LDFLAGS) --ldflags --ldlibs
+ $(COMPILE) -o $@ -shared $< $(ALL_LDFLAGS) --ldflags --ldlibs
ghdl.o: ghdl/ghdl.cc
$(COMPILE) -c --cxxflags -o $@ $< $(ALL_CFLAGS)