diff --git a/.cvsignore b/.cvsignore index fee14e6ef..6a3bfe09a 100644 --- a/.cvsignore +++ b/.cvsignore @@ -16,3 +16,4 @@ config.status config.log config.cache config.h +dosify diff --git a/Makefile.in b/Makefile.in index cfd8f8d5f..064222fae 100644 --- a/Makefile.in +++ b/Makefile.in @@ -16,12 +16,12 @@ # 59 Temple Place - Suite 330 # Boston, MA 02111-1307, USA # -#ident "$Id: Makefile.in,v 1.99 2001/07/25 03:10:48 steve Exp $" +#ident "$Id: Makefile.in,v 1.100 2001/08/03 17:06:47 steve Exp $" # # SHELL = /bin/sh -VERSION = 0.3 +VERSION = 0.5 prefix = @prefix@ exec_prefix = @exec_prefix@ @@ -70,6 +70,14 @@ all: ivl@EXEEXT@ libvpi.a cd tgt-stub ; $(MAKE) all for tgt in $(TARGETS); do (cd $$tgt ; $(MAKE) all); done +# In the windows world, the installer will need a dosify program to +# dosify text files. +ifeq (@WIN32@,yes) +all: dosify.exe +dosify.exe: dosify.c + $(CC) -o dosify.exe dosify.c +endif + # This rule rules the compiler in the trivial hello.vl program to make # sure the basics were compiled properly. check: all @@ -172,8 +180,11 @@ lexor_keyword.o: lexor_keyword.cc lexor_keyword.cc: lexor_keyword.gperf gperf -o -i 7 -C -k 1-3,$$ -L ANSI-C -H keyword_hash -N check_identifier -t $(srcdir)/lexor_keyword.gperf > lexor_keyword.cc || (rm -f lexor_keyword.cc ; false) +ifeq (@WIN32@,yes) +WIN32_INSTALL = $(prefix)/hello.v $(prefix)/sqrt.v $(prefix)/QUICK_START.txt +endif -install: all installdirs $(libdir)/ivl/ivl@EXEEXT@ $(libdir)/ivl/iverilog.conf $(includedir)/ivl_target.h $(includedir)/vpi_user.h $(libdir)/libvpi.a +install: all installdirs $(libdir)/ivl/ivl@EXEEXT@ $(libdir)/ivl/iverilog.conf $(includedir)/ivl_target.h $(includedir)/vpi_user.h $(libdir)/libvpi.a $(WIN32_INSTALL) cd vvm ; $(MAKE) install cd vpi ; $(MAKE) install cd ivlpp ; $(MAKE) install @@ -197,9 +208,23 @@ $(includedir)/ivl_target.h: $(srcdir)/ivl_target.h $(includedir)/vpi_user.h: $(srcdir)/vpi_user.h $(INSTALL_DATA) $(srcdir)/vpi_user.h $(includedir)/vpi_user.h +# In windows installations, put a few examples and the quick_start +# into the destination directory. +ifeq (@WIN32@,yes) +$(prefix)/hello.v: $(srcdir)/examples/hello.v + ./dosify.exe $(srcdir)/examples/hello.v $(prefix)/hello.v + +$(prefix)/sqrt.v: $(srcdir)/examples/sqrt.v + ./dosify.exe $(srcdir)/examples/sqrt.v $(prefix)/sqrt.v + +$(prefix)/QUICK_START.txt: $(srcdir)/QUICK_START.txt + ./dosify.exe $(srcdir)/QUICK_START.txt $(prefix)/QUICK_START.txt +endif + installdirs: mkinstalldirs $(srcdir)/mkinstalldirs $(bindir) $(includedir) $(libdir)/ivl + uninstall: rm -f $(libdir)/ivl/ivl@EXEEXT@ rm -f $(bindir)/verilog diff --git a/dosify.c b/dosify.c new file mode 100644 index 000000000..7ee679cbc --- /dev/null +++ b/dosify.c @@ -0,0 +1,75 @@ +/* + * Copyright (c) 2001 Stephen Williams (steve@icarus.com) + * + * This source code is free software; you can redistribute it + * and/or modify it in source code form under the terms of the GNU + * General Public License as published by the Free Software + * Foundation; either version 2 of the License, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + * + * $Id: dosify.c,v 1.1 2001/08/03 17:06:47 steve Exp $ + */ + +/* + * This is a simple program to make a dosified copy of the + * original. That is, it converts unix style line ends to DOS + * style. This is useful for installing text files. + * + * The exact substitution is to replace \n with \r\n. If the line + * already ends with \r\n then it is not changed to \r\r\n. + */ + +# include + +int main(int argc, char*argv[]) +{ + FILE*ifile; + FILE*ofile; + int ch, pr; + + if (argc != 3) { + fprintf(stderr, "Usage: %s \n", argv[0]); + return 1; + } + + ifile = fopen(argv[1], "rb"); + if (ifile == 0) { + fprintf(stderr, "Unable to open %s for input.\n", argv[1]); + return 2; + } + + ofile = fopen(argv[2], "wb"); + if (ofile == 0) { + fprintf(stderr, "Unable to open %s for output.\n", argv[2]); + return 2; + } + + pr = 0; + while ((ch = fgetc(ifile)) != EOF) { + + if ((ch == '\n') && (pr != '\r')) + fputc('\r', ofile); + + fputc(ch, ofile); + pr = ch; + } + + return 0; +} + +/* + * $Log: dosify.c,v $ + * Revision 1.1 2001/08/03 17:06:47 steve + * Add install of examples for Windows. + * + */ +