diff options
author | Marc Espie <espie@cvs.openbsd.org> | 2004-02-10 02:02:23 +0000 |
---|---|---|
committer | Marc Espie <espie@cvs.openbsd.org> | 2004-02-10 02:02:23 +0000 |
commit | 25fb21e2c0439fbcc1b1df3fbd1984941e980d94 (patch) | |
tree | 5876c412c5b652a12345fd199a51d36f773e3673 /usr.bin/cpp | |
parent | 911978d4f2b447e702a23c52e8a5536e012a8488 (diff) |
Clean-up logic, support -$ on gcc2, nothing on gcc3.
Add -notraditional to help the transition into not -trad land.
ok deraadt@
Diffstat (limited to 'usr.bin/cpp')
-rw-r--r-- | usr.bin/cpp/Makefile | 18 | ||||
-rw-r--r-- | usr.bin/cpp/cpp.sh | 35 |
2 files changed, 29 insertions, 24 deletions
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 <bsd.own.mk> 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 <bsd.prog.mk> 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 |