diff options
author | Tristan Gingold <tgingold@free.fr> | 2023-02-12 09:23:56 +0100 |
---|---|---|
committer | Tristan Gingold <tgingold@free.fr> | 2023-02-12 09:23:56 +0100 |
commit | 96088c08fd94edbeba26f4a67821ea62b5077605 (patch) | |
tree | 7f663881549a6034734fef74fa29c1b104f83636 | |
parent | bce7a19011080e04ac3becc39809453ea05dfd33 (diff) | |
download | ghdl-96088c08fd94edbeba26f4a67821ea62b5077605.tar.gz ghdl-96088c08fd94edbeba26f4a67821ea62b5077605.tar.bz2 ghdl-96088c08fd94edbeba26f4a67821ea62b5077605.zip |
ghdl: print llvm or gcc backend version with --version
-rwxr-xr-x | configure | 8 | ||||
-rw-r--r-- | default_paths.ads.in | 3 | ||||
-rw-r--r-- | src/ghdldrv/ghdl_gcc.adb | 4 | ||||
-rw-r--r-- | src/ghdldrv/ghdl_llvm.adb | 4 |
4 files changed, 15 insertions, 4 deletions
@@ -24,6 +24,7 @@ ghdl_version="3.0.0-dev" backend=mcode +backend_version="none" CC=${CC:-gcc} CXX=${CXX:-clang++} CFLAGS=${CFLAGS:--g} @@ -60,7 +61,7 @@ show_help=no progname=$0 subst_vars="CC CXX GNATMAKE ADA_FLAGS MAKE CFLAGS CXXFLAGS LDFLAGS build -srcdir abs_srcdir prefix backend libdirsuffix libghdldirsuffix +srcdir abs_srcdir prefix backend backend_version libdirsuffix libghdldirsuffix incdirsuffix gcc_src_dir llvm_config llvm_be backtrace_lib build_mode EXEEXT SOEXT PIC_FLAGS default_pic enable_werror enable_checks enable_gplcompat enable_libghdl libghdl_version ghdl_version @@ -221,7 +222,7 @@ fi if [ "$enable_libghdl" = true ]; then libghdl_version="$srcdir/pyGHDL/__init__.py" # Extract content between double quotes in __init__.py, to avoid false positives due to LF/CRLF mismatch. - if [ "$ghdl_version" != "`sed -n 's/^__version__.*"\(.*\)".*/\1/gp' $libghdl_version`" ]; then + if [ "$ghdl_version" != `sed -n 's/^__version__.*"\(.*\)".*/\1/gp' $libghdl_version` ]; then echo "Sorry, the version of $libghdl_version is not correct" echo "update the version to: $ghdl_version" echo "or use --disable-libghdl" @@ -268,6 +269,7 @@ if test $backend = mcode; then echo "WARNING: --with-backtrace-lib= ignored with mcode" backtrace_lib= fi + backend_version="none" fi # For gcc backend, check existing version @@ -276,6 +278,7 @@ if test $backend = gcc; then echo "cannot find gcc/BASE-VER in $gcc_src_dir" exit 1 fi + backend_version=`cat $gcc_src_dir/gcc/BASE-VER` if test "x$backtrace_lib" = x ; then # Automatically use libbacktrace from gcc. backtrace_lib="$prefix/$libghdldirsuffix/libbacktrace.a" @@ -324,6 +327,7 @@ if test $backend = llvm; then case "$build" in *darwin*) LDFLAGS="$LDFLAGS -Wl,-no_compact_unwind" ;; esac + backend_version="$llvm_version" fi # Define default file extensions for Windows or Linux-like systems and diff --git a/default_paths.ads.in b/default_paths.ads.in index 03addd784..413d3dc44 100644 --- a/default_paths.ads.in +++ b/default_paths.ads.in @@ -41,4 +41,7 @@ package Default_Paths is Shared_Library_Extension : constant String := "@SOEXT@"; Default_Pie : constant Boolean := "@default_pic@" = String'("true"); + + Backend_Version : constant String := + "@backend_version@"; end Default_Paths; diff --git a/src/ghdldrv/ghdl_gcc.adb b/src/ghdldrv/ghdl_gcc.adb index ce39bc830..19862a937 100644 --- a/src/ghdldrv/ghdl_gcc.adb +++ b/src/ghdldrv/ghdl_gcc.adb @@ -21,12 +21,14 @@ with Ghdlvpi; with Ghdlxml; with Ghdllib; with Ghdlsynth_Maybe; +with Default_Paths; procedure Ghdl_Gcc is begin -- Manual elaboration so that the order is known (because it is the order -- used to display help). - Ghdlmain.Version_String := new String'("GCC back-end code generator"); + Ghdlmain.Version_String := + new String'("GCC " & Default_Paths.Backend_Version & " code generator"); Ghdldrv.Backend := Ghdldrv.Backend_Gcc; Ghdldrv.Register_Commands; Ghdlsynth_Maybe.Register_Commands; diff --git a/src/ghdldrv/ghdl_llvm.adb b/src/ghdldrv/ghdl_llvm.adb index 036d71c0c..b110194d0 100644 --- a/src/ghdldrv/ghdl_llvm.adb +++ b/src/ghdldrv/ghdl_llvm.adb @@ -21,12 +21,14 @@ with Ghdlvpi; with Ghdlxml; with Ghdllib; with Ghdlsynth_Maybe; +with Default_Paths; procedure Ghdl_Llvm is begin -- Manual elaboration so that the order is known (because it is the order -- used to display help). - Ghdlmain.Version_String := new String'("llvm code generator"); + Ghdlmain.Version_String := + new String'("llvm " & Default_Paths.Backend_Version & " code generator"); Ghdldrv.Backend := Ghdldrv.Backend_Llvm; Ghdldrv.Register_Commands; Ghdlsynth_Maybe.Register_Commands; |