Commit 6dedf052 authored by Peter Maydell's avatar Peter Maydell
Browse files

Merge remote-tracking branch 'remotes/bonzini/configure' into staging



* remotes/bonzini/configure:
  build: softmmu targets do not have a "main.o" file
  configure: Disable libtool if -fPIE does not work with it (bug #1257099)
  block: convert block drivers linked with libs to modules
  Makefile: introduce common-obj-m and block-obj-m for DSO
  Makefile: install modules with "make install"
  module: implement module loading
  rules.mak: introduce DSO rules
  darwin: do not use -mdynamic-no-pic
  block: use per-object cflags and libs
  rules.mak: allow per object cflags and libs
  rules.mak: fix $(obj) to a real relative path
  util: Split out exec_dir from os_find_datadir

Signed-off-by: default avatarPeter Maydell <peter.maydell@linaro.org>
parents 98b21dcd f966f9dd
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -66,6 +66,9 @@ libuser
*.cp
*.dvi
*.exe
*.dll
*.so
*.mo
*.fn
*.ky
*.log
+28 −1
Original line number Diff line number Diff line
@@ -127,13 +127,29 @@ defconfig:

ifneq ($(wildcard config-host.mak),)
include $(SRC_PATH)/Makefile.objs
endif

dummy := $(call unnest-vars,, \
                stub-obj-y \
                util-obj-y \
                qga-obj-y \
                block-obj-y \
                block-obj-m \
                common-obj-y \
                common-obj-m)

ifneq ($(wildcard config-host.mak),)
include $(SRC_PATH)/tests/Makefile
endif
ifeq ($(CONFIG_SMARTCARD_NSS),y)
include $(SRC_PATH)/libcacard/Makefile
endif

all: $(DOCS) $(TOOLS) $(HELPERS-y) recurse-all
all: $(DOCS) $(TOOLS) $(HELPERS-y) recurse-all modules

vl.o: QEMU_CFLAGS+=$(GPROF_CFLAGS)

vl.o: QEMU_CFLAGS+=$(SDL_CFLAGS)

config-host.h: config-host.h-timestamp
config-host.h-timestamp: config-host.mak
@@ -192,6 +208,9 @@ Makefile: $(version-obj-y) $(version-lobj-y)
libqemustub.a: $(stub-obj-y)
libqemuutil.a: $(util-obj-y) qapi-types.o qapi-visit.o

block-modules = $(foreach o,$(block-obj-m),"$(basename $(subst /,-,$o))",) NULL
util/module.o-cflags = -D'CONFIG_BLOCK_MODULES=$(block-modules)'

######################################################################

qemu-img.o: qemu-img-cmds.h
@@ -247,6 +266,8 @@ clean:
	rm -f qemu-options.def
	find . -name '*.[oda]' -type f -exec rm -f {} +
	find . -name '*.l[oa]' -type f -exec rm -f {} +
	find . -name '*$(DSOSUF)' -type f -exec rm -f {} +
	find . -name '*.mo' -type f -exec rm -f {} +
	rm -f $(filter-out %.tlb,$(TOOLS)) $(HELPERS-y) qemu-ga TAGS cscope.* *.pod *~ */*~
	rm -f fsdev/*.pod
	rm -rf .libs */.libs
@@ -354,6 +375,12 @@ install-datadir install-localstatedir
ifneq ($(TOOLS),)
	$(INSTALL_PROG) $(STRIP_OPT) $(TOOLS) "$(DESTDIR)$(bindir)"
endif
ifneq ($(CONFIG_MODULES),)
	$(INSTALL_DIR) "$(DESTDIR)$(qemu_moddir)"
	for s in $(patsubst %.mo,%$(DSOSUF),$(modules-m)); do \
		$(INSTALL_PROG) $(STRIP_OPT) $$s "$(DESTDIR)$(qemu_moddir)/$${s//\//-}"; \
	done
endif
ifneq ($(HELPERS-y),)
	$(INSTALL_DIR) "$(DESTDIR)$(libexecdir)"
	$(INSTALL_PROG) $(STRIP_OPT) $(HELPERS-y) "$(DESTDIR)$(libexecdir)"
+3 −16
Original line number Diff line number Diff line
@@ -19,6 +19,8 @@ block-obj-y += qemu-coroutine.o qemu-coroutine-lock.o qemu-coroutine-io.o
block-obj-y += qemu-coroutine-sleep.o
block-obj-y += coroutine-$(CONFIG_COROUTINE_BACKEND).o

block-obj-m = block/

ifeq ($(CONFIG_VIRTIO)$(CONFIG_VIRTFS)$(CONFIG_PCI),yyy)
# Lots of the fsdev/9pcode is pulled in by vl.c via qemu_fsdev_add.
# only pull in the actual virtio-9p device if we also enabled virtio.
@@ -41,7 +43,7 @@ libcacard-y += libcacard/vcardt.o
# single QEMU executable should support all CPUs and machines.

ifeq ($(CONFIG_SOFTMMU),y)
common-obj-y = $(block-obj-y) blockdev.o blockdev-nbd.o block/
common-obj-y = blockdev.o blockdev-nbd.o block/
common-obj-y += net/
common-obj-y += qdev-monitor.o device-hotplug.o
common-obj-$(CONFIG_WIN32) += os-win32.o
@@ -111,18 +113,3 @@ version-lobj-$(CONFIG_WIN32) += $(BUILD_DIR)/version.lo
# by libqemuutil.a.  These should be moved to a separate .json schema.
qga-obj-y = qga/ qapi-types.o qapi-visit.o
qga-vss-dll-obj-y = qga/

vl.o: QEMU_CFLAGS+=$(GPROF_CFLAGS)

vl.o: QEMU_CFLAGS+=$(SDL_CFLAGS)

QEMU_CFLAGS+=$(GLIB_CFLAGS)

nested-vars += \
	stub-obj-y \
	util-obj-y \
	qga-obj-y \
	qga-vss-dll-obj-y \
	block-obj-y \
	common-obj-y
dummy := $(call unnest-vars)
+17 −6
Original line number Diff line number Diff line
@@ -130,8 +130,6 @@ else
obj-y += hw/$(TARGET_BASE_ARCH)/
endif

main.o: QEMU_CFLAGS+=$(GPROF_CFLAGS)

GENERATED_HEADERS += hmp-commands.h qmp-commands-old.h

endif # CONFIG_SOFTMMU
@@ -139,13 +137,26 @@ endif # CONFIG_SOFTMMU
# Workaround for http://gcc.gnu.org/PR55489, see configure.
%/translate.o: QEMU_CFLAGS += $(TRANSLATE_OPT_CFLAGS)

nested-vars += obj-y
dummy := $(call unnest-vars,,obj-y)

# we are making another call to unnest-vars with different vars, protect obj-y,
# it can be overriden in subdir Makefile.objs
obj-y-save := $(obj-y)

# This resolves all nested paths, so it must come last
block-obj-y :=
common-obj-y :=
include $(SRC_PATH)/Makefile.objs
dummy := $(call unnest-vars,.., \
               block-obj-y \
               block-obj-m \
               common-obj-y \
               common-obj-m)

# Now restore obj-y
obj-y := $(obj-y-save)

all-obj-y = $(obj-y)
all-obj-y += $(addprefix ../, $(common-obj-y))
all-obj-y = $(obj-y) $(common-obj-y)
all-obj-$(CONFIG_SOFTMMU) += $(block-obj-y)

ifndef CONFIG_HAIKU
LIBS+=-lm
+12 −1
Original line number Diff line number Diff line
@@ -24,4 +24,15 @@ common-obj-y += commit.o
common-obj-y += mirror.o
common-obj-y += backup.o

$(obj)/curl.o: QEMU_CFLAGS+=$(CURL_CFLAGS)
iscsi.o-cflags     := $(LIBISCSI_CFLAGS)
iscsi.o-libs       := $(LIBISCSI_LIBS)
curl.o-cflags      := $(CURL_CFLAGS)
curl.o-libs        := $(CURL_LIBS)
rbd.o-cflags       := $(RBD_CFLAGS)
rbd.o-libs         := $(RBD_LIBS)
gluster.o-cflags   := $(GLUSTERFS_CFLAGS)
gluster.o-libs     := $(GLUSTERFS_LIBS)
ssh.o-cflags       := $(LIBSSH2_CFLAGS)
ssh.o-libs         := $(LIBSSH2_LIBS)
qcow.o-libs        := -lz
linux-aio.o-libs   := -laio
Loading