From aea98ddce6f97045615be892e66e660165542a8f Mon Sep 17 00:00:00 2001 From: Anthony Liguori Date: Wed, 20 Jul 2011 17:54:56 -0500 Subject: [PATCH] Reorganize build system --- Makefile.objs | 18 ++++++++-- Qconfig | 4 +++ backends/Makefile | 1 + backends/Qconfig | 12 +++++++ chrdrv/Makefile | 4 +++ chrdrv/Qconfig | 26 ++++++++++++++ devices/Makefile | 10 ++++-- devices/Qconfig | 20 +++++++++++ devices/gates/Makefile | 3 +- devices/gates/Qconfig | 9 ++--- devices/pc/Makefile | 1 + devices/pc/Qconfig | 6 ++++ devices/pc/pci.h | 72 --------------------------------------- qom/Makefile | 1 + qom/Qconfig | 5 +++ {devices => qom}/plug-proptypes.c | 0 {devices => qom}/plug.c | 0 {devices => qom}/type.c | 0 scripts/genconfig.sh | 16 +++++++++ 19 files changed, 124 insertions(+), 84 deletions(-) create mode 100644 Qconfig create mode 100644 backends/Makefile create mode 100644 backends/Qconfig create mode 100644 chrdrv/Makefile create mode 100644 chrdrv/Qconfig create mode 100644 devices/Qconfig create mode 100644 devices/pc/Makefile create mode 100644 devices/pc/Qconfig delete mode 100644 devices/pc/pci.h create mode 100644 qom/Makefile create mode 100644 qom/Qconfig rename {devices => qom}/plug-proptypes.c (100%) rename {devices => qom}/plug.c (100%) rename {devices => qom}/type.c (100%) create mode 100755 scripts/genconfig.sh diff --git a/Makefile.objs b/Makefile.objs index f3785cf7fd..078a6f3593 100644 --- a/Makefile.objs +++ b/Makefile.objs @@ -108,12 +108,24 @@ common-obj-y += string-visitor.o QEMU_CFLAGS += -I$(SRC_PATH)/include -CONFIG_GATES=y +QCONFIGS = $(shell find $(SRC_PATH) -name "Qconfig" -print) + +config-qom.mak: $(SRC_PATH)/Qconfig $(QCONFIGS) + $(SRC_PATH)/scripts/genconfig.sh $< > $@ + +-include config-qom.mak + +include $(SRC_PATH)/qom/Makefile +common-obj-y += $(addprefix qom/,$(qom-obj-y)) + include $(SRC_PATH)/devices/Makefile +common-obj-y += $(addprefix devices/,$(devices-obj-y)) -common-obj-y += backends/block_dev.o backends/block_file.o +include $(SRC_PATH)/backends/Makefile +common-obj-y += $(addprefix backends/,$(backends-obj-y)) -common-obj-y += chrdrv/chrdrv.o chrdrv/mem.o chrdrv/socket.o +include $(SRC_PATH)/chrdrv/Makefile +common-obj-y += $(addprefix chrdrv/,$(chdrv-obj-y)) common-obj-$(CONFIG_BRLAPI) += baum.o common-obj-$(CONFIG_POSIX) += migration-exec.o migration-unix.o migration-fd.o diff --git a/Qconfig b/Qconfig new file mode 100644 index 0000000000..421d4c8c4a --- /dev/null +++ b/Qconfig @@ -0,0 +1,4 @@ +source qom/Qconfig +source devices/Qconfig +source backends/Qconfig +source chrdrv/Qconfig diff --git a/backends/Makefile b/backends/Makefile new file mode 100644 index 0000000000..d7ba403ae8 --- /dev/null +++ b/backends/Makefile @@ -0,0 +1 @@ +backends-obj-$(CONFIG_BLOCK) := block_dev.o block_file.o diff --git a/backends/Qconfig b/backends/Qconfig new file mode 100644 index 0000000000..4ed97adfe0 --- /dev/null +++ b/backends/Qconfig @@ -0,0 +1,12 @@ +config BLOCK + bool "QEMU Block Layer" + default y + help + This is the block layer. + +config BLOCK_FILE + bool "File block driver" + default y + depends on BLOCK + help + This is the file driver diff --git a/chrdrv/Makefile b/chrdrv/Makefile new file mode 100644 index 0000000000..3ffe995058 --- /dev/null +++ b/chrdrv/Makefile @@ -0,0 +1,4 @@ +chrdrv-obj-$(CONFIG_CHRDRV) := chdrv.o +chrdrv-obj-$(CONFIG_CHRDRV_MEM) += mem.o +chrdrv-obj-$(CONFIG_CHRDRV_SOCKET) += socket.o +chrdrv-obj-$(CONFIG_CHRDRV_TCP) += tcp.o diff --git a/chrdrv/Qconfig b/chrdrv/Qconfig new file mode 100644 index 0000000000..b0bc371c32 --- /dev/null +++ b/chrdrv/Qconfig @@ -0,0 +1,26 @@ +config CHRDRV + bool "QEMU Character Drivers" + default y + help + Character layer + +config CHRDRV_MEM + bool "Memory character device" + default y + depends on CHRDRV + help + Memory character device. + +config CHRDRV_SOCKET + bool "Socket driver" + default y + depends on CHRDRV + help + foo + +config CHRDRV_TCP + bool "TCP driver" + default y + depends on CHDRV_SOCKET + help + bar diff --git a/devices/Makefile b/devices/Makefile index 126b01262f..bb41b89c76 100644 --- a/devices/Makefile +++ b/devices/Makefile @@ -1,5 +1,9 @@ -devices-obj-y += type.o plug.o plug-proptypes.o pin.o device.o -devices-obj-y += pc/i440fx.o pci_bus.o pci_device.o rom.o -common-obj-y += $(addprefix devices/,$(devices-obj-y)) +devices-obj-$(CONFIG_DEVICE) := device.o pin.o +devices-obj-$(CONFIG_PCI) += pci_bus.o pci_device.o +devices-obj-$(CONFIG_ROM) += rom.o + +include $(SRC_PATH)/devices/pc/Makefile +devices-obj-y += $(addprefix pc/,$(pc-obj-y)) include $(SRC_PATH)/devices/gates/Makefile +devices-obj-y += $(addprefix gates/,$(gates-obj-y)) diff --git a/devices/Qconfig b/devices/Qconfig new file mode 100644 index 0000000000..bcb88649f0 --- /dev/null +++ b/devices/Qconfig @@ -0,0 +1,20 @@ +config DEVICE + bool "Device model" + default y + help + Device model + +config PCI + bool "PCI devices" + default y + depends on DEVICE + help + Foo + +config ROM + bool "ROM device" + default y + depends on DEVICE + +source pc/Qconfig +source gates/Qconfig diff --git a/devices/gates/Makefile b/devices/gates/Makefile index b5952ed036..3afbdc982d 100644 --- a/devices/gates/Makefile +++ b/devices/gates/Makefile @@ -1,2 +1 @@ -gates-obj-$(CONFIG_GATES) += gate.o logic_gates.o src_snk.o -common-obj-y += $(addprefix devices/gates/,$(gates-obj-y)) +gates-obj-$(CONFIG_GATES) := gate.o logic_gates.o src_snk.o diff --git a/devices/gates/Qconfig b/devices/gates/Qconfig index d4e5730a0a..91425e1e19 100644 --- a/devices/gates/Qconfig +++ b/devices/gates/Qconfig @@ -1,5 +1,6 @@ config GATES - tristate "Gate devices" - depends on DEVICE - ---help--- - This module provides gate devices + bool "Gate devices" + default y + depends on DEVICE + help + This module provides gate devices diff --git a/devices/pc/Makefile b/devices/pc/Makefile new file mode 100644 index 0000000000..47ce0e1473 --- /dev/null +++ b/devices/pc/Makefile @@ -0,0 +1 @@ +pc-obj-$(CONFIG_I440FX) := i440fx.o diff --git a/devices/pc/Qconfig b/devices/pc/Qconfig new file mode 100644 index 0000000000..1a0c0e9dc5 --- /dev/null +++ b/devices/pc/Qconfig @@ -0,0 +1,6 @@ +config I440FX + bool "I440FX chipset" + default y + depends on PCI + help + bar diff --git a/devices/pc/pci.h b/devices/pc/pci.h deleted file mode 100644 index f49f52cd31..0000000000 --- a/devices/pc/pci.h +++ /dev/null @@ -1,72 +0,0 @@ -#ifndef PCI_DEVICE_H -#define PCI_DEVICE_H - -#include "device.h" - -typedef struct PCIDevice -{ - Device parent; - - struct PCIBus *bus; - - uint8_t config[256]; - uint8_t wmask[256]; - uint8_t w1mask[256]; -} PCIDevice; - -typedef uint64_t (PCIDeviceRead)(PCIDevice *device, int region, uint64_t offset, int size); -typedef void (PCIDeviceWrite)(PCIDevice *device, int region, uint64_t offset, int size, uint64_t value); - -typedef struct PCIDeviceClass -{ - DeviceClass parent_class; - - PCIDeviceRead *read; - PCIDeviceWrite *write; -} PCIDeviceClass; - -void pci_device_initialize(PCIDevice *obj, const char *id); -void pci_device_finalize(PCIDevice *obj); -void pci_device_visit(PCIDevice *device, Visitor *v, const char *name, Error **errp); - -uint32_t pci_device_config_read(PCIDevice *device, uint8_t offset, int size); -void pci_device_config_write(PCIDevice *device, uint8_t offset, int size, uint8_t value); - -uint64_t pci_device_region_read(PCIDevice *device, int region, uint64_t offset, int size); -void pci_device_region_write(PCIDevice *device, int region, uint64_t offset, int size, uint64_t value); - -/* Config space accessors */ -void pci_device_set_vendor_id(PCIDevice *device, uint16_t value); -uint16_t pci_device_get_vendor_id(PCIDevice *device); - -void pci_device_set_device_id(PCIDevice *device, uint16_t value); -uint16_t pci_device_get_device_id(PCIDevice *device); - -void pci_device_set_command(PCIDevice *device, uint16_t value); -uint16_t pci_device_get_command(PCIDevice *device); - -void pci_device_set_status(PCIDevice *device, uint16_t value); -uint16_t pci_device_get_status(PCIDevice *device); - -void pci_device_set_class_revision(PCIDevice *device, uint8_t value); -uint8_t pci_device_get_class_revision(PCIDevice *device); - -void pci_device_set_class_prog(PCIDevice *device, uint8_t value); -uint8_t pci_device_get_class_prog(PCIDevice *device); - -void pci_device_set_class_device(PCIDevice *device, uint16_t value); -uint16_t pci_device_get_class_device(PCIDevice *device); - -void pci_device_set_cache_line_size(PCIDevice *device, uint8_t value); -uint8_t pci_device_get_cache_line_size(PCIDevice *device); - -void pci_device_set_latency_timer(PCIDevice *device, uint8_t value); -uint8_t pci_device_get_latency_timer(PCIDevice *device); - -void pci_device_set_header_type(PCIDevice *device, uint8_t value); -uint8_t pci_device_get_header_type(PCIDevice *device); - -void pci_device_set_bist(PCIDevice *device, uint8_t value); -uint8_t pci_device_get_bist(PCIDevice *device); - -#endif diff --git a/qom/Makefile b/qom/Makefile new file mode 100644 index 0000000000..90649d3e2f --- /dev/null +++ b/qom/Makefile @@ -0,0 +1 @@ +qom-obj-$(CONFIG_QOM) += type.o plug.o plug-proptypes.o diff --git a/qom/Qconfig b/qom/Qconfig new file mode 100644 index 0000000000..da0e265f69 --- /dev/null +++ b/qom/Qconfig @@ -0,0 +1,5 @@ +config QOM + bool "QEMU Object Model Support" + default y + help + This is the core object model used by QEMU. diff --git a/devices/plug-proptypes.c b/qom/plug-proptypes.c similarity index 100% rename from devices/plug-proptypes.c rename to qom/plug-proptypes.c diff --git a/devices/plug.c b/qom/plug.c similarity index 100% rename from devices/plug.c rename to qom/plug.c diff --git a/devices/type.c b/qom/type.c similarity index 100% rename from devices/type.c rename to qom/type.c diff --git a/scripts/genconfig.sh b/scripts/genconfig.sh new file mode 100755 index 0000000000..319d72dc22 --- /dev/null +++ b/scripts/genconfig.sh @@ -0,0 +1,16 @@ +#!/bin/sh + +process() { + local basedir=`dirname $1` + cat "$1" | while read LINE; do + local first_word=`echo $LINE | cut -f1 -d' '` + if test "$first_word" = "config"; then + echo $LINE | sed -e 's:^config \(.*\):CONFIG_\1=y:g' + elif test "$first_word" = "source"; then + local rest=`echo $LINE | cut -f2- -d' '` + process "$basedir/$rest" + fi + done +} + +process "$1" -- 2.11.4.GIT