@@ -222,10 +222,15 @@ check-install-layout:
222222# route std::thread through pthread (e.g. MSVC's Microsoft STL).
223223# ---------------------------------------------------------------------------
224224
225+ # NOTE: each entry matches a basename; the grep in check-hygiene anchors with a
226+ # leading '/' so e.g. mypthread.h is not a false positive. Keep this list in
227+ # sync with the #ifdef ladder in test/unit/header_hygiene_test.cpp.
225228HEADER_HYGIENE_FORBIDDEN = microhttpd\.h|gnutls/gnutls\.h|sys/socket\.h|sys/uio\.h
226- CHECK_HYGIENE_STAGE = $(abs_top_builddir ) /.hygiene-stage
227- CHECK_HYGIENE_CXX = $(CXX ) -std=c++20 -E -I$(CHECK_HYGIENE_STAGE )$(includedir ) $(CPPFLAGS )
228- HEADER_HYGIENE_STRICT ?= yes
229+ CHECK_HYGIENE_STAGE = $(abs_top_builddir ) /.hygiene-stage
230+ CHECK_HYGIENE_CXX = $(CXX ) -std=c++20 -E -I$(CHECK_HYGIENE_STAGE )$(includedir ) $(CPPFLAGS )
231+ # Override on the command line to run against an in-flight umbrella:
232+ # make check-hygiene HEADER_HYGIENE_STRICT=no
233+ HEADER_HYGIENE_STRICT ?= yes
229234
230235# Sentinel file: only re-run the staged install when headers have changed.
231236# This is an mtime gate used exclusively for standalone `make check-hygiene`
@@ -235,7 +240,10 @@ HEADER_HYGIENE_STRICT ?= yes
235240# own pre-built shared stage, so this stamp target is bypassed entirely.
236241HYGIENE_STAMP = $(CHECK_HYGIENE_STAGE ) /.hygiene-stamp
237242
238- $(HYGIENE_STAMP ) : $(wildcard $(top_srcdir ) /src/httpserver/* .hpp)
243+ # NOTE: wildcard is evaluated at parse time; run `make clean` if new headers
244+ # are added to src/httpserver/ in the same invocation that generates them.
245+ # Also includes the top-level umbrella so a change there invalidates the stamp.
246+ $(HYGIENE_STAMP ) : $(wildcard $(top_srcdir ) /src/httpserver/* .hpp) $(top_srcdir ) /src/httpserver.hpp
239247 @rm -rf $(CHECK_HYGIENE_STAGE )
240248 @$(MAKE ) $(AM_MAKEFLAGS ) install DESTDIR=$(CHECK_HYGIENE_STAGE ) > check-hygiene-install.log 2>&1 || { \
241249 echo " FAIL: staged install failed" ; cat check-hygiene-install.log; \
@@ -253,6 +261,11 @@ check-hygiene:
253261 echo " Always pair CHECK_HYGIENE_SHARED=yes with CHECK_HYGIENE_STAGE=<valid-dir>." ; \
254262 exit 1; \
255263 fi ; \
264+ if ! test -f " $( CHECK_HYGIENE_STAGE) $( includedir) /httpserver.hpp" ; then \
265+ echo " FAIL: CHECK_HYGIENE_STAGE exists but does not contain $( includedir) /httpserver.hpp" ; \
266+ echo " Was the staged install complete before invoking check-hygiene?" ; \
267+ exit 1; \
268+ fi ; \
256269 fi
257270 @status=0; \
258271 if ! $( CHECK_HYGIENE_CXX) $( top_srcdir) /test/headers/consumer_umbrella_no_backend.cpp > check-hygiene.i 2> check-hygiene.err; then \
@@ -267,7 +280,7 @@ check-hygiene:
267280 sed ' s/^/ /' check-hygiene.err | tail -10; \
268281 fi ; \
269282 else \
270- leaks=` grep -hE ' ^# [0-9]+ "[^"]*/($(HEADER_HYGIENE_FORBIDDEN))"' check-hygiene.i | awk ' {print $$3} ' | sort -u` ; \
283+ leaks=` grep -hE ' ^# [0-9]+ "[^"]*/($(HEADER_HYGIENE_FORBIDDEN))"' check-hygiene.i | sed ' s/.*"\(.*\)".*/\1/ ' | sort -u` ; \
271284 if test -n " $$ leaks" ; then \
272285 if test " $( HEADER_HYGIENE_STRICT) " = " yes" ; then \
273286 echo " FAIL: forbidden headers leaked through <httpserver.hpp>:" ; \
@@ -284,24 +297,30 @@ check-hygiene:
284297 rm -f check-hygiene.i check-hygiene.err; \
285298 exit $$ status
286299
287- # check-local runs check-install-layout and check-hygiene against a single
288- # shared staged install to avoid paying two full `make install` costs on
289- # every `make check`. Both sub-checks can still be invoked standalone (they
300+ # check-local runs check-headers (prerequisite), check-install-layout and
301+ # check-hygiene (via recursive $(MAKE) with shared-stage variables) against a
302+ # single shared staged install to avoid paying two full `make install` costs on
303+ # every `make check`. Both sub-checks can still be invoked standalone (they
290304# will do their own install when CHECK_*_SHARED is not set).
305+ #
306+ # CHECK_INSTALL_SHARED=yes / CHECK_HYGIENE_SHARED=yes: the caller has already
307+ # staged the install; sub-check skips the install step to avoid double cost.
308+ # This knob is set only by check-local; do not set it when invoking sub-checks
309+ # standalone.
291310check-local : check-headers check-examples check-readme check-release-notes check-doxygen check-hooks-doc-spotcheck
292311 @echo " === Shared staged install for check-install-layout and check-hygiene ==="
293- @rm -rf $(abs_top_builddir ) /.shared-check-stage
294- @$(MAKE ) $(AM_MAKEFLAGS ) install DESTDIR=$(abs_top_builddir ) /.shared-check-stage > check-shared-install.log 2>&1 || { \
312+ @rm -rf " $( abs_top_builddir) /.shared-check-stage"
313+ @$(MAKE ) $(AM_MAKEFLAGS ) install DESTDIR=" $( abs_top_builddir) /.shared-check-stage" > check-shared-install.log 2>&1 || { \
295314 echo " FAIL: shared staged install failed" ; cat check-shared-install.log; \
296- rm -f check-shared-install.log; rm -rf $(abs_top_builddir ) /.shared-check-stage; exit 1; }
315+ rm -f check-shared-install.log; rm -rf " $( abs_top_builddir) /.shared-check-stage" ; exit 1; }
297316 @rm -f check-shared-install.log
298317 @$(MAKE ) $(AM_MAKEFLAGS ) check-install-layout \
299- CHECK_INSTALL_STAGE=$(abs_top_builddir ) /.shared-check-stage \
318+ CHECK_INSTALL_STAGE=" $( abs_top_builddir) /.shared-check-stage" \
300319 CHECK_INSTALL_SHARED=yes
301320 @$(MAKE ) $(AM_MAKEFLAGS ) check-hygiene \
302- CHECK_HYGIENE_STAGE=$(abs_top_builddir ) /.shared-check-stage \
321+ CHECK_HYGIENE_STAGE=" $( abs_top_builddir) /.shared-check-stage" \
303322 CHECK_HYGIENE_SHARED=yes
304- @rm -rf $(abs_top_builddir ) /.shared-check-stage
323+ @rm -rf " $( abs_top_builddir) /.shared-check-stage"
305324
306325# TASK-040: enforce static invariants on the two flagship examples
307326# (hello_world.cpp <= 10 LOC, lambda-only; shared_state.cpp class+mutex).
@@ -386,7 +405,7 @@ lint-file-size:
386405 @echo " === lint-file-size: enforce per-file line-count ceiling ==="
387406 @$(top_srcdir ) /scripts/check-file-size.sh
388407
389- .PHONY : check-headers check-install-layout check-hygiene check-examples check-readme check-release-notes check-doxygen check-hooks-doc-spotcheck check-soversion check-parallel-install lint-complexity lint-duplication lint-file-size
408+ .PHONY : check-headers check-install-layout check-hygiene check-local check- examples check-readme check-release-notes check-doxygen check-hooks-doc-spotcheck check-soversion check-parallel-install lint-complexity lint-duplication lint-file-size
390409
391410# TASK-039: top-level convenience rule that descends into test/ to
392411# build and run the bench binaries (see test/Makefile.am and
@@ -401,7 +420,7 @@ MOSTLYCLEANFILES = $(DX_CLEANFILES) *.gcda *.gcno *.gcov
401420DISTCLEANFILES = DIST_REVISION
402421
403422clean-local :
404- rm -rf $(CHECK_HYGIENE_STAGE ) $(abs_top_builddir ) /.shared-check-stage $(CHECK_INSTALL_STAGE )
423+ rm -rf " $( CHECK_HYGIENE_STAGE) " " $( abs_top_builddir) /.shared-check-stage" " $( CHECK_INSTALL_STAGE) "
405424
406425pkgconfigdir = $(libdir ) /pkgconfig
407426pkgconfig_DATA = libhttpserver.pc
0 commit comments