git: 009db0d40c6a - main - ncurses: serialize the tinfo build a little bit

From: Kyle Evans <kevans_at_FreeBSD.org>
Date: Wed, 24 Jan 2024 05:01:01 UTC
The branch main has been updated by kevans:

URL: https://cgit.FreeBSD.org/src/commit/?id=009db0d40c6acffe0b9d835cb15a75cc3361173b

commit 009db0d40c6acffe0b9d835cb15a75cc3361173b
Author:     Kyle Evans <kevans@FreeBSD.org>
AuthorDate: 2024-01-24 05:00:36 +0000
Commit:     Kyle Evans <kevans@FreeBSD.org>
CommitDate: 2024-01-24 05:00:36 +0000

    ncurses: serialize the tinfo build a little bit
    
    Move ncurses_dll.h to GENHDRS to start with; it's been generated from
    ncurses_dll.h.in for years, so it's not actually in a different category
    than all of the other GENHDRS.  Slap an .ORDER on it to ensure that we
    build ncurses_dll.h and curses.h before any *.c gets compiled.
    
    This should sufficiently address a build race seen downstream where
    ncurses_dll.h is present but not yet populated.
    
    Reviewed by:    bapt
    Sponsored by:   NetApp, Inc.
    Sponsored by:   Klara, Inc.
    Differential Revision:  https://reviews.freebsd.org/D43540
---
 lib/ncurses/tinfo/Makefile | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/lib/ncurses/tinfo/Makefile b/lib/ncurses/tinfo/Makefile
index c1ea75d3aacd..a0b191f50785 100644
--- a/lib/ncurses/tinfo/Makefile
+++ b/lib/ncurses/tinfo/Makefile
@@ -74,6 +74,7 @@ GENHDRS=	\
 	hashsize.h \
 	init_keytry.h \
 	ncurses_def.h \
+	ncurses_dll.h \
 	nomacros.h \
 	parametrized.h \
 	term.h \
@@ -170,9 +171,8 @@ CWARNFLAGS.comp_parse.c= ${NO_WUNUSED_BUT_SET_VARIABLE}
 CWARNFLAGS.read_entry.c= ${NO_WUNUSED_BUT_SET_VARIABLE}
 
 # Installed
-HEADERS=	curses.h term.h termcap.h unctrl.h
-SRCHDRS=	ncurses_dll.h
-CLEANFILES+=	ncurses_dll.h
+HEADERS=	curses.h ncurses_dll.h term.h termcap.h unctrl.h
+SRCHDRS=
 
 INCS=		${HEADERS} ${SRCHDRS}
 INCSLINKS=	curses.h ${INCLUDEDIR}/ncurses.h
@@ -214,6 +214,14 @@ FILESGROUPS=	DOCS
 # Generated source
 .ORDER: names.c codes.c
 
+# Serialize the build just a little bit; there's nothing stopping the build from
+# proceeding before ncurses_dll.h and curses.h are actually generated on a clean
+# build since we have no dependency information to prevent it.
+.ORDER: ncurses_dll.h curses.h
+.for f in ${SRCS:M*.c}
+.ORDER: curses.h ${f}
+.endfor
+
 names.c: MKnames.awk
 	${AWK} -f ${NCURSES_DIR}/ncurses/tinfo/MKnames.awk bigstrings=${USE_BIG_STRINGS} ${NCURSES_DIR}/include/Caps > names.c