summaryrefslogtreecommitdiffstats
path: root/config/header.mk
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2024-04-26 17:42:44 -0400
committerTavian Barnes <tavianator@tavianator.com>2024-04-26 17:43:54 -0400
commite061b6da5ee46a334169d4e6a52e49857ae22f55 (patch)
tree54be48f77a01ef3dce27e2e7df812e0846ddcd12 /config/header.mk
parent83dd04452498408c1d46b7282ed08e9f5a1e76a8 (diff)
downloadbfs-e061b6da5ee46a334169d4e6a52e49857ae22f55.tar.xz
config: Move .c files into config/{use,has} subdirectories
Diffstat (limited to 'config/header.mk')
-rw-r--r--config/header.mk89
1 files changed, 44 insertions, 45 deletions
diff --git a/config/header.mk b/config/header.mk
index ccc36d3..50ad5e8 100644
--- a/config/header.mk
+++ b/config/header.mk
@@ -9,62 +9,61 @@ include config/exports.mk
# All header fragments we generate
HEADERS := \
- ${GEN}/acl-get-entry.h \
- ${GEN}/acl-get-file.h \
- ${GEN}/acl-get-tag-type.h \
- ${GEN}/acl-is-trivial-np.h \
- ${GEN}/acl-trivial.h \
- ${GEN}/aligned-alloc.h \
- ${GEN}/confstr.h \
- ${GEN}/extattr-get-file.h \
- ${GEN}/extattr-get-link.h \
- ${GEN}/extattr-list-file.h \
- ${GEN}/extattr-list-link.h \
- ${GEN}/fdclosedir.h \
- ${GEN}/getdents.h \
- ${GEN}/getdents64.h \
- ${GEN}/getdents64-syscall.h \
- ${GEN}/getprogname.h \
- ${GEN}/getprogname-gnu.h \
- ${GEN}/max-align-t.h \
- ${GEN}/pipe2.h \
- ${GEN}/posix-spawn-addfchdir.h \
- ${GEN}/posix-spawn-addfchdir-np.h \
- ${GEN}/st-acmtim.h \
- ${GEN}/st-acmtimespec.h \
- ${GEN}/st-birthtim.h \
- ${GEN}/st-birthtimespec.h \
- ${GEN}/st-flags.h \
- ${GEN}/statx.h \
- ${GEN}/statx-syscall.h \
- ${GEN}/strerror-l.h \
- ${GEN}/strerror-r-gnu.h \
- ${GEN}/strerror-r-posix.h \
- ${GEN}/tm-gmtoff.h \
- ${GEN}/uselocale.h
+ ${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
-${GEN}/config.h: ${HEADERS}
+# 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' >>$@
- printf '#define BFS_USE_%s true\n' $$(printf '%s\n' ${PKGS} | tr 'a-z-' 'A-Z_') >>$@
cat ${.ALLSRC} >>$@
printf '#endif // BFS_CONFIG_H\n' >>$@
cat ${.ALLSRC:%=%.log} >$@.log
- ${RM} ${.ALLSRC} ${.ALLSRC:%=%.log}
${VCAT} $@
.PHONY: ${GEN}/config.h
-# The C source file to attempt to compile
-CSRC = ${@:${GEN}/%.h=config/%.c}
+# The short name of the config test
+SLUG = ${@:${GEN}/%.h=%}
${HEADERS}::
- config/cc-define.sh ${CSRC} >$@ 2>$@.log
- if ! [ "${IS_V}" ]; then \
- if grep -q 'true$$' $@; then \
- printf '[ CC ] %-${MSG_WIDTH}s ✔\n' ${CSRC}; \
- else \
- printf '[ CC ] %-${MSG_WIDTH}s ✘\n' ${CSRC}; \
- fi; \
+ ${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