aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2021-10-03 10:05:22 +0200
committerTristan Gingold <tgingold@free.fr>2021-10-03 10:05:50 +0200
commiteab9f4d6846eefb0bf791162705c7a559793da1c (patch)
treeff9d45b63ffe9a26ef291b69785042accee4c09a
parent09b916cff7b5daf9cc9e39f67156198f4fbf4836 (diff)
downloadghdl-yosys-plugin-eab9f4d6846eefb0bf791162705c7a559793da1c.tar.gz
ghdl-yosys-plugin-eab9f4d6846eefb0bf791162705c7a559793da1c.tar.bz2
ghdl-yosys-plugin-eab9f4d6846eefb0bf791162705c7a559793da1c.zip
ghdl.cc: display compile date and git hash
-rw-r--r--Makefile4
-rw-r--r--src/ghdl.cc5
2 files changed, 8 insertions, 1 deletions
diff --git a/Makefile b/Makefile
index a384ecf..589a5b0 100644
--- a/Makefile
+++ b/Makefile
@@ -15,13 +15,15 @@ ALL_LDFLAGS=$(LIBGHDL_LIB) -Wl,-rpath,$(dir $(LIBGHDL_LIB)) $(LDFLAGS)
ALL_CFLAGS=-fPIC -DYOSYS_ENABLE_GHDL -I$(LIBGHDL_INC) $(CFLAGS)
+VER_HASH=$(shell git rev-parse --short HEAD || echo "unknown")
+
all: ghdl.$(SOEXT)
ghdl.$(SOEXT): ghdl.o
$(YOSYS_CONFIG) --build $@ $< -shared $(ALL_LDFLAGS)
ghdl.o: src/ghdl.cc
- $(YOSYS_CONFIG) --exec --cxx -c --cxxflags -o $@ $< $(ALL_CFLAGS)
+ $(YOSYS_CONFIG) --exec --cxx -c --cxxflags -o $@ $< $(ALL_CFLAGS) -DGHDL_VER_HASH="\"$(VER_HASH)\""
clean: force
$(RM) -f ghdl.$(SOEXT) ghdl.o
diff --git a/src/ghdl.cc b/src/ghdl.cc
index 7b36042..3d5bfc4 100644
--- a/src/ghdl.cc
+++ b/src/ghdl.cc
@@ -1272,6 +1272,11 @@ struct GhdlPass : public Pass {
if (args.size() == 2 && args[1] == "--disp-config") {
ghdlcomp__disp_config();
+ log("yosys plugin compiled on " __DATE__ " " __TIME__
+#ifdef GHDL_VER_HASH
+ ", git hash:" GHDL_VER_HASH
+#endif
+ "\n");
}
else {
int cmd_argc = args.size() - 1;