From 0f0cadd0ebfe9b8a1815b2a1a7b30cf27edea983 Mon Sep 17 00:00:00 2001 From: Cary R Date: Tue, 22 Dec 2009 16:32:50 -0800 Subject: [PATCH] Add suffix support for windows (both MinGW and Cygwin). dlltool which is used by both MinGW and Cygwin to create dynamic libraries must have the name of the executable it creates the library/information from exactly match the installed executable name. If we have a suffix then it must be used. This patch adds that to the build process for vvp since it can be installed with a suffix. It also modifies the check routines since you must run vvp with a suffix if the library it links to was built for a suffixed executable. --- Makefile.in | 12 ++++++++++++ vvp/Makefile.in | 26 +++++++++++++++++++++----- 2 files changed, 33 insertions(+), 5 deletions(-) diff --git a/Makefile.in b/Makefile.in index 34519dc10..fb3b46590 100644 --- a/Makefile.in +++ b/Makefile.in @@ -98,7 +98,19 @@ check: all $(foreach dir,$(SUBDIRS),$(MAKE) -C $(dir) $@ && ) true test -r check.conf || cp $(srcdir)/check.conf . driver/iverilog -B. -BPivlpp -tcheck -ocheck.vvp $(srcdir)/examples/hello.vl +ifeq (@WIN32@,yes) +ifeq (@install_suffix@,) vvp/vvp -M- -M./vpi ./check.vvp | grep 'Hello, World' +else + # On Windows if we have a suffix we must run the vvp part of + # the test with a suffix since it was built/linked that way. + ln vvp/vvp.exe vvp/vvp$(suffix).exe + vvp/vvp$(suffix) -M- -M./vpi ./check.vvp | grep 'Hello, World' + rm vvp/vvp$(suffix).exe +endif +else + vvp/vvp -M- -M./vpi ./check.vvp | grep 'Hello, World' +endif clean: $(foreach dir,$(SUBDIRS),$(MAKE) -C $(dir) $@ && ) true diff --git a/vvp/Makefile.in b/vvp/Makefile.in index 7ca3b2fa8..5ae387af3 100644 --- a/vvp/Makefile.in +++ b/vvp/Makefile.in @@ -66,7 +66,19 @@ distclean: clean rm -f stamp-config-h config.h check: all +ifeq (@WIN32@,yes) +ifeq (@install_suffix@,) ./vvp -M../vpi $(srcdir)/examples/hello.vvp | grep 'Hello, World.' +else + # On Windows if we have a suffix we must run the vvp test with + # a suffix since it was built/linked that way. + ln vvp.exe vvp$(suffix).exe + ./vvp$(suffix) -M../vpi $(srcdir)/examples/hello.vvp | grep 'Hello, World.' + rm -f vvp$(suffix).exe +endif +else + ./vvp -M../vpi $(srcdir)/examples/hello.vvp | grep 'Hello, World.' +endif V = vpi_modules.o vpi_callback.o vpi_const.o vpi_event.o vpi_iter.o vpi_mcd.o \ vpi_priv.o vpi_scope.o vpi_real.o vpi_signal.o vpi_tasks.o vpi_time.o \ @@ -81,14 +93,18 @@ vthread.o schedule.o statistics.o tables.o udp.o vvp_island.o vvp_net.o \ vvp_net_sig.o event.o logic.o delay.o words.o island_tran.o $V ifeq (@WIN32@,yes) -# Under Windows (mingw) I need to make the ivl.exe in two steps. -# The first step makes an ivl.exe that dlltool can use to make an -# export and import library, and the last link makes a, ivl.exe +# Under Windows (mingw) I need to make the vvp.exe in two steps. +# The first step makes an vvp.exe that dlltool can use to make an +# export and import library, and the last link makes a, vvp.exe # that really exports the things that the import library imports. +# +# To get this to work correctly we must use the suffixed version of the +# executable to build the library. vvp@EXEEXT@ libvpi.a: $O $(srcdir)/vvp.def - $(CXX) -o vvp@EXEEXT@ $(LDFLAGS) $O $(dllib) $(LIBS) - dlltool --dllname vvp@EXEEXT@ --def $(srcdir)/vvp.def \ + $(CXX) -o vvp$(suffix)@EXEEXT@ $(LDFLAGS) $O $(dllib) $(LIBS) + dlltool --dllname vvp$(suffix)@EXEEXT@ --def $(srcdir)/vvp.def \ --output-lib libvpi.a --output-exp vvp.exp + rm -f vvp$(suffix)@EXEEXT@ $(CXX) $(LDFLAGS) -o vvp@EXEEXT@ vvp.exp $(LDFLAGS) $O $(dllib) $(LIBS) else libvpi.a: libvpi.c