From 25fb21e2c0439fbcc1b1df3fbd1984941e980d94 Mon Sep 17 00:00:00 2001 From: Marc Espie Date: Tue, 10 Feb 2004 02:02:23 +0000 Subject: Clean-up logic, support -$ on gcc2, nothing on gcc3. Add -notraditional to help the transition into not -trad land. ok deraadt@ --- usr.bin/cpp/Makefile | 18 +++++++++++++----- usr.bin/cpp/cpp.sh | 35 ++++++++++++++++------------------- 2 files changed, 29 insertions(+), 24 deletions(-) (limited to 'usr.bin/cpp') diff --git a/usr.bin/cpp/Makefile b/usr.bin/cpp/Makefile index 53cd6ee212b..b99cc0482c2 100644 --- a/usr.bin/cpp/Makefile +++ b/usr.bin/cpp/Makefile @@ -1,10 +1,18 @@ -# $OpenBSD: Makefile,v 1.7 1999/12/23 07:14:12 mickey Exp $ +# $OpenBSD: Makefile,v 1.8 2004/02/10 02:02:22 espie Exp $ + +.include NOMAN= -NOOBJ= -beforeinstall: - ${INSTALL} ${INSTALL_COPY} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \ - ${.CURDIR}/cpp.sh ${DESTDIR}${BINDIR}/cpp +PROG=cpp +SRCS= +INSTALL_STRIP= + +cpp: cpp.sh +.if ${USE_GCC3:L} == "no" + sed -e 's/@dollaropt@/-$$/' ${.CURDIR}/cpp.sh >$@ +.else + sed -e 's/@dollaropt@//' ${.CURDIR}/cpp.sh >$@ +.endif .include diff --git a/usr.bin/cpp/cpp.sh b/usr.bin/cpp/cpp.sh index 30933b8b418..baf0989f021 100644 --- a/usr.bin/cpp/cpp.sh +++ b/usr.bin/cpp/cpp.sh @@ -1,5 +1,5 @@ #!/bin/sh -# $OpenBSD: cpp.sh,v 1.6 2003/06/03 02:56:07 millert Exp $ +# $OpenBSD: cpp.sh,v 1.7 2004/02/10 02:02:22 espie Exp $ # # Copyright (c) 1990 The Regents of the University of California. @@ -40,11 +40,13 @@ # doesn't search gcc-include # PATH=/usr/bin:/bin -ALST="-traditional -$ -D__GNUC__" -NSI=no +TRAD=-traditional +DGNUC="-D__GNUC__" +STDINC="-I/usr/include" +DOLLAR="@dollaropt@" OPTS="" INCS="-nostdinc" -FOUNDFILES=no +FOUNDFILES=false CPP=/usr/libexec/cpp if [ ! -x $CPP ]; then @@ -62,15 +64,19 @@ do case $A in -nostdinc) - NSI=yes + STDINC= ;; -traditional) + TRAD=-traditional + ;; + -notraditional) + TRAD= ;; -I*) INCS="$INCS $A" ;; -U__GNUC__) - ALST=`echo $ALST | sed -e s/-D__GNUC__//` + DGNUC= ;; -imacros|-include|-idirafter|-iprefix|-iwithprefix) INCS="$INCS '$A' '$1'" @@ -80,25 +86,16 @@ do OPTS="$OPTS '$A'" ;; *) - FOUNDFILES=yes - if [ $NSI = "no" ] - then - INCS="$INCS -I/usr/include" - NSI=skip - fi - eval $CPP $ALST $INCS $OPTS $A || exit $? + FOUNDFILES=true + eval $CPP $TRAD $DGNUC $DOLLAR $INCS $STDINC $OPTS $A || exit $? ;; esac done -if [ $FOUNDFILES = "no" ] +if ! $FOUNDFILES then # read standard input - if [ $NSI = "no" ] - then - INCS="$INCS -I/usr/include" - fi - eval exec $CPP $ALST $INCS $OPTS + eval exec $CPP $TRAD $DGNUC $DOLLAR $INCS $STDINC $OPTS fi exit 0 -- cgit v1.2.3