commit: e2e5e98bcd0badcd437b8a67aa0986ed6d6678a9
parent 775f76f04ddfdf2f694c57951b97ed704232ad8b
Author: Michael Forney <mforney@mforney.org>
Date: Fri, 5 Jul 2019 20:31:33 -0700
Use a separate preprocessor rule
Otherwise, we end up passing both -c and -E to the compiler.
Diffstat:
3 files changed, 11 insertions(+), 11 deletions(-)
diff --git a/pkg/libpng/gen.lua b/pkg/libpng/gen.lua
@@ -14,9 +14,7 @@ build('awk', '$outdir/pnglibconf.tf4', {
build('awk', '$outdir/pnglibconf.c', '$outdir/pnglibconf.tf4', {
expr='-f $srcdir/scripts/options.awk out=/dev/stdout',
})
-build('cc', '$outdir/pnglibconf.tf1', {'$outdir/pnglibconf.c', '||', 'pkg/zlib/headers'}, {
- cflags='$cflags -E -MT $outdir/pnglibconf.tf1',
-})
+build('cpp', '$outdir/pnglibconf.tf1', {'$outdir/pnglibconf.c', '||', 'pkg/zlib/headers'})
build('awk', '$outdir/include/pnglibconf.h', '$outdir/pnglibconf.tf1', {
expr='-f $srcdir/scripts/dfn.awk out=/dev/stdout',
})
diff --git a/pkg/strace/gen.lua b/pkg/strace/gen.lua
@@ -8,9 +8,7 @@ cflags{
'-I $outdir',
}
-build('cc', '$outdir/ioctl_iocdef.i', '$srcdir/ioctl_iocdef.c', {
- cflags='$cflags -P -E -MT $outdir/ioctl_iocdef.i',
-})
+build('cpp', '$outdir/ioctl_iocdef.i', '$srcdir/ioctl_iocdef.c')
build('sed', '$outdir/ioctl_iocdef.h', '$outdir/ioctl_iocdef.i', {
expr=[[-n 's/^DEFINE HOST/#define /p']],
})
@@ -41,8 +39,8 @@ end)
local mpers = lines('mpers.txt')
for _, f in ipairs(mpers) do
- build('cc', '$outdir/'..f..'.mpers.i', '$srcdir/'..f, {
- cflags='$cflags -P -E -MT $outdir/'..f..'.mpers.i -DIN_MPERS_BOOTSTRAP',
+ build('cpp', '$outdir/'..f..'.mpers.i', '$srcdir/'..f, {
+ cflags='$cflags -DIN_MPERS_BOOTSTRAP',
})
end
@@ -56,9 +54,7 @@ makempers('printers.h', 'printers.awk')
makempers('native_printer_decls.h', 'printerdecls.awk')
makempers('native_printer_defs.h', 'printerdefs.awk')
-build('cc', '$outdir/syscallent.i', '$srcdir/linux/x86_64/syscallent.h', {
- cflags='$cflags -P -E -MT $outdir/syscallent.i',
-})
+build('cpp', '$outdir/syscallent.i', '$srcdir/linux/x86_64/syscallent.h')
build('awk', '$outdir/scno-syscallent.h', {'$outdir/syscallent.i', '|', '$dir/scno.awk'}, {
expr='-f $dir/scno.awk',
})
diff --git a/rules.ninja b/rules.ninja
@@ -9,6 +9,12 @@ rule cc
deps = gcc
description = CC $out
+rule cpp
+ command = $cc -MMD -MF $out.d $cflags -E -P -o $out $in
+ depfile = $out.d
+ deps = gcc
+ description = CPP $out
+
rule as
command = $as $asflags -o $out $in