[squid-dev] [PATCH] Do not update gperf-generated files through make
Amos Jeffries
squid3 at treenet.co.nz
Mon Sep 21 16:57:14 UTC 2015
On 22/09/2015 4:40 a.m., Alex Rousskov wrote:
> On 09/21/2015 10:24 AM, Kinkie wrote:
>
>> since we include the gperf-generated files in the source
>> distribution, it doesn't really make sense to build them through Make
>> - depending on the relative timestamps of the .cci and .gperf files at
>> checkout, some systems may decide to rebuild the .cci file.
>> The side effect of such a rebuild are a greatly lengthened build time
>> - if we want to have a perfect hash we need to try many hash functions
>> - for no benefit at all.
>> This also highlighted a gmake-ism in the Makefile.am which recently
>> caused some failed builds on FreeBSD 9.3.
>>
>> The attached patch removes the Makefile.am dependency of the .cci
>> file, and replaces it with a comment in the .gperf file; we want to
>> rerun gperf only when touching the .gperf file and that's expected to
>> be a very rare event.
>
>
> I agree that the default Squid build should not rely on gperf presence
> or depend on RegisteredHeadersHash.cci timestamp.
>
> It would be better to have a dedicated make target (unused by "make
> all") that would rebuild all gperf-related file(s), but if that is
> difficult to add, we can live with a comment IMHO. If we go the comment
> route, I recommend leaving commented-out rules in the Makefile and s/to
> regenerate:/to generate RegisteredHeadersHash.cci:/ in
> RegisteredHeadersHash.gperf.
>
The only difficult part would be making it work recursively from the top
level Makefile. But that is probably not necessary.
I've not tested it, but the attached should do what we want. With the
maintenance infrastructure rebuilding the .cci IFF it needs to be, or
manual makes, but no other builds doing so.
Amos
-------------- next part --------------
=== modified file 'scripts/source-maintenance.sh'
--- scripts/source-maintenance.sh 2015-08-04 05:32:35 +0000
+++ scripts/source-maintenance.sh 2015-09-21 16:49:54 +0000
@@ -260,27 +260,31 @@
for f in `ls -1 ${ROOT}/doc/manuals/*.po | sort -u`
do
echo " \\"
echo -n " ${f}"
done
echo " "
)| sed s%${ROOT}/doc/manuals/%%g | sed s%\.po%\.lang%g >${ROOT}/doc/manuals/language.list
# Build STUB framework include from current stub_* available
(
sed -e 's%\ \*%##%' -e 's%/\*%##%' -e 's%##/%##%' <scripts/boilerplate.h
echo -n "STUB_SOURCE= tests/STUB.h"
for f in `ls -1 ${ROOT}/src/tests/stub_*.cc | sort -u`
do
echo " \\"
echo -n " ${f}"
done
echo " "
)| sed s%${ROOT}/src/%%g >${ROOT}/src/tests/Stub.list
+# Build the GPERF generated content
+cd ${ROOT}/src/http && make gperf-files
+cd ${ROOT}
+
# Run formating
echo "" >${ROOT}/doc/debug-sections.tmp
srcformat || exit 1
sort -u <${ROOT}/doc/debug-sections.tmp | sort -n >${ROOT}/doc/debug-sections.tmp2
cat scripts/boilerplate.h ${ROOT}/doc/debug-sections.tmp2 >${ROOT}/doc/debug-sections.txt
rm ${ROOT}/doc/debug-sections.tmp ${ROOT}/doc/debug-sections.tmp2
rm ${ROOT}/boilerplate_fix.sed
=== modified file 'src/http/Makefile.am'
--- src/http/Makefile.am 2015-09-05 18:52:17 +0000
+++ src/http/Makefile.am 2015-09-21 16:52:59 +0000
@@ -4,38 +4,41 @@
## contributions from numerous individuals and organizations.
## Please see the COPYING and CONTRIBUTORS files for details.
##
include $(top_srcdir)/src/Common.am
include $(top_srcdir)/src/TestHeaders.am
SUBDIRS = one
DIST_SUBDIRS = one
noinst_LTLIBRARIES = libsquid-http.la
libsquid_http_la_SOURCES = \
forward.h \
MethodType.cc \
MethodType.h \
ProtocolVersion.h \
RegisteredHeaders.h \
RegisteredHeaders.cc \
RegisteredHeadersHash.cci \
- RegisteredHeadersHash.gperf \
RequestMethod.cc \
RequestMethod.h \
StatusCode.cc \
StatusCode.h \
StatusLine.cc \
StatusLine.h
libsquid_http_la_LIBADD= one/libhttp1.la
MethodType.cc: MethodType.h $(top_srcdir)/src/mk-string-arrays.awk
($(AWK) -f $(top_srcdir)/src/mk-string-arrays.awk sbuf=1 < $(srcdir)/MethodType.h | \
sed -e 's%METHOD_%%' -e 's%_C%-C%' >$@) || ($(RM) -f $@ && exit 1)
-RegisteredHeadersHash.cci: RegisteredHeadersHash.gperf
- gperf --output-file=$@ -m 100000 $<
+gperf-files: RegisteredHeadersHash.gperf
+ @if test $(srcdir)/RegisteredHeadersHash.gperf -gt $(srcdir)/RegisteredHeadersHash.cci; then \
+ gperf --output-file=$(srcdir)/RegisteredHeadersHash.cci -m 100000 $< \
+ fi
CLEANFILES += MethodType.cc
+
+.PHONY: gperf-files
More information about the squid-dev
mailing list