Add support for a suffix to MinGW.

This patch adds support for a suffix in the relative path for the
MinGW compile of iverilog and vvp.
This commit is contained in:
Cary R 2009-12-16 10:25:23 -08:00 committed by Stephen Williams
parent 8144283b0d
commit 5fad844c30
4 changed files with 45 additions and 32 deletions

View File

@ -79,7 +79,7 @@ dep:
mv $*.d dep
main.o: main.c globals.h ../version_base.h ../version_tag.h Makefile
$(CC) $(CPPFLAGS) $(CFLAGS) -MD -c -DIVL_ROOT='"@libdir@/ivl$(suffix)"' -DIVL_INC='"@includedir@"' -DIVL_LIB='"@libdir@"' -DDLLIB='"@DLLIB@"' $(srcdir)/main.c
$(CC) $(CPPFLAGS) $(CFLAGS) -MD -c -DIVL_ROOT='"@libdir@/ivl$(suffix)"' -DIVL_SUFFIX='"$(suffix)"' -DIVL_INC='"@includedir@"' -DIVL_LIB='"@libdir@"' -DDLLIB='"@DLLIB@"' $(srcdir)/main.c
mv $*.d dep
cflexor.o: cflexor.c cfparse.h

View File

@ -760,25 +760,23 @@ int main(int argc, char **argv)
int opt, idx;
#ifdef __MINGW32__
{ char * s;
char basepath[1024], tmp[1024];
/* Calculate the ivl_root from the path to the command. This
is necessary because of the installation process on
Windows. Mostly, it is those darn drive letters, but oh
well. We know the command path is formed like this:
D:\iverilog\bin\iverilog.exe
The module path in a Windows installation is the path:
D:\iverilog\lib\ivl$(suffix)
so we chop the file name and the last directory by
turning the last two \ characters to null. Then we append
the lib\ivl$(suffix) to finish. */
{ char *s;
char basepath[4096], tmp[4096];
GetModuleFileName(NULL, tmp, sizeof tmp);
/* Calculate the ivl_root from the path to the command. This
is necessary because of the installation process in
Windows. Mostly, it is those darn drive letters, but oh
well. We know the command path is formed like this:
D:\iverilog\bin\iverilog.exe
The IVL_ROOT in a Windows installation is the path:
D:\iverilog\lib\ivl
so we chop the file name and the last directory by
turning the last two \ characters to null. Then we append
the lib\ivl to finish. */
/* Convert to a short name to remove any embedded spaces. */
GetShortPathName(tmp, basepath, sizeof basepath);
strncpy(ivl_root, basepath, MAXSIZE);
@ -786,7 +784,7 @@ int main(int argc, char **argv)
if (s) *s = 0;
s = strrchr(ivl_root, sep);
if (s) *s = 0;
strcat(ivl_root, "\\lib\\ivl");
strcat(ivl_root, "\\lib\\ivl" IVL_SUFFIX);
base = ivl_root;
}

View File

@ -53,7 +53,7 @@ LIBS = @LIBS@ @EXTRALIBS@
dllib=@DLLIB@
MDIR1 = -DMODULE_DIR1=\"$(libdir)/ivl$(suffix)/.\"
MDIR1 = -DMODULE_DIR1='"$(libdir)/ivl$(suffix)"'
all: dep vvp@EXEEXT@ libvpi.a vvp.man
@ -105,7 +105,7 @@ dep:
mkdir dep
%.o: %.cc config.h
$(CXX) $(CPPFLAGS) $(MDIR1) $(MDIR2) $(CXXFLAGS) -MD -c $< -o $*.o
$(CXX) $(CPPFLAGS) -DIVL_SUFFIX='"$(suffix)"' $(MDIR1) $(MDIR2) $(CXXFLAGS) -MD -c $< -o $*.o
mv $*.d dep/$*.d
%.o: %.c config.h

View File

@ -211,16 +211,31 @@ int main(int argc, char*argv[])
extern int stop_is_finish_exit_code;
#ifdef __MINGW32__
/* In the Windows world, we get the first module path
component relative the location where the binary lives. */
{ char path[4096], *s;
GetModuleFileName(NULL,path,1024);
/* Get to the end. Search back twice for backslashes */
s = path + strlen(path);
while (*s != '\\') s--; s--;
while (*s != '\\') s--;
strcpy(s,"\\lib\\ivl");
vpip_module_path[0] = strdup(path);
/* Calculate the module path from the path to the command.
This is necessary because of the installation process on
Windows. Mostly, it is those darn drive letters, but oh
well. We know the command path is formed like this:
D:\iverilog\bin\iverilog.exe
The IVL_ROOT in a Windows installation is the path:
D:\iverilog\lib\ivl$(suffix)
so we chop the file name and the last directory by
turning the last two \ characters to null. Then we append
the lib\ivl$(suffix) to finish. */
{ char *s;
char basepath[4096], tmp[4096];
GetModuleFileName(NULL, tmp, sizeof tmp);
/* Convert to a short na,e to remove any embedded spaces. */
GetShortPathName(tmp, basepath, sizeof basepath);
s = strrchr(basepath, '\\');
if (s) *s = 0;
s = strrchr(basepath, '\\');
if (s) *s = 0;
strcat(s, "\\lib\\ivl" IVL_SUFFIX);
vpip_module_path[0] = strdup(basepath);
}
#endif