Use $(CPP) instead if $(CC) -E when buiding .i files from .c.

This commit is contained in:
Todd C. Miller
2024-02-21 12:31:50 -07:00
parent 2a61e4b07d
commit 3944ab1fbe
16 changed files with 414 additions and 395 deletions

View File

@@ -1,7 +1,7 @@
#
# SPDX-License-Identifier: ISC
#
# Copyright (c) 2019-2023 Todd C. Miller <Todd.Miller@sudo.ws>
# Copyright (c) 2019-2024 Todd C. Miller <Todd.Miller@sudo.ws>
#
# Permission to use, copy, modify, and distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
@@ -35,6 +35,7 @@ cross_compiling = @CROSS_COMPILING@
# Compiler & tools to use
CC = @CC@
CPP = @CPP@
LIBTOOL = @LIBTOOL@
EGREP = @EGREP@
SED = @SED@
@@ -157,7 +158,7 @@ Makefile: $(srcdir)/Makefile.in
$(LIBTOOL) $(LTFLAGS) --mode=compile $(CC) -c $(CPPFLAGS) $(CFLAGS) $(ASAN_CFLAGS) $(PIE_CFLAGS) $(HARDENING_CFLAGS) $<
.c.i:
$(CC) -E -o $@ $(CPPFLAGS) $<
$(CPP) $(CPPFLAGS) $< > $@
.i.plog:
ifile=$<; rm -f $@; pvs-studio --cfg $(PVS_CFG) --sourcetree-root $(top_srcdir) --skip-cl-exe yes --source-file $${ifile%i}c --i-file $< --output-file $@
@@ -275,17 +276,19 @@ check_python_examples.i: $(srcdir)/regress/check_python_examples.c \
$(srcdir)/regress/iohelpers.h \
$(srcdir)/regress/testhelpers.h \
$(srcdir)/sudo_python_debug.h $(top_builddir)/config.h
$(CC) -E -o $@ $(CPPFLAGS) $<
$(CPP) $(CPPFLAGS) $< > $@
check_python_examples.plog: check_python_examples.i
rm -f $@; pvs-studio --cfg $(PVS_CFG) --sourcetree-root $(top_srcdir) --skip-cl-exe yes --source-file $(srcdir)/regress/check_python_examples.c --i-file $< --output-file $@
iohelpers.o: $(srcdir)/regress/iohelpers.c $(incdir)/compat/stdbool.h \
$(incdir)/sudo_compat.h $(srcdir)/regress/iohelpers.h \
$(incdir)/sudo_compat.h $(incdir)/sudo_fatal.h \
$(incdir)/sudo_plugin.h $(srcdir)/regress/iohelpers.h \
$(top_builddir)/config.h
$(CC) -c $(CPPFLAGS) $(CFLAGS) $(ASAN_CFLAGS) $(PIE_CFLAGS) $(HARDENING_CFLAGS) $(srcdir)/regress/iohelpers.c
iohelpers.i: $(srcdir)/regress/iohelpers.c $(incdir)/compat/stdbool.h \
$(incdir)/sudo_compat.h $(srcdir)/regress/iohelpers.h \
$(incdir)/sudo_compat.h $(incdir)/sudo_fatal.h \
$(incdir)/sudo_plugin.h $(srcdir)/regress/iohelpers.h \
$(top_builddir)/config.h
$(CC) -E -o $@ $(CPPFLAGS) $<
$(CPP) $(CPPFLAGS) $< > $@
iohelpers.plog: iohelpers.i
rm -f $@; pvs-studio --cfg $(PVS_CFG) --sourcetree-root $(top_srcdir) --skip-cl-exe yes --source-file $(srcdir)/regress/iohelpers.c --i-file $< --output-file $@
pyhelpers.lo: $(srcdir)/pyhelpers.c $(incdir)/compat/stdbool.h \
@@ -301,7 +304,7 @@ pyhelpers.i: $(srcdir)/pyhelpers.c $(incdir)/compat/stdbool.h \
$(srcdir)/pyhelpers.h $(srcdir)/pyhelpers_cpychecker.h \
$(srcdir)/sudo_python_debug.h $(top_builddir)/config.h \
$(top_builddir)/pathnames.h
$(CC) -E -o $@ $(CPPFLAGS) $<
$(CPP) $(CPPFLAGS) $< > $@
pyhelpers.plog: pyhelpers.i
rm -f $@; pvs-studio --cfg $(PVS_CFG) --sourcetree-root $(top_srcdir) --skip-cl-exe yes --source-file $(srcdir)/pyhelpers.c --i-file $< --output-file $@
pyhelpers.o: $(srcdir)/pyhelpers.c $(incdir)/compat/stdbool.h \
@@ -324,7 +327,7 @@ python_baseplugin.i: $(srcdir)/python_baseplugin.c $(incdir)/compat/stdbool.h \
$(srcdir)/pyhelpers.h $(srcdir)/pyhelpers_cpychecker.h \
$(srcdir)/sudo_python_debug.h \
$(srcdir)/sudo_python_module.h $(top_builddir)/config.h
$(CC) -E -o $@ $(CPPFLAGS) $<
$(CPP) $(CPPFLAGS) $< > $@
python_baseplugin.plog: python_baseplugin.i
rm -f $@; pvs-studio --cfg $(PVS_CFG) --sourcetree-root $(top_srcdir) --skip-cl-exe yes --source-file $(srcdir)/python_baseplugin.c --i-file $< --output-file $@
python_convmessage.lo: $(srcdir)/python_convmessage.c \
@@ -342,7 +345,7 @@ python_convmessage.i: $(srcdir)/python_convmessage.c \
$(srcdir)/pyhelpers_cpychecker.h \
$(srcdir)/sudo_python_debug.h \
$(srcdir)/sudo_python_module.h $(top_builddir)/config.h
$(CC) -E -o $@ $(CPPFLAGS) $<
$(CPP) $(CPPFLAGS) $< > $@
python_convmessage.plog: python_convmessage.i
rm -f $@; pvs-studio --cfg $(PVS_CFG) --sourcetree-root $(top_srcdir) --skip-cl-exe yes --source-file $(srcdir)/python_convmessage.c --i-file $< --output-file $@
python_loghandler.lo: $(srcdir)/python_loghandler.c $(incdir)/compat/stdbool.h \
@@ -358,7 +361,7 @@ python_loghandler.i: $(srcdir)/python_loghandler.c $(incdir)/compat/stdbool.h \
$(srcdir)/pyhelpers.h $(srcdir)/pyhelpers_cpychecker.h \
$(srcdir)/sudo_python_debug.h \
$(srcdir)/sudo_python_module.h $(top_builddir)/config.h
$(CC) -E -o $@ $(CPPFLAGS) $<
$(CPP) $(CPPFLAGS) $< > $@
python_loghandler.plog: python_loghandler.i
rm -f $@; pvs-studio --cfg $(PVS_CFG) --sourcetree-root $(top_srcdir) --skip-cl-exe yes --source-file $(srcdir)/python_loghandler.c --i-file $< --output-file $@
python_plugin_approval.lo: $(srcdir)/python_plugin_approval.c \
@@ -380,7 +383,7 @@ python_plugin_approval.i: $(srcdir)/python_plugin_approval.c \
$(srcdir)/python_plugin_common.h \
$(srcdir)/sudo_python_debug.h \
$(top_builddir)/config.h
$(CC) -E -o $@ $(CPPFLAGS) $<
$(CPP) $(CPPFLAGS) $< > $@
python_plugin_approval.plog: python_plugin_approval.i
rm -f $@; pvs-studio --cfg $(PVS_CFG) --sourcetree-root $(top_srcdir) --skip-cl-exe yes --source-file $(srcdir)/python_plugin_approval.c --i-file $< --output-file $@
python_plugin_audit.lo: $(srcdir)/python_plugin_audit.c \
@@ -400,7 +403,7 @@ python_plugin_audit.i: $(srcdir)/python_plugin_audit.c \
$(srcdir)/python_plugin_audit_multi.inc \
$(srcdir)/python_plugin_common.h \
$(srcdir)/sudo_python_debug.h $(top_builddir)/config.h
$(CC) -E -o $@ $(CPPFLAGS) $<
$(CPP) $(CPPFLAGS) $< > $@
python_plugin_audit.plog: python_plugin_audit.i
rm -f $@; pvs-studio --cfg $(PVS_CFG) --sourcetree-root $(top_srcdir) --skip-cl-exe yes --source-file $(srcdir)/python_plugin_audit.c --i-file $< --output-file $@
python_plugin_common.lo: $(srcdir)/python_plugin_common.c \
@@ -422,7 +425,7 @@ python_plugin_common.i: $(srcdir)/python_plugin_common.c \
$(srcdir)/python_plugin_common.h \
$(srcdir)/sudo_python_debug.h \
$(srcdir)/sudo_python_module.h $(top_builddir)/config.h
$(CC) -E -o $@ $(CPPFLAGS) $<
$(CPP) $(CPPFLAGS) $< > $@
python_plugin_common.plog: python_plugin_common.i
rm -f $@; pvs-studio --cfg $(PVS_CFG) --sourcetree-root $(top_srcdir) --skip-cl-exe yes --source-file $(srcdir)/python_plugin_common.c --i-file $< --output-file $@
python_plugin_group.lo: $(srcdir)/python_plugin_group.c \
@@ -440,7 +443,7 @@ python_plugin_group.i: $(srcdir)/python_plugin_group.c \
$(srcdir)/pyhelpers_cpychecker.h \
$(srcdir)/python_plugin_common.h \
$(srcdir)/sudo_python_debug.h $(top_builddir)/config.h
$(CC) -E -o $@ $(CPPFLAGS) $<
$(CPP) $(CPPFLAGS) $< > $@
python_plugin_group.plog: python_plugin_group.i
rm -f $@; pvs-studio --cfg $(PVS_CFG) --sourcetree-root $(top_srcdir) --skip-cl-exe yes --source-file $(srcdir)/python_plugin_group.c --i-file $< --output-file $@
python_plugin_io.lo: $(srcdir)/python_plugin_io.c $(incdir)/compat/stdbool.h \
@@ -458,7 +461,7 @@ python_plugin_io.i: $(srcdir)/python_plugin_io.c $(incdir)/compat/stdbool.h \
$(srcdir)/python_plugin_common.h \
$(srcdir)/python_plugin_io_multi.inc \
$(srcdir)/sudo_python_debug.h $(top_builddir)/config.h
$(CC) -E -o $@ $(CPPFLAGS) $<
$(CPP) $(CPPFLAGS) $< > $@
python_plugin_io.plog: python_plugin_io.i
rm -f $@; pvs-studio --cfg $(PVS_CFG) --sourcetree-root $(top_srcdir) --skip-cl-exe yes --source-file $(srcdir)/python_plugin_io.c --i-file $< --output-file $@
python_plugin_policy.lo: $(srcdir)/python_plugin_policy.c \
@@ -476,7 +479,7 @@ python_plugin_policy.i: $(srcdir)/python_plugin_policy.c \
$(srcdir)/pyhelpers_cpychecker.h \
$(srcdir)/python_plugin_common.h \
$(srcdir)/sudo_python_debug.h $(top_builddir)/config.h
$(CC) -E -o $@ $(CPPFLAGS) $<
$(CPP) $(CPPFLAGS) $< > $@
python_plugin_policy.plog: python_plugin_policy.i
rm -f $@; pvs-studio --cfg $(PVS_CFG) --sourcetree-root $(top_srcdir) --skip-cl-exe yes --source-file $(srcdir)/python_plugin_policy.c --i-file $< --output-file $@
sudo_python_debug.lo: $(srcdir)/sudo_python_debug.c $(incdir)/compat/stdbool.h \
@@ -492,7 +495,7 @@ sudo_python_debug.i: $(srcdir)/sudo_python_debug.c $(incdir)/compat/stdbool.h \
$(incdir)/sudo_gettext.h $(incdir)/sudo_plugin.h \
$(incdir)/sudo_queue.h $(srcdir)/sudo_python_debug.h \
$(top_builddir)/config.h
$(CC) -E -o $@ $(CPPFLAGS) $<
$(CPP) $(CPPFLAGS) $< > $@
sudo_python_debug.plog: sudo_python_debug.i
rm -f $@; pvs-studio --cfg $(PVS_CFG) --sourcetree-root $(top_srcdir) --skip-cl-exe yes --source-file $(srcdir)/sudo_python_debug.c --i-file $< --output-file $@
sudo_python_debug.o: $(srcdir)/sudo_python_debug.c $(incdir)/compat/stdbool.h \
@@ -517,7 +520,7 @@ sudo_python_module.i: $(srcdir)/sudo_python_module.c \
$(srcdir)/pyhelpers_cpychecker.h \
$(srcdir)/sudo_python_debug.h \
$(srcdir)/sudo_python_module.h $(top_builddir)/config.h
$(CC) -E -o $@ $(CPPFLAGS) $<
$(CPP) $(CPPFLAGS) $< > $@
sudo_python_module.plog: sudo_python_module.i
rm -f $@; pvs-studio --cfg $(PVS_CFG) --sourcetree-root $(top_srcdir) --skip-cl-exe yes --source-file $(srcdir)/sudo_python_module.c --i-file $< --output-file $@
testhelpers.o: $(srcdir)/regress/testhelpers.c $(incdir)/compat/stdbool.h \
@@ -535,6 +538,6 @@ testhelpers.i: $(srcdir)/regress/testhelpers.c $(incdir)/compat/stdbool.h \
$(srcdir)/pyhelpers_cpychecker.h $(srcdir)/regress/iohelpers.h \
$(srcdir)/regress/testhelpers.h $(srcdir)/sudo_python_debug.h \
$(top_builddir)/config.h
$(CC) -E -o $@ $(CPPFLAGS) $<
$(CPP) $(CPPFLAGS) $< > $@
testhelpers.plog: testhelpers.i
rm -f $@; pvs-studio --cfg $(PVS_CFG) --sourcetree-root $(top_srcdir) --skip-cl-exe yes --source-file $(srcdir)/regress/testhelpers.c --i-file $< --output-file $@