Permalink
Browse files

Add install of examples for Windows.

  • Loading branch information...
1 parent b72d1c2 commit 176e6d09ca0c89869928bbff690a32b7f909b27d steve committed Aug 3, 2001
Showing with 104 additions and 3 deletions.
  1. +1 −0 .cvsignore
  2. +28 −3 Makefile.in
  3. +75 −0 dosify.c
View
@@ -16,3 +16,4 @@ config.status
config.log
config.cache
config.h
+dosify
View
@@ -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
View
@@ -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 <stdio.h>
+
+int main(int argc, char*argv[])
+{
+ FILE*ifile;
+ FILE*ofile;
+ int ch, pr;
+
+ if (argc != 3) {
+ fprintf(stderr, "Usage: %s <input> <output>\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.
+ *
+ */
+

0 comments on commit 176e6d0

Please sign in to comment.