Permalink
Browse files

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.
  • Loading branch information...
1 parent 6a9c5d8 commit b26bdd3c19dce85a06839b34f36834cb5bb0330f @caryr caryr committed with May 22, 2008
View
30 Makefile.in
@@ -16,9 +16,6 @@
# 59 Temple Place - Suite 330
# Boston, MA 02111-1307, USA
#
-#ident "$Id: Makefile.in,v 1.181 2007/05/24 04:07:11 steve Exp $"
-#
-#
SHELL = /bin/sh
# This version string is only used in the version message printed
@@ -51,6 +48,9 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_DATA = @INSTALL_DATA@
LEX = @LEX@
YACC = @YACC@
+MAN = @MAN@
+PS2PDF = @PS2PDF@
+GIT = @GIT@
CPPFLAGS = @ident_support@ @DEFS@ -I. -I$(srcdir) @CPPFLAGS@
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
# dosify text files.
-ifeq (@MING32@,yes)
+ifeq (@MINGW32@,yes)
all: dep dosify.exe
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)
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
- 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
# version.h file in the source tree (included in snapshots and releases), and
# finally use nothing.
.PHONY: version.h
version.h:
+ifeq ($(GIT),none)
+ @echo '#define VERSION_TAG ""' > $@;
+else
@if test -d $(srcdir)/.git; then \
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";'`; \
echo "$$tmp" | diff - $@ > /dev/null 2>&1 || echo "$$tmp" > $@ || exit 1; \
elif test -r $(srcdir)/$@; then \
@@ -199,11 +202,20 @@ version.h:
echo "Using empty VERSION_TAG"; \
echo '#define VERSION_TAG ""' > $@; \
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_DOCDIR = $(mandir)/man1
all: dep iverilog-vpi.pdf
+endif
+endif
+INSTALL_DOCDIR = $(mandir)/man1
else
INSTALL_DOC = $(mandir)/man1/iverilog-vpi.1
INSTALL_DOCDIR = $(mandir)/man1
View
7 cadpli/Makefile.in
@@ -16,12 +16,9 @@
# 59 Temple Place - Suite 330
# Boston, MA 02111-1307, USA
#
-#ident "$Id: Makefile.in,v 1.13 2007/02/06 05:07:31 steve Exp $"
-#
-#
SHELL = /bin/sh
-VERSION = 0.0
+VERSION = 0.9.devel
prefix = @prefix@
exec_prefix = @exec_prefix@
@@ -63,7 +60,7 @@ dep:
O = cadpli.o
SYSTEM_VPI_LDFLAGS = -L../vvp -lvpi
-ifeq (@MING32@,yes)
+ifeq (@MINGW32@,yes)
SYSTEM_VPI_LDFLAGS += @EXTRALIBS@
endif
View
3 configure.in
@@ -9,6 +9,9 @@ AC_PROG_CC
AC_PROG_CXX
AC_CHECK_TOOL(STRIP, strip, true)
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"
then
echo ""
View
7 driver-vpi/Makefile.in
@@ -16,12 +16,9 @@
# 59 Temple Place - Suite 330
# 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
-VERSION = 0.8.3
+VERSION = 0.9.devel
prefix = @prefix@
exec_prefix = @exec_prefix@
@@ -48,6 +45,8 @@ LDFLAGS = @LDFLAGS@
all: iverilog-vpi@EXEEXT@
+check: all
+
clean:
rm -f *.o config.h
rm -f iverilog-vpi@EXEEXT@
View
21 driver/Makefile.in
@@ -16,9 +16,6 @@
# 59 Temple Place - Suite 330
# Boston, MA 02111-1307, USA
#
-#ident "$Id: Makefile.in,v 1.26 2007/02/06 05:07:31 steve Exp $"
-#
-#
SHELL = /bin/sh
VERSION = 0.9.devel
@@ -41,6 +38,8 @@ CC = @CC@
INSTALL = @INSTALL@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_DATA = @INSTALL_DATA@
+MAN = @MAN@
+PS2PDF = @PS2PDF@
CPPFLAGS = @ident_support@ -I. -I.. -I$(srcdir)/.. -I$(srcdir) -DVERSION='"$(VERSION)"' @CPPFLAGS@ @DEFS@
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
iverilog.ps: $(srcdir)/iverilog.man
- man -t $(srcdir)/iverilog.man > iverilog.ps
+ $(MAN) -t $(srcdir)/iverilog.man > 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_DOCDIR = $(mandir)/man1
all: iverilog.pdf
+endif
+endif
+INSTALL_DOCDIR = $(mandir)/man1
else
INSTALL_DOC = $(mandir)/man1/iverilog.1
INSTALL_DOCDIR = $(mandir)/man1
View
4 driver/main.c
@@ -327,6 +327,9 @@ static int t_default(char*cmd, unsigned ncmd)
remove(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 == 127) {
@@ -342,6 +345,7 @@ static int t_default(char*cmd, unsigned ncmd)
}
return 0;
+#endif
}
View
4 ivlpp/lexor.lex
@@ -1616,7 +1616,11 @@ static int load_next_input()
static void do_dump_precompiled_defines(FILE* out, struct define_t* table)
{
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);
+#endif
if (table->left)
do_dump_precompiled_defines(out, table->left);
View
7 tgt-null/Makefile.in
@@ -16,12 +16,9 @@
# 59 Temple Place - Suite 330
# Boston, MA 02111-1307, USA
#
-#ident "$Id: Makefile.in,v 1.11 2004/02/10 19:25:01 steve Exp $"
-#
-#
SHELL = /bin/sh
-VERSION = 0.0
+VERSION = 0.9.devel
prefix = @prefix@
exec_prefix = @exec_prefix@
@@ -44,6 +41,8 @@ LDFLAGS = @LDFLAGS@
all: dep null.tgt
+check: all
+
dep:
mkdir dep
View
7 tgt-stub/Makefile.in
@@ -16,12 +16,9 @@
# 59 Temple Place - Suite 330
# Boston, MA 02111-1307, USA
#
-#ident "$Id: Makefile.in,v 1.20 2007/02/06 05:07:32 steve Exp $"
-#
-#
SHELL = /bin/sh
-VERSION = 0.0
+VERSION = 0.9.devel
prefix = @prefix@
exec_prefix = @exec_prefix@
@@ -44,6 +41,8 @@ LDFLAGS = @LDFLAGS@
all: dep stub.tgt
+check: all
+
dep:
mkdir dep
View
4 tgt-vvp/draw_vpi.c
@@ -25,6 +25,10 @@
# include <stdlib.h>
# include <assert.h>
+#ifdef __MINGW32__ /* MinGW has inconsistent %p output. */
+#define snprintf _snprintf
+#endif
+
static const char* magic_sfuncs[] = {
"$time",
"$stime",
View
4 tgt-vvp/modpath.c
@@ -22,6 +22,10 @@
# include <stdlib.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)
{
int idx;
View
8 tgt-vvp/vvp_scope.c
@@ -27,6 +27,10 @@
# include <inttypes.h>
# include <assert.h>
+#ifdef __MINGW32__ /* MinGW has inconsistent %p output. */
+#define snprintf _snprintf
+#endif
+
struct vvp_nexus_data {
/* draw_net_input uses this */
const char*net_input;
@@ -1759,7 +1763,11 @@ static void draw_lpm_add(ivl_lpm_t net)
type = "pow.s";
if (width > 8*sizeof(long)) {
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",
+#endif
ivl_lpm_file(net), ivl_lpm_lineno(net),
8*sizeof(long));
exit(1);
View
9 vpi/Makefile.in
@@ -16,12 +16,9 @@
# 59 Temple Place - Suite 330
# Boston, MA 02111-1307, USA
#
-#ident "$Id: Makefile.in,v 1.61 2007/02/06 05:07:32 steve Exp $"
-#
-#
SHELL = /bin/sh
-VERSION = 0.0
+VERSION = 0.9.devel
prefix = @prefix@
exec_prefix = @exec_prefix@
@@ -48,6 +45,8 @@ LDFLAGS = @LDFLAGS@
all: dep system.vpi va_math.vpi $(ALL32)
+check: all
+
dep:
mkdir dep
@@ -75,7 +74,7 @@ V = va_math.o
LIBS = @LIBS@
SYSTEM_VPI_LDFLAGS = $(LIBS)
VA_MATH_LDFLAGS =
-ifeq (@MING32@,yes)
+ifeq (@MINGW32@,yes)
SYSTEM_VPI_LDFLAGS += @EXTRALIBS@
VA_MATH_LDFLAGS += @EXTRALIBS@
endif
View
16 vvp/Makefile.in
@@ -43,6 +43,8 @@ INSTALL_DATA = @INSTALL_DATA@
RANLIB = @RANLIB@
LEX = @LEX@
YACC = @YACC@
+MAN = @MAN@
+PS2PDF = @PS2PDF@
CPPFLAGS = @ident_support@ -I. -I.. -I $(srcdir) -I$(srcdir)/.. @CPPFLAGS@ @DEFS@
CXXFLAGS = -Wall @CXXFLAGS@
@@ -133,12 +135,20 @@ lexor.cc: $(srcdir)/lexor.lex
$(LEX) -s -olexor.cc $(srcdir)/lexor.lex
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_DOCDIR = $(mandir)/man1
all: vvp.pdf
+endif
+endif
+INSTALL_DOCDIR = $(mandir)/man1
else
INSTALL_DOC = $(mandir)/man1/vvp.1
INSTALL_DOCDIR = $(mandir)/man1
View
2 vvp/configure.in
@@ -5,6 +5,8 @@ AC_PROG_CC
AC_PROG_CXX
AC_PROG_RANLIB
AC_CHECK_TOOL(STRIP, strip, true)
+AC_CHECK_PROGS(MAN,man,none)
+AC_CHECK_PROGS(PS2PDF,ps2pdf,none)
AC_EXEEXT
AC_SUBST(EXEEXT)
View
10 vvp/udp.cc
@@ -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 ...
* Copyright (c) 2001 Stephan Boettcher <stephan@nevis.columbia.edu>)
@@ -19,9 +19,6 @@
* along with this program; if not, write to the Free Software
* 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 "schedule.h"
@@ -228,7 +225,11 @@ void vvp_udp_comb_s::compile_table(char**tab)
cur.maskx = 0;
if (port_count() > 8*sizeof(cur.mask0)) {
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));
+#endif
assert(port_count() <= 8*sizeof(cur.mask0));
}
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);
free(argv);
}
-
View
8 vvp/vpi_mcd.cc
@@ -152,7 +152,15 @@ vpi_mcd_vprintf(PLI_UINT32 mcd, const char*fmt, va_list ap)
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);
+#endif
for(int i = 0; i < 31; i++) {
if((mcd>>i) & 1) {

0 comments on commit b26bdd3

Please sign in to comment.