summaryrefslogtreecommitdiffstats
path: root/usr.bin/mkdep
diff options
context:
space:
mode:
authorbde <bde@FreeBSD.org>1994-08-30 16:36:49 +0000
committerbde <bde@FreeBSD.org>1994-08-30 16:36:49 +0000
commit199077a74392650626223a59afa8ce35352d0392 (patch)
tree2d32cd1eb9d849a828ce21134c73150936067bb1 /usr.bin/mkdep
parent066424d7d90e7d0765df0a003162d7ef0533da50 (diff)
downloadFreeBSD-src-199077a74392650626223a59afa8ce35352d0392.zip
FreeBSD-src-199077a74392650626223a59afa8ce35352d0392.tar.gz
Use cc -E instead of cpp for the preprocessor by default. cc -E is
correct for C sources that are compiled by cc, while cpp (/usr/bin/cpp) is bogus since it invokes /usr/libexec/cpp with different flags. 1.1.5 uses plain cc. This should be equivalent after -M is added, but cc -M foo.s is completely broken (it invokes the assembler) while cc -E -M foo.s just does nothing instead of generating a foo.o: foo.s dependency. IF $MKDEP_CPP is set, use it as the cpp instead of cc -E. Assembler sources that are preprocessed using cpp directly should be mkdep'ed with MKDEP_CPP=cpp. Such sources shouldn't exist but we still have lots. foo.S should be compiled by cc -traditional (cc will invoke the preprocessor) and foo.s should be compiled by cc (cc won't invoke the preprocessor).
Diffstat (limited to 'usr.bin/mkdep')
-rw-r--r--usr.bin/mkdep/mkdep.gcc.sh9
1 files changed, 7 insertions, 2 deletions
diff --git a/usr.bin/mkdep/mkdep.gcc.sh b/usr.bin/mkdep/mkdep.gcc.sh
index 26f80d6..59e4e47 100644
--- a/usr.bin/mkdep/mkdep.gcc.sh
+++ b/usr.bin/mkdep/mkdep.gcc.sh
@@ -72,10 +72,15 @@ TMP=/tmp/mkdep$$
trap 'rm -f $TMP ; exit 1' 1 2 3 13 15
+# For C sources, mkdep must use exactly the same cpp and predefined flags
+# as the compiler would. This is easily arranged by letting the compiler
+# pick the cpp. mkdep must be told the cpp to use for exceptional cases.
+MKDEP_CPP=${MKDEP_CPP-"cc -E"}
+
if [ x$pflag = x ]; then
- cpp -M $* | sed -e 's; \./; ;g' > $TMP
+ $MKDEP_CPP -M $* | sed -e 's; \./; ;g' > $TMP
else
- cpp -M $* | sed -e 's;\.o :; :;' -e 's; \./; ;g' > $TMP
+ $MKDEP_CPP -M $* | sed -e 's;\.o :; :;' -e 's; \./; ;g' > $TMP
fi
if [ $? != 0 ]; then
OpenPOWER on IntegriCloud