aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulio Merino <jmmv@FreeBSD.org>2014-07-14 13:53:10 +0000
committerJulio Merino <jmmv@FreeBSD.org>2014-07-14 13:53:10 +0000
commitb32cce1f82e08079bf3ca649e143cb9a15a4b1e8 (patch)
treeedc8321586c0400e35da3b2ad33a40a477751344
parent2d2187338e923e7d2cf38d500c50603459addd59 (diff)
downloadsrc-b32cce1f82e08079bf3ca649e143cb9a15a4b1e8.tar.gz
src-b32cce1f82e08079bf3ca649e143cb9a15a4b1e8.zip
Make generation of nslexer.c more robust.
Ensure that lex errors fail the build instead of being silently ignored due to the piped call. Also postpone the update of the nslexer.c file until we are sure we have generated it properly. These changes fix some very obscure build failures I encountered while building FreeBSD within a chroot that did not have devfs mounted. The specific errors looked like: .../libc.so.7: undefined reference to `_nsyyerror' .../libc.so.7: undefined reference to `_nsyyin' .../libc.so.7: undefined reference to `_nsyylex' .../libc.so.7: undefined reference to `_nsyylineno' .../libc.so.7: undefined reference to `_nsyytext' and were caused due to a mangled nslexer.c being linked into libc.
Notes
Notes: svn path=/head/; revision=268620
-rw-r--r--lib/libc/net/Makefile.inc8
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/libc/net/Makefile.inc b/lib/libc/net/Makefile.inc
index 59cbdea47697..c6307afc1d53 100644
--- a/lib/libc/net/Makefile.inc
+++ b/lib/libc/net/Makefile.inc
@@ -34,11 +34,13 @@ CFLAGS+=-I${LIBC_SRCTOP}/resolv
YFLAGS+=-p_nsyy
LFLAGS+=-P_nsyy
-CLEANFILES+=nslexer.c
+CLEANFILES+=nslexer.c nslexer.c.*
nslexer.c: nslexer.l nsparser.h
- ${LEX} ${LFLAGS} -o/dev/stdout ${.IMPSRC} | \
- sed -e '/YY_BUF_SIZE/s/16384/1024/' >${.TARGET}
+ ${LEX} ${LFLAGS} -o${.TARGET}.tmp1 ${.IMPSRC}
+ sed -e '/YY_BUF_SIZE/s/16384/1024/' ${.TARGET}.tmp1 >${.TARGET}.tmp2
+ rm -f ${.TARGET}.tmp1
+ mv -f ${.TARGET}.tmp2 ${.TARGET}
MAN+= byteorder.3 ethers.3 eui64.3 \
getaddrinfo.3 gai_strerror.3 gethostbyname.3 \