use better method of creating version string, current method can
introduce spurious " characters during stringification
This commit is contained in:
parent
be9c987bdd
commit
43d2b2a329
|
@ -1,4 +1,4 @@
|
|||
# $NetBSD: Makefile.inc,v 1.12 2011/06/03 13:31:25 plunky Exp $
|
||||
# $NetBSD: Makefile.inc,v 1.13 2011/06/07 13:07:26 plunky Exp $
|
||||
|
||||
PCC_DIR:=${.PARSEDIR}
|
||||
PCC_DIST=${PCC_DIR}/dist/pcc
|
||||
|
@ -18,6 +18,7 @@ TARGMACH = ${MACHINE_ARCH}
|
|||
ERROR!= echo "ERROR: ${TARGMACH} not yet supported - write code!" >&2;echo
|
||||
.endif
|
||||
|
||||
# this string will be updated by the prepare-import.sh script
|
||||
VERSSTR = PACKAGE_STRING " for ${TARGOS}-${TARGMACH}"
|
||||
|
||||
CPPFLAGS+= -DGCC_COMPAT
|
||||
|
|
|
@ -50,19 +50,24 @@ env -i PATH=/bin:/usr/bin /bin/sh ../pcc/configure
|
|||
cd ../..
|
||||
#
|
||||
# comment out items we provide at build time from Makefile.inc
|
||||
# modify the PACKAGE_STRING to include the checkout date
|
||||
# define PREPROCESSOR as pcpp to avoid conflicts with GCC
|
||||
#
|
||||
datestamp=$(cat work/pcc/DATESTAMP)
|
||||
sed -e "s,^\(#define[[:space:]]*VERSSTR[[:>:]].*\)\$,/* \1 */," \
|
||||
-e "s,^\(#define[[:space:]]*HOST_BIG_ENDIAN[[:>:]].*\)\$,/* \1 */," \
|
||||
-e "s,^\(#define[[:space:]]*HOST_LITTLE_ENDIAN[[:>:]].*\)\$,/* \1 */," \
|
||||
-e "s,^\(#define[[:space:]]*TARGET_BIG_ENDIAN[[:>:]].*\)\$,/* \1 */," \
|
||||
-e "s,^\(#define[[:space:]]*TARGET_LITTLE_ENDIAN[[:>:]].*\)\$,/* \1 */," \
|
||||
-e "s,^\(#define[[:space:]]*PACKAGE_STRING[[:>:]].*\".*\)\(\".*\)\$,\1 [${datestamp}]\2," \
|
||||
-e "s,^\(.*[[:<:]]PREPROCESSOR[[:>:]].*\)\$,#define PREPROCESSOR \"pcpp\"," \
|
||||
< work/tmp/config.h > work/config.h
|
||||
|
||||
#
|
||||
# update Makefile.inc to create version string at build time
|
||||
#
|
||||
datestamp=$(cat work/pcc/DATESTAMP)
|
||||
version=$(sed -n -e "/PACKAGE_VERSION/s/.*\"\(.*\)\"/\1/p" < work/config.h)
|
||||
sed -e "s,^VERSSTR=.*$,VERSSTR=\"pcc ${version} ${datestamp} for \${TARGMACH}-\${TARGOS}\"," \
|
||||
< Makefile.inc > work/Makefile.inc
|
||||
|
||||
echo "====> Replacing pcc sources..."
|
||||
rm -Rf dist/pcc dist/pcc-libs
|
||||
mv work/pcc work/pcc-libs dist
|
||||
|
@ -70,6 +75,10 @@ if cmp -s work/config.h include/config.h; then :; else
|
|||
echo "====> Updating include/config.h..."
|
||||
mv work/config.h include/config.h
|
||||
fi
|
||||
if cmp -s work/Makefile.inc Makefile.inc; then :; else
|
||||
echo "====> Updating Makefile.inc..."
|
||||
mv work/Makefile.inc Makefile.inc
|
||||
fi
|
||||
|
||||
echo "====> Done."
|
||||
rm -Rf work
|
||||
|
|
Loading…
Reference in New Issue