Embed DATDIR make variable value into yosys binary.
authorSergey Kvachonok <ravenexp@gmail.com>
Sat, 26 Mar 2016 08:01:53 +0000 (11:01 +0300)
committerSergey Kvachonok <ravenexp@gmail.com>
Sat, 26 Mar 2016 08:16:53 +0000 (11:16 +0300)
Use it as the last resort in the share/ directory location search.

Makefile
kernel/yosys.cc

index b1d94e16a7281f4fa157ebe5938ca688a07885b8..7f4e5c9b1a893cae06a47748c3517b4523e92a61 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -281,6 +281,7 @@ $(eval $(call add_include_file,backends/ilang/ilang_backend.h))
 
 OBJS += kernel/driver.o kernel/register.o kernel/rtlil.o kernel/log.o kernel/calc.o kernel/yosys.o kernel/cellaigs.o
 kernel/log.o: CXXFLAGS += -DYOSYS_SRC='"$(YOSYS_SRC)"'
+kernel/yosys.o: CXXFLAGS += -DYOSYS_DATDIR='"$(DATDIR)"'
 
 OBJS += libs/bigint/BigIntegerAlgorithms.o libs/bigint/BigInteger.o libs/bigint/BigIntegerUtils.o
 OBJS += libs/bigint/BigUnsigned.o libs/bigint/BigUnsignedInABase.o
index eba1aef11ff5bc2fdb668547cad813c2f19171d8..a69a854472eb3a9fda503b1bf66556a41e960b6e 100644 (file)
@@ -701,6 +701,11 @@ std::string proc_share_dirname()
        proc_share_path = proc_self_path + "../share/yosys/";
        if (check_file_exists(proc_share_path, true))
                return proc_share_path;
+#    ifdef YOSYS_DATDIR
+       proc_share_path = YOSYS_DATDIR "/";
+       if (check_file_exists(proc_share_path, true))
+               return proc_share_path;
+#    endif
 #  endif
        log_error("proc_share_dirname: unable to determine share/ directory!\n");
 }