Fix up convert.c generation

- Use a temporary file for convert.c to reduce likelihood of an interrupted
  build resulting in bad code being written to convert.c
- Truncate the file instead of appending to it to ensure that the file being
  touched will not result in duplicate declarations/definitions from
  kern_acct.c if/when kern_acct.c changes.

MFC after: 1 week
This commit is contained in:
Enji Cooper 2015-11-23 09:15:20 +00:00
parent 2b4bcea740
commit 467afe7b9a
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=291180

View file

@ -6,12 +6,13 @@ ATF_TESTS_C= acct_test
CFLAGS+= -I${.OBJDIR}
CLEANFILES+= convert.c
CLEANFILES+= convert.c convert.c.tmp
DPSRCS.acct_test= convert.c
convert.c: ${SRCTOP}/sys/kern/kern_acct.c
sed -n -e 's/log(/syslog(/g' \
-e '/FLOAT_CONVERSION_START/,/FLOAT_CONVERSION_END/p' ${.ALLSRC} >>${.TARGET}
-e '/FLOAT_CONVERSION_START/,/FLOAT_CONVERSION_END/p' ${.ALLSRC} >${.TARGET}.tmp
mv ${.TARGET}.tmp ${.TARGET}
.include <bsd.test.mk>