From 2e50fb2f0632ad47e1ad5ad6ff3a907df01b8e23 Mon Sep 17 00:00:00 2001 From: Ralf Habacker Date: Fri, 8 May 2026 19:13:19 +0200 Subject: [PATCH] iverilog: add -Bt option to find .conf when using -t in custom install or build dir --- driver/iverilog.man.in | 7 ++++++- driver/main.c | 10 ++++++++-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/driver/iverilog.man.in b/driver/iverilog.man.in index 3c38f1abd..b5f4d1360 100644 --- a/driver/iverilog.man.in +++ b/driver/iverilog.man.in @@ -4,7 +4,7 @@ iverilog - Icarus Verilog compiler .SH SYNOPSIS .B iverilog -[\-EiRSuVv] [\-B[IMPV]path] [\-ccmdfile|\-fcmdfile] [\-Dmacro[=defn]] +[\-EiRSuVv] [\-B[IMPVt]path] [\-ccmdfile|\-fcmdfile] [\-Dmacro[=defn]] [\-Pparameter=value] [\-pflag=value] [\-dname] [\-g1995\:|\-g2001\:|\-g2005\:|\-g2005-sv\:|\-g2009\:|\-g2012\:|\-g2017\:|\-g2023\:|\-g] [\-Iincludedir] [\-Lmoduledir] [\-mmodule] [\-M[mode=]file] [\-Nfile] @@ -45,6 +45,11 @@ Directory for the \fIivlpp\fP preprocessor. .TP .BI \-BV path Directory for the \fIvhdlpp\fP VHDL preprocessor. +.TP +.BI \-Bt path +Directory used to locate target configuration files for the +\fB\-t\fP\fItarget\fP option. The configuration file name is +\fItarget\fP.conf. .RE .TP 8 .B -c\fIfile\fP -f\fIfile\fP diff --git a/driver/main.c b/driver/main.c index 56aa62cdf..95d02e91b 100644 --- a/driver/main.c +++ b/driver/main.c @@ -38,7 +38,7 @@ const char NOTICE[] = ; const char HELP[] = -"Usage: iverilog [-EiRSuvV] [-B[IMPV] base] [-c cmdfile|-f cmdfile]\n" +"Usage: iverilog [-EiRSuvV] [-B[IMPVt] base] [-c cmdfile|-f cmdfile]\n" " [-g1995|-g2001|-g2005|-g2005-sv|-g2009|-g2012|-g2017|-g2023] [-g]\n" " [-D macro[=defn]] [-I includedir] [-L moduledir]\n" " [-M [mode=]depfile] [-m module]\n" @@ -112,6 +112,7 @@ extern void cfreset(FILE*fd, const char*path); const char*base = 0; const char*vpi_dir = 0; +const char*tconfig_dir = 0; const char*ivl_dir = 0; const char*ivlpp_dir = 0; const char*vhdlpp_dir= 0; @@ -1237,6 +1238,9 @@ int main(int argc, char **argv) case 'V': /* Path for the vhdlpp VHDL processor */ vhdlpp_dir = optarg+1; break; + case 't': /* Path to target.conf for the -ttarget option */ + tconfig_dir = optarg+1; + break; default: /* Otherwise, this is a default base. */ base=optarg; break; @@ -1383,6 +1387,8 @@ int main(int argc, char **argv) ivl_dir = base; if (vhdlpp_dir == 0) vhdlpp_dir = base; + if (tconfig_dir == 0) + tconfig_dir = base; if (version_flag || verbose_flag) { printf("Icarus Verilog version " VERSION " (" VERSION_TAG ")\n\n"); @@ -1392,7 +1398,7 @@ int main(int argc, char **argv) /* Make a common conf file path to reflect the target. */ snprintf(iconfig_common_path, sizeof iconfig_common_path, "%s%c%s%s.conf", - base, sep, targ, synth_flag? "-s" : ""); + tconfig_dir, sep, targ, synth_flag? "-s" : ""); /* Write values to the iconfig file. */ fprintf(iconfig_file, "basedir:%s\n", base);