[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 09/15] contrib/plugins: use an independent makefile
From: |
Paolo Bonzini |
Subject: |
[PATCH 09/15] contrib/plugins: use an independent makefile |
Date: |
Sat, 2 Sep 2023 14:59:28 +0200 |
The initial reason to write this patch was to remove the last use of
CONFIG_DEBUG_TCG from the makefiles; the flags to use to build TCG
plugins are unrelated to --enable-debug-tcg, and instead they should
be the same as those used to build emulators (the plugins are not build
via meson for demonstration reasons only).
However, since contrib/plugins/Makefile is also the last case of doing
a compilation job using config-host.mak, go a step further and make it
use a completely separate configuration file, removing all references
to compilers from the toplevel config-host.mak. Clean up references to
empty variables, and use .SECONDARY so that intermediate object files
are not deleted.
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
configure | 12 +++++++++---
contrib/plugins/Makefile | 18 +++++++++---------
2 files changed, 18 insertions(+), 12 deletions(-)
diff --git a/configure b/configure
index afd6121b616..1be8b430a54 100755
--- a/configure
+++ b/configure
@@ -245,7 +245,7 @@ for opt do
esac
done
-
+default_cflags='-O2 -g'
git_submodules_action="update"
git="git"
docs="auto"
@@ -732,6 +732,7 @@ for opt do
meson_option_parse --enable-debug-graph-lock ""
meson_option_parse --enable-debug-mutex ""
meson_option_add -Doptimization=0
+ default_cflags='-O0 -g'
;;
--disable-tcg) tcg="disabled"
plugins="no"
@@ -1731,8 +1732,6 @@ echo "PYTHON=$python" >> $config_host_mak
echo "GENISOIMAGE=$genisoimage" >> $config_host_mak
echo "MESON=$meson" >> $config_host_mak
echo "NINJA=$ninja" >> $config_host_mak
-echo "PKG_CONFIG=${pkg_config}" >> $config_host_mak
-echo "CC=$cc" >> $config_host_mak
echo "EXESUF=$EXESUF" >> $config_host_mak
# use included Linux headers for KVM architectures
@@ -1757,6 +1756,13 @@ if test "$ccache_cpp2" = "yes"; then
echo "export CCACHE_CPP2=y" >> $config_host_mak
fi
+# contrib/plugins configuration
+echo "# Automatically generated by configure - do not modify" >
contrib/plugins/$config_host_mak
+echo "SRC_PATH=$source_path/contrib/plugins" >>
contrib/plugins/$config_host_mak
+echo "PKG_CONFIG=${pkg_config}" >> contrib/plugins/$config_host_mak
+echo "CC=$cc $CPU_CFLAGS" >> contrib/plugins/$config_host_mak
+echo "CFLAGS=${CFLAGS-$default_cflags} $EXTRA_CFLAGS" >>
contrib/plugins/$config_host_mak
+
# tests/tcg configuration
(config_host_mak=tests/tcg/config-host.mak
mkdir -p tests/tcg
diff --git a/contrib/plugins/Makefile b/contrib/plugins/Makefile
index b2b9db9f51a..0751201bcb3 100644
--- a/contrib/plugins/Makefile
+++ b/contrib/plugins/Makefile
@@ -6,11 +6,11 @@
# programs that the main configure has already done for us.
#
-BUILD_DIR := $(CURDIR)/../..
+include config-host.mak
-include $(BUILD_DIR)/config-host.mak
+TOP_SRC_PATH = $(SRC_PATH)/../..
-VPATH += $(SRC_PATH)/contrib/plugins
+VPATH += $(SRC_PATH)
NAMES :=
NAMES += execlog
@@ -26,21 +26,21 @@ SONAMES := $(addsuffix .so,$(addprefix lib,$(NAMES)))
# The main QEMU uses Glib extensively so it's perfectly fine to use it
# in plugins (which many example do).
-CFLAGS := $(shell $(PKG_CONFIG) --cflags glib-2.0)
-CFLAGS += -fPIC -Wall
-CFLAGS += $(if $(CONFIG_DEBUG_TCG), -ggdb -O0)
-CFLAGS += -I$(SRC_PATH)/include/qemu
+PLUGIN_CFLAGS := $(shell $(PKG_CONFIG) --cflags glib-2.0)
+PLUGIN_CFLAGS += -fPIC -Wall
+PLUGIN_CFLAGS += -I$(TOP_SRC_PATH)/include/qemu
all: $(SONAMES)
%.o: %.c
- $(CC) $(CFLAGS) -c -o $@ $<
+ $(CC) $(CFLAGS) $(PLUGIN_CFLAGS) -c -o $@ $<
lib%.so: %.o
- $(CC) -shared -Wl,-soname,$@ -o $@ $^ $(LDLIBS)
+ $(CC) -shared -Wl,-soname,$@ -o $@ $^
clean:
rm -f *.o *.so *.d
rm -Rf .libs
.PHONY: all clean
+.SECONDARY:
--
2.41.0
- Re: [PATCH 02/15] meson: update unsupported host/CPU messages, (continued)
- [PATCH 03/15] configure: remove HOST_CC, Paolo Bonzini, 2023/09/02
- [PATCH 04/15] configure: create native file with contents of $host_cc, Paolo Bonzini, 2023/09/02
- [PATCH 05/15] meson: compile bundled device trees, Paolo Bonzini, 2023/09/02
- [PATCH 06/15] configure: remove boolean variables for targets, Paolo Bonzini, 2023/09/02
- [PATCH 07/15] configure: move --enable-debug-tcg to meson, Paolo Bonzini, 2023/09/02
- [PATCH 08/15] meson: test for CONFIG_TCG in config_all, Paolo Bonzini, 2023/09/02
- [PATCH 09/15] contrib/plugins: use an independent makefile,
Paolo Bonzini <=
- [PATCH 10/15] configure: unify recursion into sub-Makefiles, Paolo Bonzini, 2023/09/02
- [PATCH 12/15] configure, meson: remove CONFIG_SOLARIS from config-host.mak, Paolo Bonzini, 2023/09/02
- [PATCH 11/15] configure, meson: move --enable-plugins to meson, Paolo Bonzini, 2023/09/02
- [PATCH 15/15] configure: remove dead code, Paolo Bonzini, 2023/09/02
- [PATCH 14/15] meson: list leftover CONFIG_* symbols, Paolo Bonzini, 2023/09/02
- [PATCH 13/15] configure, meson: remove target OS symbols from config-host.mak, Paolo Bonzini, 2023/09/02