Download raw body.
files.conf(5): document compile-with
hi,
this documents the 'compile-with' argument for files.conf(5)/config(8).
i was looking at the kernel Makefile, wondering if the long list of
dev/pci/drm/amd includes and explicit object rules with
${HARDFLOAT_CFLAGS} could be cleaned up.
with compile-with, the amdgpu source would then use
file .../foo.c amdgpu compile-with "${AMD_C}"
after putting
AMD_C= ${CC} ${CFLAGS} ${CPPFLAGS} ${AMD_INCLUDES} ${PROF} -c $<
in Makefile.amd64. overall this would make the compiler invocations
shorter and drop the explicit rules for the hardfloat amdgpu targets, by
moving them to the files.conf, e.g.
file dev/pci/drm/amd/display/dc/dml/calcs/dcn_calc_auto.c amdgpu & bios compile-with "${AMD_C} ${HARDFLOAT_CFLAGS}"
if this sounds good i could send this as a follow-up to the
documentation.
---
share/man/man5/files.conf.5 | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/share/man/man5/files.conf.5 b/share/man/man5/files.conf.5
index 648508c0972..0c5221c079c 100644
--- a/share/man/man5/files.conf.5
+++ b/share/man/man5/files.conf.5
@@ -293,6 +293,21 @@ attribute are to be compiled in.
This rule is mostly used for pseudo-devices.
.El
.Pp
+Optionally, a
+.Ic compile-with
+keyword followed by a quoted make recipe string may appear after the
+need-rules:
+.Pp
+.Dl file dev/foo/bar.c foobar compile-with \&"${FOO_C}\&"
+.Pp
+When present,
+.Xr config 8
+will emit the given string as the make recipe for that file's object
+rule, overriding the default suffix rule.
+This allows per-file compiler flags to be specified without adding
+explicit rules to the architecture's
+.Pa Makefile.arch .
+.Pp
The
.Dq attribute header files
are simple C header files created in the kernel compilation directory,
--
2.52.0
files.conf(5): document compile-with