blob: 04fbdec4938db52728ca614ea87d1e94e0933be7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
# Copyright © Tavian Barnes <tavianator@tavianator.com>
# 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}/acl-is-trivial-np.h \
${GEN}/confstr.h \
${GEN}/fdclosedir.h \
${GEN}/getdents.h \
${GEN}/getdents64.h \
${GEN}/getdents64-syscall.h \
${GEN}/getprogname.h \
${GEN}/getprogname-gnu.h \
${GEN}/pipe2.h \
${GEN}/posix-spawn-addfchdir.h \
${GEN}/posix-spawn-addfchdir-np.h \
${GEN}/statx.h \
${GEN}/statx-syscall.h \
${GEN}/strerror-l.h \
${GEN}/strerror-r-gnu.h \
${GEN}/strerror-r-posix.h \
${GEN}/uselocale.h
${GEN}/config.h: ${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
${RM} ${.ALLSRC} ${.ALLSRC:%=%.log}
${VCAT} $@
.PHONY: ${GEN}/config.h
# The C source file to attempt to compile
CSRC = ${@:${GEN}/%.h=config/%.c}
${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; \
fi
|