From patchwork Tue Jun 5 01:00:11 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Roth X-Patchwork-Id: 162891 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id C610AB6F9A for ; Tue, 5 Jun 2012 11:17:18 +1000 (EST) Received: from localhost ([::1]:46417 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Sbi9L-0002dM-Cb for incoming@patchwork.ozlabs.org; Mon, 04 Jun 2012 21:01:31 -0400 Received: from eggs.gnu.org ([208.118.235.92]:48348) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Sbi8k-0001Tg-KZ for qemu-devel@nongnu.org; Mon, 04 Jun 2012 21:00:58 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Sbi8i-0002so-E9 for qemu-devel@nongnu.org; Mon, 04 Jun 2012 21:00:54 -0400 Received: from mail-pb0-f45.google.com ([209.85.160.45]:58704) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Sbi8i-0002p7-4e for qemu-devel@nongnu.org; Mon, 04 Jun 2012 21:00:52 -0400 Received: by mail-pb0-f45.google.com with SMTP id ro12so7301741pbb.4 for ; Mon, 04 Jun 2012 18:00:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references; bh=uvwcufaUYhkDoxm9RmGsG9HjMQEiamxHFC6sRvZ84bY=; b=XvMrrgdqRjJ3Nq19fPVR/cOlyL4HYAjCDdKF1LxipUHZmLqm8z3/VklquLeR5sUgpT +LzWeDLyZtrmfqM4Qe3v5HpMdnbzrb6Y0+nVSLfWw8IJyzg5edxrY9TffEr6pUJky1/J 03JLHYFHxwzJViMNqbyFbbfse37z5NheTZCmGu1QcvmpIBKNgpQOyjGK6wsOTzbHNh/n 5SeL6ZJr0MyIKTYSa0O0MSsZwEgu3Gpj82LLN4oaidIP1QB+G7G7wjXilKguU8JVEruf fSnNKBo7g3E+8e2cJoy+cXxfGy9Qho3v84A16cvxyhz7l9UNdijzdJcH507ozvw8f/QI pHWA== Received: by 10.68.227.163 with SMTP id sb3mr45685673pbc.74.1338858051203; Mon, 04 Jun 2012 18:00:51 -0700 (PDT) Received: from localhost.localdomain ([32.97.110.59]) by mx.google.com with ESMTPS id np8sm408059pbc.71.2012.06.04.18.00.49 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 04 Jun 2012 18:00:50 -0700 (PDT) From: Michael Roth To: qemu-devel@nongnu.org Date: Mon, 4 Jun 2012 20:00:11 -0500 Message-Id: <1338858018-17189-11-git-send-email-mdroth@linux.vnet.ibm.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1338858018-17189-1-git-send-email-mdroth@linux.vnet.ibm.com> References: <1338858018-17189-1-git-send-email-mdroth@linux.vnet.ibm.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.85.160.45 Cc: aliguori@us.ibm.com, quintela@redhat.com, owasserm@redhat.com, yamahata@valinux.co.jp, pbonzini@redhat.com, akong@redhat.com, afaerber@suse.de Subject: [Qemu-devel] [PATCH 10/17] Makefile: add infrastructure to incorporate qidl-generated files X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org This will rebuild the qidl-generated qapi schemas in $(SRC_DIR)/qidl-generated whenever we do a build where of the annotated sources has been modified. As a result, changes will be reflected in the working tree so we can detect changes and commit them in cases where the changes are correct/expected. We also add the necessary targets for compiling and linking in the qapi-generated visitors for device state. RTC is the first user. Signed-off-by: Michael Roth --- Makefile.objs | 6 ++++++ Makefile.target | 37 ++++++++++++++++++++++++++++++++++++- 2 files changed, 42 insertions(+), 1 deletions(-) diff --git a/Makefile.objs b/Makefile.objs index 70c5c79..373d5af 100644 --- a/Makefile.objs +++ b/Makefile.objs @@ -467,6 +467,12 @@ qga-obj-y += qemu-ga.o module.o qga-obj-$(CONFIG_WIN32) += oslib-win32.o qga-obj-$(CONFIG_POSIX) += oslib-posix.o qemu-sockets.o qemu-option.o +###################################################################### +# qidl + +qidl-obj-y += $(qapi-obj-y) qapi/misc-qapi-visit.o + + vl.o: QEMU_CFLAGS+=$(GPROF_CFLAGS) vl.o: QEMU_CFLAGS+=$(SDL_CFLAGS) diff --git a/Makefile.target b/Makefile.target index 1582904..45e4459 100644 --- a/Makefile.target +++ b/Makefile.target @@ -20,6 +20,10 @@ QEMU_CFLAGS += -I../linux-headers endif QEMU_CFLAGS += -I.. -I$(TARGET_PATH) -DNEED_CPU_H +qidl-dir := $(SRC_PATH)/qidl-generated +qapi-dir := $(BUILD_DIR)/qapi-generated +QEMU_CFLAGS += -I$(qapi-dir) + include $(SRC_PATH)/Makefile.objs QEMU_CFLAGS+=-I$(SRC_PATH)/include @@ -76,6 +80,35 @@ all: $(PROGS) stap @true ######################################################### +# QAPI-generated device state visitors +QIDL_SOURCES_SHORT=hw/mc146818rtc_state.h +QIDL_SOURCES=$(addprefix $(SRC_PATH)/, $(QIDL_SOURCES_SHORT)) +QIDL_SCHEMAS=$(patsubst %.h,$(qidl-dir)/%.json, $(subst _state,, $(notdir $(QIDL_SOURCES)))) + +$(QIDL_SCHEMAS) qidl: $(QIDL_SOURCES) $(SRC_PATH)/scripts/qc.py + mkdir -p $(qidl-dir) + for f in $(QIDL_SOURCES); do \ + json_filename=$(qidl-dir)/`basename $$(basename $$f .h) _state`.json; \ + $(PYTHON) $(SRC_PATH)/scripts/qc.py < $$f >$$json_filename; \ + done + +QIDL_DEVICES=mc146818rtc.o +QIDL_DEVICE_VISITORS=$(qapi-dir)/mc146818rtc-qapi-visit.o +QIDL_DEVICE_VISITOR_SOURCES=$(patsubst %.o,%.c, $(QIDL_DEVICE_VISITORS)) +QIDL_DEVICES_VISITOR_SOURCES+=$(patsubst %.o,%.h, $(QIDL_DEVICE_VISITORS)) + +$(QIDL_DEVICE_VISITOR_SOURCES): $(QIDL_SCHEMAS) $(SRC_PATH)/scripts/qapi-visit.py + echo $(QIDL_SCHEMAS) + $(call quiet-command,\ + $(PYTHON) $(SRC_PATH)/scripts/qapi-visit.py -e -o "$(qapi-dir)" \ + -i hw/$(patsubst %-qapi-visit,%_state.h, $(basename $(notdir $@))) \ + -p "$(patsubst %-qapi-visit,%-, $(basename $(notdir $@)))" \ + < $(qidl-dir)/$(patsubst %-qapi-visit,%.json, $(basename $(notdir $@))), " GEN $@") + +$(QIDL_DEVICE_VISITORS): $(QIDL_DEVICE_VISITOR_SOURCES) +$(QIDL_DEVICES): $(QIDL_DEVICE_VISITORS) + +######################################################### # cpu emulator library libobj-y = exec.o translate-all.o cpu-exec.o translate.o libobj-y += tcg/tcg.o tcg/optimize.o @@ -130,6 +163,7 @@ obj-y = main.o syscall.o strace.o mmap.o signal.o thunk.o \ elfload.o linuxload.o uaccess.o gdbstub.o cpu-uname.o \ user-exec.o $(oslib-obj-y) + obj-$(TARGET_HAS_BFLT) += flatload.o obj-$(TARGET_I386) += vm86.o @@ -220,7 +254,7 @@ obj-$(CONFIG_IVSHMEM) += ivshmem.o obj-y += device-hotplug.o # Hardware support -obj-i386-y += mc146818rtc.o pc.o +obj-i386-y += mc146818rtc.o $(qapi-dir)/mc146818rtc-qapi-visit.o pc.o obj-i386-y += apic_common.o apic.o kvmvapic.o obj-i386-y += sga.o ioapic_common.o ioapic.o piix_pci.o obj-i386-y += vmport.o @@ -399,6 +433,7 @@ obj-y += $(addprefix ../libdis/, $(libdis-y)) obj-y += $(libobj-y) obj-y += $(addprefix $(HWDIR)/, $(hw-obj-y)) obj-y += $(addprefix ../, $(trace-obj-y)) +obj-y += $(addprefix ../, $(qidl-obj-y)) endif # CONFIG_SOFTMMU