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.
This commit is contained in:
Cary R 2009-12-22 16:32:50 -08:00 committed by Stephen Williams
parent a1e2bfc93c
commit 0f0cadd0eb
2 changed files with 33 additions and 5 deletions

View File

@ -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

View File

@ -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