MinGW fixes (development)

The MinGW system() implementation appears to return the straight
return value instead of the waitpid() like result that more
normal systems return. Because of this just return the system()
result without processing for MinGW compilations.

Older version of the MinGW runtime (pre 3.14) just used the
underlying vsnprintf(). Which has some problems. The 3.14 version
has some nice improvements, but it has a sever bug when processing
"%*.*f", -1, -1, <some_real_value>.  Because of this we need to use
the underlying version without the enhancements for now.

snprintf prints %p differently than the other printf routines
so use _snprintf to get consistent results.

Only build the PDF files if both man and ps2pdf exist.

MinGW does not know about the z modifier for %d, %u, etc.

Add some missing Makefile check targets.
This commit is contained in:
Cary R 2008-05-22 16:31:09 -07:00 committed by Stephen Williams
parent 6a9c5d8f7e
commit b26bdd3c19
17 changed files with 105 additions and 46 deletions

View File

@ -16,9 +16,6 @@
# 59 Temple Place - Suite 330 # 59 Temple Place - Suite 330
# Boston, MA 02111-1307, USA # Boston, MA 02111-1307, USA
# #
#ident "$Id: Makefile.in,v 1.181 2007/05/24 04:07:11 steve Exp $"
#
#
SHELL = /bin/sh SHELL = /bin/sh
# This version string is only used in the version message printed # This version string is only used in the version message printed
@ -51,6 +48,9 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_DATA = @INSTALL_DATA@ INSTALL_DATA = @INSTALL_DATA@
LEX = @LEX@ LEX = @LEX@
YACC = @YACC@ YACC = @YACC@
MAN = @MAN@
PS2PDF = @PS2PDF@
GIT = @GIT@
CPPFLAGS = @ident_support@ @DEFS@ -I. -I$(srcdir) @CPPFLAGS@ CPPFLAGS = @ident_support@ @DEFS@ -I. -I$(srcdir) @CPPFLAGS@
CXXFLAGS = -Wall @CXXFLAGS@ CXXFLAGS = -Wall @CXXFLAGS@
@ -65,7 +65,7 @@ all: dep version.h ivl@EXEEXT@
# In the windows world, the installer will need a dosify program to # In the windows world, the installer will need a dosify program to
# dosify text files. # dosify text files.
ifeq (@MING32@,yes) ifeq (@MINGW32@,yes)
all: dep dosify.exe all: dep dosify.exe
dosify.exe: dosify.c dosify.exe: dosify.c
$(CC) -o dosify.exe dosify.c $(CC) -o dosify.exe dosify.c
@ -177,19 +177,22 @@ lexor_keyword.cc: lexor_keyword.gperf
gperf -o -i 7 -C -k 1-4,$$ -L ANSI-C -H keyword_hash -N check_identifier -t $(srcdir)/lexor_keyword.gperf > lexor_keyword.cc || (rm -f lexor_keyword.cc ; false) gperf -o -i 7 -C -k 1-4,$$ -L ANSI-C -H keyword_hash -N check_identifier -t $(srcdir)/lexor_keyword.gperf > lexor_keyword.cc || (rm -f lexor_keyword.cc ; false)
iverilog-vpi.ps: $(srcdir)/iverilog-vpi.man iverilog-vpi.ps: $(srcdir)/iverilog-vpi.man
man -t $(srcdir)/iverilog-vpi.man > iverilog-vpi.ps $(MAN) -t $(srcdir)/iverilog-vpi.man > iverilog-vpi.ps
iverilog-vpi.pdf: iverilog-vpi.ps iverilog-vpi.pdf: iverilog-vpi.ps
ps2pdf iverilog-vpi.ps iverilog-vpi.pdf $(PS2PDF) iverilog-vpi.ps iverilog-vpi.pdf
# For VERSION_TAG in driver/main.c, first try git-describe, then look for a # For VERSION_TAG in driver/main.c, first try git-describe, then look for a
# version.h file in the source tree (included in snapshots and releases), and # version.h file in the source tree (included in snapshots and releases), and
# finally use nothing. # finally use nothing.
.PHONY: version.h .PHONY: version.h
version.h: version.h:
ifeq ($(GIT),none)
@echo '#define VERSION_TAG ""' > $@;
else
@if test -d $(srcdir)/.git; then \ @if test -d $(srcdir)/.git; then \
echo "Using git-describe for VERSION_TAG"; \ echo "Using git-describe for VERSION_TAG"; \
tmp=`git --git-dir $(srcdir)/.git describe \ tmp=`$(GIT) --git-dir $(srcdir)/.git describe \
| sed -e 's;\(.*\);#define VERSION_TAG "\1";'`; \ | sed -e 's;\(.*\);#define VERSION_TAG "\1";'`; \
echo "$$tmp" | diff - $@ > /dev/null 2>&1 || echo "$$tmp" > $@ || exit 1; \ echo "$$tmp" | diff - $@ > /dev/null 2>&1 || echo "$$tmp" > $@ || exit 1; \
elif test -r $(srcdir)/$@; then \ elif test -r $(srcdir)/$@; then \
@ -199,11 +202,20 @@ version.h:
echo "Using empty VERSION_TAG"; \ echo "Using empty VERSION_TAG"; \
echo '#define VERSION_TAG ""' > $@; \ echo '#define VERSION_TAG ""' > $@; \
fi fi
endif
ifeq (@MING32@,yes) ifeq (@MINGW32@,yes)
ifeq ($(MAN),none)
INSTALL_DOC = $(mandir)/man1/iverilog-vpi.1
else
ifeq ($(PS2PDF),none)
INSTALL_DOC = $(mandir)/man1/iverilog-vpi.1
else
INSTALL_DOC = $(prefix)/iverilog-vpi.pdf $(mandir)/man1/iverilog-vpi.1 INSTALL_DOC = $(prefix)/iverilog-vpi.pdf $(mandir)/man1/iverilog-vpi.1
INSTALL_DOCDIR = $(mandir)/man1
all: dep iverilog-vpi.pdf all: dep iverilog-vpi.pdf
endif
endif
INSTALL_DOCDIR = $(mandir)/man1
else else
INSTALL_DOC = $(mandir)/man1/iverilog-vpi.1 INSTALL_DOC = $(mandir)/man1/iverilog-vpi.1
INSTALL_DOCDIR = $(mandir)/man1 INSTALL_DOCDIR = $(mandir)/man1

View File

@ -16,12 +16,9 @@
# 59 Temple Place - Suite 330 # 59 Temple Place - Suite 330
# Boston, MA 02111-1307, USA # Boston, MA 02111-1307, USA
# #
#ident "$Id: Makefile.in,v 1.13 2007/02/06 05:07:31 steve Exp $"
#
#
SHELL = /bin/sh SHELL = /bin/sh
VERSION = 0.0 VERSION = 0.9.devel
prefix = @prefix@ prefix = @prefix@
exec_prefix = @exec_prefix@ exec_prefix = @exec_prefix@
@ -63,7 +60,7 @@ dep:
O = cadpli.o O = cadpli.o
SYSTEM_VPI_LDFLAGS = -L../vvp -lvpi SYSTEM_VPI_LDFLAGS = -L../vvp -lvpi
ifeq (@MING32@,yes) ifeq (@MINGW32@,yes)
SYSTEM_VPI_LDFLAGS += @EXTRALIBS@ SYSTEM_VPI_LDFLAGS += @EXTRALIBS@
endif endif

View File

@ -9,6 +9,9 @@ AC_PROG_CC
AC_PROG_CXX AC_PROG_CXX
AC_CHECK_TOOL(STRIP, strip, true) AC_CHECK_TOOL(STRIP, strip, true)
AC_CHECK_PROGS(XGPERF,gperf,none) AC_CHECK_PROGS(XGPERF,gperf,none)
AC_CHECK_PROGS(MAN,man,none)
AC_CHECK_PROGS(PS2PDF,ps2pdf,none)
AC_CHECK_PROGS(GIT,git,none)
if test "$XGPERF" = "none" if test "$XGPERF" = "none"
then then
echo "" echo ""

View File

@ -16,12 +16,9 @@
# 59 Temple Place - Suite 330 # 59 Temple Place - Suite 330
# Boston, MA 02111-1307, USA # Boston, MA 02111-1307, USA
# #
#ident "$Id: Makefile.in,v 1.7.2.1 2006/10/04 17:08:59 steve Exp $"
#
#
SHELL = /bin/sh SHELL = /bin/sh
VERSION = 0.8.3 VERSION = 0.9.devel
prefix = @prefix@ prefix = @prefix@
exec_prefix = @exec_prefix@ exec_prefix = @exec_prefix@
@ -48,6 +45,8 @@ LDFLAGS = @LDFLAGS@
all: iverilog-vpi@EXEEXT@ all: iverilog-vpi@EXEEXT@
check: all
clean: clean:
rm -f *.o config.h rm -f *.o config.h
rm -f iverilog-vpi@EXEEXT@ rm -f iverilog-vpi@EXEEXT@

View File

@ -16,9 +16,6 @@
# 59 Temple Place - Suite 330 # 59 Temple Place - Suite 330
# Boston, MA 02111-1307, USA # Boston, MA 02111-1307, USA
# #
#ident "$Id: Makefile.in,v 1.26 2007/02/06 05:07:31 steve Exp $"
#
#
SHELL = /bin/sh SHELL = /bin/sh
VERSION = 0.9.devel VERSION = 0.9.devel
@ -41,6 +38,8 @@ CC = @CC@
INSTALL = @INSTALL@ INSTALL = @INSTALL@
INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_DATA = @INSTALL_DATA@ INSTALL_DATA = @INSTALL_DATA@
MAN = @MAN@
PS2PDF = @PS2PDF@
CPPFLAGS = @ident_support@ -I. -I.. -I$(srcdir)/.. -I$(srcdir) -DVERSION='"$(VERSION)"' @CPPFLAGS@ @DEFS@ CPPFLAGS = @ident_support@ -I. -I.. -I$(srcdir)/.. -I$(srcdir) -DVERSION='"$(VERSION)"' @CPPFLAGS@ @DEFS@
CFLAGS = -Wall @CFLAGS@ CFLAGS = -Wall @CFLAGS@
@ -76,15 +75,23 @@ cflexor.o: cflexor.c cfparse.h cfparse_misc.h globals.h
cfparse.o: cfparse.c globals.h cfparse_misc.h cfparse.o: cfparse.c globals.h cfparse_misc.h
iverilog.ps: $(srcdir)/iverilog.man iverilog.ps: $(srcdir)/iverilog.man
man -t $(srcdir)/iverilog.man > iverilog.ps $(MAN) -t $(srcdir)/iverilog.man > iverilog.ps
iverilog.pdf: iverilog.ps iverilog.pdf: iverilog.ps
ps2pdf iverilog.ps iverilog.pdf $(PS2PDF) iverilog.ps iverilog.pdf
ifeq (@MING32@,yes) ifeq (@MINGW32@,yes)
ifeq ($(MAN),none)
INSTALL_DOC = $(mandir)/man1/iverilog.1
else
ifeq ($(PS2PDF),none)
INSTALL_DOC = $(mandir)/man1/iverilog.1
else
INSTALL_DOC = $(prefix)/iverilog.pdf $(mandir)/man1/iverilog.1 INSTALL_DOC = $(prefix)/iverilog.pdf $(mandir)/man1/iverilog.1
INSTALL_DOCDIR = $(mandir)/man1
all: iverilog.pdf all: iverilog.pdf
endif
endif
INSTALL_DOCDIR = $(mandir)/man1
else else
INSTALL_DOC = $(mandir)/man1/iverilog.1 INSTALL_DOC = $(mandir)/man1/iverilog.1
INSTALL_DOCDIR = $(mandir)/man1 INSTALL_DOCDIR = $(mandir)/man1

View File

@ -327,6 +327,9 @@ static int t_default(char*cmd, unsigned ncmd)
remove(defines_path); remove(defines_path);
remove(compiled_defines_path); remove(compiled_defines_path);
} }
#ifdef __MINGW32__ /* MinGW just returns the exit status, so return it! */
return rc;
#else
if (rc != 0) { if (rc != 0) {
if (rc == 127) { if (rc == 127) {
@ -342,6 +345,7 @@ static int t_default(char*cmd, unsigned ncmd)
} }
return 0; return 0;
#endif
} }

View File

@ -1616,7 +1616,11 @@ static int load_next_input()
static void do_dump_precompiled_defines(FILE* out, struct define_t* table) static void do_dump_precompiled_defines(FILE* out, struct define_t* table)
{ {
if (!table->keyword) if (!table->keyword)
#ifdef __MINGW32__ /* MinGW does not know about z. */
fprintf(out, "%s:%d:%d:%s\n", table->name, table->argc, strlen(table->value), table->value);
#else
fprintf(out, "%s:%d:%zd:%s\n", table->name, table->argc, strlen(table->value), table->value); fprintf(out, "%s:%d:%zd:%s\n", table->name, table->argc, strlen(table->value), table->value);
#endif
if (table->left) if (table->left)
do_dump_precompiled_defines(out, table->left); do_dump_precompiled_defines(out, table->left);

View File

@ -16,12 +16,9 @@
# 59 Temple Place - Suite 330 # 59 Temple Place - Suite 330
# Boston, MA 02111-1307, USA # Boston, MA 02111-1307, USA
# #
#ident "$Id: Makefile.in,v 1.11 2004/02/10 19:25:01 steve Exp $"
#
#
SHELL = /bin/sh SHELL = /bin/sh
VERSION = 0.0 VERSION = 0.9.devel
prefix = @prefix@ prefix = @prefix@
exec_prefix = @exec_prefix@ exec_prefix = @exec_prefix@
@ -44,6 +41,8 @@ LDFLAGS = @LDFLAGS@
all: dep null.tgt all: dep null.tgt
check: all
dep: dep:
mkdir dep mkdir dep

View File

@ -16,12 +16,9 @@
# 59 Temple Place - Suite 330 # 59 Temple Place - Suite 330
# Boston, MA 02111-1307, USA # Boston, MA 02111-1307, USA
# #
#ident "$Id: Makefile.in,v 1.20 2007/02/06 05:07:32 steve Exp $"
#
#
SHELL = /bin/sh SHELL = /bin/sh
VERSION = 0.0 VERSION = 0.9.devel
prefix = @prefix@ prefix = @prefix@
exec_prefix = @exec_prefix@ exec_prefix = @exec_prefix@
@ -44,6 +41,8 @@ LDFLAGS = @LDFLAGS@
all: dep stub.tgt all: dep stub.tgt
check: all
dep: dep:
mkdir dep mkdir dep

View File

@ -25,6 +25,10 @@
# include <stdlib.h> # include <stdlib.h>
# include <assert.h> # include <assert.h>
#ifdef __MINGW32__ /* MinGW has inconsistent %p output. */
#define snprintf _snprintf
#endif
static const char* magic_sfuncs[] = { static const char* magic_sfuncs[] = {
"$time", "$time",
"$stime", "$stime",

View File

@ -22,6 +22,10 @@
# include <stdlib.h> # include <stdlib.h>
# include <assert.h> # include <assert.h>
#ifdef __MINGW32__ /* MinGW has inconsistent %p output. */
#define snprintf _snprintf
#endif
static ivl_signal_t find_path_source_port(ivl_delaypath_t path) static ivl_signal_t find_path_source_port(ivl_delaypath_t path)
{ {
int idx; int idx;

View File

@ -27,6 +27,10 @@
# include <inttypes.h> # include <inttypes.h>
# include <assert.h> # include <assert.h>
#ifdef __MINGW32__ /* MinGW has inconsistent %p output. */
#define snprintf _snprintf
#endif
struct vvp_nexus_data { struct vvp_nexus_data {
/* draw_net_input uses this */ /* draw_net_input uses this */
const char*net_input; const char*net_input;
@ -1759,7 +1763,11 @@ static void draw_lpm_add(ivl_lpm_t net)
type = "pow.s"; type = "pow.s";
if (width > 8*sizeof(long)) { if (width > 8*sizeof(long)) {
fprintf(stderr, "%s:%u: sorry (vvp-tgt): Signed power " fprintf(stderr, "%s:%u: sorry (vvp-tgt): Signed power "
#ifdef __MINGW32__ /* MinGW does not know about z. */
"result must be no more than %u bits.\n",
#else
"result must be no more than %zu bits.\n", "result must be no more than %zu bits.\n",
#endif
ivl_lpm_file(net), ivl_lpm_lineno(net), ivl_lpm_file(net), ivl_lpm_lineno(net),
8*sizeof(long)); 8*sizeof(long));
exit(1); exit(1);

View File

@ -16,12 +16,9 @@
# 59 Temple Place - Suite 330 # 59 Temple Place - Suite 330
# Boston, MA 02111-1307, USA # Boston, MA 02111-1307, USA
# #
#ident "$Id: Makefile.in,v 1.61 2007/02/06 05:07:32 steve Exp $"
#
#
SHELL = /bin/sh SHELL = /bin/sh
VERSION = 0.0 VERSION = 0.9.devel
prefix = @prefix@ prefix = @prefix@
exec_prefix = @exec_prefix@ exec_prefix = @exec_prefix@
@ -48,6 +45,8 @@ LDFLAGS = @LDFLAGS@
all: dep system.vpi va_math.vpi $(ALL32) all: dep system.vpi va_math.vpi $(ALL32)
check: all
dep: dep:
mkdir dep mkdir dep
@ -75,7 +74,7 @@ V = va_math.o
LIBS = @LIBS@ LIBS = @LIBS@
SYSTEM_VPI_LDFLAGS = $(LIBS) SYSTEM_VPI_LDFLAGS = $(LIBS)
VA_MATH_LDFLAGS = VA_MATH_LDFLAGS =
ifeq (@MING32@,yes) ifeq (@MINGW32@,yes)
SYSTEM_VPI_LDFLAGS += @EXTRALIBS@ SYSTEM_VPI_LDFLAGS += @EXTRALIBS@
VA_MATH_LDFLAGS += @EXTRALIBS@ VA_MATH_LDFLAGS += @EXTRALIBS@
endif endif

View File

@ -43,6 +43,8 @@ INSTALL_DATA = @INSTALL_DATA@
RANLIB = @RANLIB@ RANLIB = @RANLIB@
LEX = @LEX@ LEX = @LEX@
YACC = @YACC@ YACC = @YACC@
MAN = @MAN@
PS2PDF = @PS2PDF@
CPPFLAGS = @ident_support@ -I. -I.. -I $(srcdir) -I$(srcdir)/.. @CPPFLAGS@ @DEFS@ CPPFLAGS = @ident_support@ -I. -I.. -I $(srcdir) -I$(srcdir)/.. @CPPFLAGS@ @DEFS@
CXXFLAGS = -Wall @CXXFLAGS@ CXXFLAGS = -Wall @CXXFLAGS@
@ -133,12 +135,20 @@ lexor.cc: $(srcdir)/lexor.lex
$(LEX) -s -olexor.cc $(srcdir)/lexor.lex $(LEX) -s -olexor.cc $(srcdir)/lexor.lex
vvp.pdf: $(srcdir)/vvp.man vvp.pdf: $(srcdir)/vvp.man
man -t $(srcdir)/vvp.man | ps2pdf - vvp.pdf $(MAN) -t $(srcdir)/vvp.man | $(PS2PDF) - vvp.pdf
ifeq (@MING32@,yes) ifeq (@MINGW32@,yes)
ifeq ($(MAN),none)
INSTALL_DOC = $(mandir)/man1/vvp.1
else
ifeq ($(PS2PDF),none)
INSTALL_DOC = $(mandir)/man1/vvp.1
else
INSTALL_DOC = $(prefix)/vvp.pdf $(mandir)/man1/vvp.1 INSTALL_DOC = $(prefix)/vvp.pdf $(mandir)/man1/vvp.1
INSTALL_DOCDIR = $(mandir)/man1
all: vvp.pdf all: vvp.pdf
endif
endif
INSTALL_DOCDIR = $(mandir)/man1
else else
INSTALL_DOC = $(mandir)/man1/vvp.1 INSTALL_DOC = $(mandir)/man1/vvp.1
INSTALL_DOCDIR = $(mandir)/man1 INSTALL_DOCDIR = $(mandir)/man1

View File

@ -5,6 +5,8 @@ AC_PROG_CC
AC_PROG_CXX AC_PROG_CXX
AC_PROG_RANLIB AC_PROG_RANLIB
AC_CHECK_TOOL(STRIP, strip, true) AC_CHECK_TOOL(STRIP, strip, true)
AC_CHECK_PROGS(MAN,man,none)
AC_CHECK_PROGS(PS2PDF,ps2pdf,none)
AC_EXEEXT AC_EXEEXT
AC_SUBST(EXEEXT) AC_SUBST(EXEEXT)

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2005-2007 Stephen Williams (steve@icarus.com) * Copyright (c) 2005-2008 Stephen Williams (steve@icarus.com)
* *
* (This is a rewrite of code that was ... * (This is a rewrite of code that was ...
* Copyright (c) 2001 Stephan Boettcher <stephan@nevis.columbia.edu>) * Copyright (c) 2001 Stephan Boettcher <stephan@nevis.columbia.edu>)
@ -19,9 +19,6 @@
* 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
*/ */
#ifdef HAVE_CVS_IDENT
#ident "$Id: udp.cc,v 1.35 2007/03/04 06:26:33 steve Exp $"
#endif
#include "udp.h" #include "udp.h"
#include "schedule.h" #include "schedule.h"
@ -228,7 +225,11 @@ void vvp_udp_comb_s::compile_table(char**tab)
cur.maskx = 0; cur.maskx = 0;
if (port_count() > 8*sizeof(cur.mask0)) { if (port_count() > 8*sizeof(cur.mask0)) {
fprintf(stderr, "internal error: primitive port count=%u " fprintf(stderr, "internal error: primitive port count=%u "
#ifdef __MINGW32__ /* MinGW does not know about z. */
" > %u\n", port_count(), sizeof(cur.mask0));
#else
" > %zu\n", port_count(), sizeof(cur.mask0)); " > %zu\n", port_count(), sizeof(cur.mask0));
#endif
assert(port_count() <= 8*sizeof(cur.mask0)); assert(port_count() <= 8*sizeof(cur.mask0));
} }
for (unsigned pp = 0 ; pp < port_count() ; pp += 1) { for (unsigned pp = 0 ; pp < port_count() ; pp += 1) {
@ -954,4 +955,3 @@ void compile_udp_functor(char*label, char*type,
wide_inputs_connect(core, argc, argv); wide_inputs_connect(core, argc, argv);
free(argv); free(argv);
} }

View File

@ -152,7 +152,15 @@ vpi_mcd_vprintf(PLI_UINT32 mcd, const char*fmt, va_list ap)
mcd, fmt); mcd, fmt);
} }
#ifdef __MINGW32__
/*
* The MinGW runtime (version 3.14) fixes some things, but breaks
* %f for us, so we have to us the underlying version.
*/
rc = _vsnprintf(buffer, sizeof buffer, fmt, ap);
#else
rc = vsnprintf(buffer, sizeof buffer, fmt, ap); rc = vsnprintf(buffer, sizeof buffer, fmt, ap);
#endif
for(int i = 0; i < 31; i++) { for(int i = 0; i < 31; i++) {
if((mcd>>i) & 1) { if((mcd>>i) & 1) {