diff --git a/configure b/configure index afd6121b61..849cd3c038 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,16 @@ 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 +if test "$targetos" = darwin; then + echo "CONFIG_DARWIN=y" >> contrib/plugins/$config_host_mak +fi + # 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 c26fa08441..8ba78c7a32 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,15 +26,14 @@ 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 ifeq ($(CONFIG_DARWIN),y) @@ -48,3 +47,4 @@ clean: rm -Rf .libs .PHONY: all clean +.SECONDARY: