# Copyright © Tavian Barnes # SPDX-License-Identifier: 0BSD # Makefile that generates gen/config.h include config/prelude.mk include ${GEN}/config.mk include config/exports.mk # All header fragments we generate HEADERS := \ ${GEN}/has/acl-get-entry.h \ ${GEN}/has/acl-get-file.h \ ${GEN}/has/acl-get-tag-type.h \ ${GEN}/has/acl-is-trivial-np.h \ ${GEN}/has/acl-trivial.h \ ${GEN}/has/aligned-alloc.h \ ${GEN}/has/confstr.h \ ${GEN}/has/extattr-get-file.h \ ${GEN}/has/extattr-get-link.h \ ${GEN}/has/extattr-list-file.h \ ${GEN}/has/extattr-list-link.h \ ${GEN}/has/fdclosedir.h \ ${GEN}/has/getdents.h \ ${GEN}/has/getdents64.h \ ${GEN}/has/getdents64-syscall.h \ ${GEN}/has/getprogname.h \ ${GEN}/has/getprogname-gnu.h \ ${GEN}/has/max-align-t.h \ ${GEN}/has/pipe2.h \ ${GEN}/has/posix-spawn-addfchdir.h \ ${GEN}/has/posix-spawn-addfchdir-np.h \ ${GEN}/has/st-acmtim.h \ ${GEN}/has/st-acmtimespec.h \ ${GEN}/has/st-birthtim.h \ ${GEN}/has/st-birthtimespec.h \ ${GEN}/has/st-flags.h \ ${GEN}/has/statx.h \ ${GEN}/has/statx-syscall.h \ ${GEN}/has/strerror-l.h \ ${GEN}/has/strerror-r-gnu.h \ ${GEN}/has/strerror-r-posix.h \ ${GEN}/has/tm-gmtoff.h \ ${GEN}/has/uselocale.h # Previously generated by pkgs.mk PKG_HEADERS := ${ALL_PKGS:%=${GEN}/use/%.h} ${GEN}/config.h: ${PKG_HEADERS} ${HEADERS} ${MSG} "[ GEN] ${TGT}" printf '// %s\n' "${TGT}" >$@ printf '#ifndef BFS_CONFIG_H\n' >>$@ printf '#define BFS_CONFIG_H\n' >>$@ cat ${.ALLSRC} >>$@ printf '#endif // BFS_CONFIG_H\n' >>$@ cat ${.ALLSRC:%=%.log} >$@.log ${VCAT} $@ .PHONY: ${GEN}/config.h # The short name of the config test SLUG = ${@:${GEN}/%.h=%} ${HEADERS}:: ${MKDIR} ${@D} if config/define-if.sh ${SLUG} config/cc.sh config/${SLUG}.c >$@ 2>$@.log; then \ test "${IS_V}" || printf '[ CC ] %-${MSG_WIDTH}s ✔\n' ${SLUG}.c; \ else \ test "${IS_V}" || printf '[ CC ] %-${MSG_WIDTH}s ✘\n' ${SLUG}.c; \ fi