This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: cpp replacement
- To: law at cygnus dot com
- Subject: Re: cpp replacement
- From: Zack Weinberg <zack at rabi dot columbia dot edu>
- Date: Sun, 31 Jan 1999 22:24:54 -0500
- cc: egcs-patches at cygnus dot com, Manfred Hollstein <manfred at s-direktnet dot de>
On Sun, 31 Jan 1999 12:45:16 -0700, Jeffrey A Law wrote:
>
>When y'all have settled on the script, can you send a patch which includes the
>cpp script and the Makefile.in changes to get the script installed?
>
>We actually wanted to include this kind of script in egcs-1.1, but it fell
>through the cracks.
Here's my patch. It should work correctly on all supported Unixes,
but I doubt it works on cygwin/mingwin/djgpp. Shouldn't be too hard
to fix, just gotta find someone who knows how you get shell scripts to
be executable under DOS.
zw
1999-01-31 22:22 -0500 Zack Weinberg <zack@rabi.columbia.edu>
* cpp.in: New file.
* Makefile.in (install-driver): Also install cpp wrapper in
$(bindir).
(xcpp): New target.
============================================================
Index: Makefile.in
--- Makefile.in 1999/01/27 15:45:43 1.220
+++ Makefile.in 1999/02/01 03:21:37
@@ -2539,7 +2539,7 @@
# Install the driver program as $(target_alias)-gcc
# and also as either gcc (if native) or $(gcc_tooldir)/bin/gcc.
-install-driver: xgcc$(exeext)
+install-driver: xgcc$(exeext) xcpp$(exeext)
-if [ -f gcc-cross$(exeext) ] ; then \
rm -f $(bindir)/$(GCC_CROSS_NAME)$(exeext); \
$(INSTALL_PROGRAM) gcc-cross$(exeext) $(bindir)/$(GCC_CROSS_NAME)$(exeext); \
@@ -2553,7 +2553,14 @@
rm -f $(bindir)/$(target_alias)-gcc-1$(exeext); \
$(LN) $(bindir)/$(GCC_INSTALL_NAME)$(exeext) $(bindir)/$(target_alias)-gcc-1$(exeext); \
mv $(bindir)/$(target_alias)-gcc-1$(exeext) $(bindir)/$(target_alias)-gcc$(exeext); \
+ rm -f $(bindir)/cpp$(exeext); \
+ $(INSTALL_PROGRAM) xcpp$(exeext) $(bindir)/cpp$(exeext); \
fi
+
+xcpp$(exeext): $(srcdir)/cpp.in
+ sed -e 's%@GCC@%$(bindir)/'$(GCC_INSTALL_NAME)'$(exeext)%' \
+ $(srcdir)/cpp.in >xcpp.T
+ mv -f xcpp.T xcpp$(exeext)
# Install the info files.
# $(INSTALL_DATA) might be a relative pathname, so we can't cd into srcdir
============================================================
Index: cpp.in
--- cpp.in Wed Dec 31 19:00:00 1969
+++ cpp.in Sun Jan 31 21:41:42 1999 1.1
@@ -0,0 +1,41 @@
+#! /bin/sh
+
+# Copyright (C) 1999 Free Software Foundation, Inc.
+# This program is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by the
+# Free Software Foundation; either version 2, 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, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+# cpp: wrapper script for `gcc -E'
+
+# Check whether an input file was specified.
+# This has some limited awareness of which switches take arguments.
+
+stdin="-"
+next_is_arg=
+for arg
+do
+ if [ -n "$next_is_arg" ]
+ then next_is_arg=
+ else
+ case "$arg" in
+ -i* | -o | -x) next_is_arg=t;;
+ -) stdin= ;;
+ -*) ;;
+ *) stdin= ;;
+ esac
+ fi
+done
+
+# Hand off to the gcc driver, with -E (preprocess only)
+# and -xc (treat unknown files as source, not linker scripts)
+exec @GCC@ -E -xc ${1+"$@"} $stdin