@@ -86,6 +86,7 @@ endif # CONFIG_SOFTMMU
# Target-independent parts used in system and user emulation
common-obj-y += cpus-common.o
common-obj-y += hw/
+common-obj-m += hw/
common-obj-y += qom/
common-obj-y += disas/
@@ -179,6 +179,13 @@ endif # CONFIG_SOFTMMU
dummy := $(call unnest-vars,,obj-y)
all-obj-y := $(obj-y)
+#
+# common-obj-m has some crap here, probably as side effect from
+# filling obj-y. Clear it. Fixes suspicious dependency errors when
+# building devices as modules.
+#
+common-obj-m :=
+
include $(SRC_PATH)/Makefile.objs
dummy := $(call unnest-vars,.., \
authz-obj-y \
@@ -43,4 +43,5 @@ devices-dirs-y += smbios/
endif
common-obj-y += $(devices-dirs-y)
+common-obj-m := display/
obj-y += $(devices-dirs-y)