Pass library paths through -Cfile instead of command line.

This commit is contained in:
steve 2002-05-28 02:25:03 +00:00
parent 9a4ee873e1
commit d44ff4fd91
4 changed files with 54 additions and 64 deletions

View File

@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/ */
#if !defined(WINNT) && !defined(macintosh) #if !defined(WINNT) && !defined(macintosh)
#ident "$Id: build_string.c,v 1.9 2002/05/28 00:50:39 steve Exp $" #ident "$Id: build_string.c,v 1.10 2002/05/28 02:25:03 steve Exp $"
#endif #endif
# include "config.h" # include "config.h"
@ -150,22 +150,6 @@ int build_string(char*output, size_t olen, const char*pattern)
olen -= strlen(warning_flags); olen -= strlen(warning_flags);
break; break;
case 'y':
if (library_flags) {
strcpy(output, library_flags);
output += strlen(library_flags);
olen -= strlen(library_flags);
}
break;
case 'Y':
if (library_flags2) {
strcpy(output, library_flags2);
output += strlen(library_flags2);
olen -= strlen(library_flags2);
}
break;
} }
pattern += 1; pattern += 1;
@ -181,6 +165,9 @@ int build_string(char*output, size_t olen, const char*pattern)
/* /*
* $Log: build_string.c,v $ * $Log: build_string.c,v $
* Revision 1.10 2002/05/28 02:25:03 steve
* Pass library paths through -Cfile instead of command line.
*
* Revision 1.9 2002/05/28 00:50:39 steve * Revision 1.9 2002/05/28 00:50:39 steve
* Add the ivl -C flag for bulk configuration * Add the ivl -C flag for bulk configuration
* from the driver, and use that to run library * from the driver, and use that to run library

View File

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/ */
#ident "$Id: main.c,v 1.39 2002/05/28 00:50:40 steve Exp $" #ident "$Id: main.c,v 1.40 2002/05/28 02:25:03 steve Exp $"
# include "config.h" # include "config.h"
@ -92,8 +92,6 @@ const char*depfile = 0;
const char*generation = "-g3.0"; const char*generation = "-g3.0";
char warning_flags[16] = ""; char warning_flags[16] = "";
char *library_flags = 0;
char *library_flags2 = 0;
char*inc_list = 0; char*inc_list = 0;
char*def_list = 0; char*def_list = 0;
@ -304,28 +302,12 @@ static void process_warning_switch(const char*name)
void process_library_switch(const char *name) void process_library_switch(const char *name)
{ {
if (library_flags) { fprintf(iconfig_file, "-y:%s\n", name);
library_flags = realloc(library_flags,
strlen(library_flags) + strlen(name) + 5);
strcat(library_flags, " -y ");
} else {
library_flags = malloc(strlen(name) + 4);
strcpy(library_flags, "-y ");
}
strcat(library_flags, name);
} }
void process_library2_switch(const char *name) void process_library2_switch(const char *name)
{ {
if (library_flags2) { fprintf(iconfig_file, "-Y:%s\n", name);
library_flags2 = realloc(library_flags2,
strlen(library_flags2) + strlen(name) + 5);
strcat(library_flags2, " -Y ");
} else {
library_flags2 = malloc(strlen(name) + 4);
strcpy(library_flags2, "-Y ");
}
strcat(library_flags2, name);
} }
void process_include_dir(const char *name) void process_include_dir(const char *name)
@ -447,6 +429,20 @@ int main(int argc, char **argv)
return 1; return 1;
} }
/* Create another temporary file for passing configuration
information to ivl. */
iconfig_path = strdup(tempnam(NULL, "ivrlh"));
assert(iconfig_path);
iconfig_file = fopen(iconfig_path, "w");
if (NULL == iconfig_file) {
fprintf(stderr, "%s: Error opening temporary file %s\n",
argv[0], iconfig_path);
fprintf(stderr, "%s: Please check TMP or TMPDIR.\n", argv[0]);
fclose(source_file);
remove(source_path);
return 1;
}
while ((opt = getopt(argc, argv, "B:C:c:D:Ef:g:hI:M:m:N::o:p:Ss:T:t:vVW:y:Y:")) != EOF) { while ((opt = getopt(argc, argv, "B:C:c:D:Ef:g:hI:M:m:N::o:p:Ss:T:t:vVW:y:Y:")) != EOF) {
switch (opt) { switch (opt) {
@ -682,6 +678,9 @@ int main(int argc, char **argv)
rc = system(cmd); rc = system(cmd);
remove(source_path); remove(source_path);
fclose(iconfig_file);
remove(iconfig_path);
if (rc != 0) { if (rc != 0) {
if (WIFEXITED(rc)) { if (WIFEXITED(rc)) {
fprintf(stderr, "errors preprocessing Verilog program.\n"); fprintf(stderr, "errors preprocessing Verilog program.\n");
@ -695,20 +694,6 @@ int main(int argc, char **argv)
return 0; return 0;
} }
/* Create another temporary file for passing configuration
information to ivl. */
iconfig_path = strdup(tempnam(NULL, "ivrlh"));
assert(iconfig_path);
iconfig_file = fopen(iconfig_path, "w");
if (NULL == iconfig_file) {
fprintf(stderr, "%s: Error opening temporary file %s\n",
argv[0], iconfig_path);
fprintf(stderr, "%s: Please check TMP or TMPDIR.\n", argv[0]);
fclose(source_file);
remove(source_path);
return 1;
}
/* Write the preprocessor command needed to preprocess a /* Write the preprocessor command needed to preprocess a
single file. This may be used to preprocess library single file. This may be used to preprocess library
files. */ files. */
@ -731,6 +716,9 @@ int main(int argc, char **argv)
/* /*
* $Log: main.c,v $ * $Log: main.c,v $
* Revision 1.40 2002/05/28 02:25:03 steve
* Pass library paths through -Cfile instead of command line.
*
* Revision 1.39 2002/05/28 00:50:40 steve * Revision 1.39 2002/05/28 00:50:40 steve
* Add the ivl -C flag for bulk configuration * Add the ivl -C flag for bulk configuration
* from the driver, and use that to run library * from the driver, and use that to run library

View File

@ -28,6 +28,8 @@
# #
# %B Substitute the base libdir, -B flag of iverilog. # %B Substitute the base libdir, -B flag of iverilog.
# #
# %C Substitute the path to the temporary config file.
#
# %f Substitute the -f flags from the command line. # %f Substitute the -f flags from the command line.
# #
# %g Substitule the -g flag # %g Substitule the -g flag
@ -47,9 +49,6 @@
# #
# %W Substitute the ivl warning flags. # %W Substitute the ivl warning flags.
# #
# %y Substitute all the -y flags here.
# %Y Substitute all the -Y flags here.
#
# %[<c><text>] # %[<c><text>]
# This substitution pattern is magical, and is the only # This substitution pattern is magical, and is the only
# multicharacter pattern. This tests the code <c>, and # multicharacter pattern. This tests the code <c>, and
@ -63,20 +62,20 @@
# be useful and interesting if the -N flag is included. # be useful and interesting if the -N flag is included.
[-tnull -S] [-tnull -S]
<ivl>%B/ivl %[v-v] -C%C %g %y %Y %W %s %[M-M%M] %[N-N%N] %[T-T%T] -tdll -fDLL=%B/null.tgt -Fsynth -Fsyn-rules -- - <ivl>%B/ivl %[v-v] -C%C %g %W %s %[M-M%M] %[N-N%N] %[T-T%T] -tdll -fDLL=%B/null.tgt -Fsynth -Fsyn-rules -- -
[-tnull] [-tnull]
<ivl>%B/ivl %[v-v] -C%C %g %y %Y %W %s %[M-M%M] %[N-N%N] %[T-T%T] -tdll -fDLL=%B/null.tgt -- - <ivl>%B/ivl %[v-v] -C%C %g %W %s %[M-M%M] %[N-N%N] %[T-T%T] -tdll -fDLL=%B/null.tgt -- -
# -- # --
# The vvp target generates code that the vvp simulation engine can execute. # The vvp target generates code that the vvp simulation engine can execute.
# These rules support synthesized and non-synthesized variants. # These rules support synthesized and non-synthesized variants.
[-tvvp -S] [-tvvp -S]
<ivl>%B/ivl %[v-v] -C%C %g %y %Y %W %s %[M-M%M] %[N-N%N] %[T-T%T] -tdll -fDLL=%B/vvp.tgt -fVVP_EXECUTABLE=%B/../../bin/vvp -Fsynth -Fsyn-rules -Fcprop -Fnodangle %f %m -o%o -- - <ivl>%B/ivl %[v-v] -C%C %g %W %s %[M-M%M] %[N-N%N] %[T-T%T] -tdll -fDLL=%B/vvp.tgt -fVVP_EXECUTABLE=%B/../../bin/vvp -Fsynth -Fsyn-rules -Fcprop -Fnodangle %f %m -o%o -- -
[-tvvp] [-tvvp]
<ivl>%B/ivl %[v-v] -C%C %g %y %Y %W %s %[M-M%M] %[N-N%N] %[T-T%T] -tdll -fDLL=%B/vvp.tgt -fVVP_EXECUTABLE=%B/../../bin/vvp -Fcprop -Fnodangle %f %m -o%o -- - <ivl>%B/ivl %[v-v] -C%C %g %W %s %[M-M%M] %[N-N%N] %[T-T%T] -tdll -fDLL=%B/vvp.tgt -fVVP_EXECUTABLE=%B/../../bin/vvp -Fcprop -Fnodangle %f %m -o%o -- -
# -- # --
# The vvm target uses the <ivl> string to take the preprocessed code from # The vvm target uses the <ivl> string to take the preprocessed code from
@ -85,20 +84,20 @@
# on the result. # on the result.
[-tvvm] [-tvvm]
<ivl>%B/ivl %[v-v] -C%C %g %y %Y %W %s %[N-N%N] %[T-T%T] -tvvm -Fcprop -Fnodangle -fVPI_MODULE_PATH=%B %f %m -o%o.cc -- - <ivl>%B/ivl %[v-v] -C%C %g %W %s %[N-N%N] %[T-T%T] -tvvm -Fcprop -Fnodangle -fVPI_MODULE_PATH=%B %f %m -o%o.cc -- -
# This is the XNF code generator. # This is the XNF code generator.
[-txnf] [-txnf]
<ivl>%B/ivl -C%C %y %Y %[v-v] %g %s %[M-M%M] %[N-N%N] %[T-T%T] -txnf -Fsynth -Fsyn-rules -Fxnfio -Fcprop -Fnodangle -o%o -- - <ivl>%B/ivl -C%C %[v-v] %g %s %[M-M%M] %[N-N%N] %[T-T%T] -txnf -Fsynth -Fsyn-rules -Fxnfio -Fcprop -Fnodangle -o%o -- -
# And this is another XNF code generator, under development. # And this is another XNF code generator, under development.
[-tfpga] [-tfpga]
<ivl>%B/ivl -C%C %y %Y %[v-v] %g %s %[M-M%M] %[N-N%N] %[T-T%T] %f -tdll -fDLL=%B/fpga.tgt -Fsynth -Fsyn-rules -Fcprop -Fnodangle -o%o -- - <ivl>%B/ivl -C%C %[v-v] %g %s %[M-M%M] %[N-N%N] %[T-T%T] %f -tdll -fDLL=%B/fpga.tgt -Fsynth -Fsyn-rules -Fcprop -Fnodangle -o%o -- -
# -- # --
# This is the pal code generator. The target module requires the -fpart=<type> # This is the pal code generator. The target module requires the -fpart=<type>
# flag to specify the part type. # flag to specify the part type.
[-tpal] [-tpal]
<ivl>%B/ivl -C%C %y %Y %[v-v] %g %s %[M-M%M] %[N-N%N] %[T-T%T] %f -tdll -fDLL=%B/pal.tgt -Fsynth -Fsyn-rules -Fcprop -Fnodangle -o%o -- - <ivl>%B/ivl -C%C %[v-v] %g %s %[M-M%M] %[N-N%N] %[T-T%T] %f -tdll -fDLL=%B/pal.tgt -Fsynth -Fsyn-rules -Fcprop -Fnodangle -o%o -- -

18
main.cc
View File

@ -19,7 +19,7 @@ const char COPYRIGHT[] =
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/ */
#if !defined(WINNT) && !defined(macintosh) #if !defined(WINNT) && !defined(macintosh)
#ident "$Id: main.cc,v 1.56 2002/05/28 00:50:39 steve Exp $" #ident "$Id: main.cc,v 1.57 2002/05/28 02:25:03 steve Exp $"
#endif #endif
# include "config.h" # include "config.h"
@ -99,6 +99,12 @@ bool error_implicit = false;
*/ */
bool verbose_flag = false; bool verbose_flag = false;
/*
* Read the contents of a config file. This file is a temporary
* configuration file made by the compiler driver to carry the bulky
* flags generated from the user. This reduces the size of the command
* line needed to invoke ivl
*/
static void read_iconfig_file(const char*ipath) static void read_iconfig_file(const char*ipath)
{ {
char buf[8*1024]; char buf[8*1024];
@ -130,6 +136,13 @@ static void read_iconfig_file(const char*ipath)
if (strcmp(buf, "ivlpp") == 0) { if (strcmp(buf, "ivlpp") == 0) {
ivlpp_string = strdup(cp); ivlpp_string = strdup(cp);
} else if (strcmp(buf, "-y") == 0) {
library_dirs.push_back(strdup(cp));
} else if (strcmp(buf, "-Y") == 0) {
library_suff.push_back(strdup(cp));
} }
} }
} }
@ -570,6 +583,9 @@ int main(int argc, char*argv[])
/* /*
* $Log: main.cc,v $ * $Log: main.cc,v $
* Revision 1.57 2002/05/28 02:25:03 steve
* Pass library paths through -Cfile instead of command line.
*
* Revision 1.56 2002/05/28 00:50:39 steve * Revision 1.56 2002/05/28 00:50:39 steve
* Add the ivl -C flag for bulk configuration * Add the ivl -C flag for bulk configuration
* from the driver, and use that to run library * from the driver, and use that to run library