From nobody Fri Nov 7 12:57:30 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1538755218400483.5223096563092; Fri, 5 Oct 2018 09:00:18 -0700 (PDT) Received: from localhost ([::1]:35760 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g8SWX-0001oW-8u for importer@patchew.org; Fri, 05 Oct 2018 12:00:17 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57109) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g8SMF-0006fN-Fm for qemu-devel@nongnu.org; Fri, 05 Oct 2018 11:49:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1g8SM9-0006Fj-TY for qemu-devel@nongnu.org; Fri, 05 Oct 2018 11:49:39 -0400 Received: from mail-wm1-x331.google.com ([2a00:1450:4864:20::331]:40920) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1g8SM9-00068C-El for qemu-devel@nongnu.org; Fri, 05 Oct 2018 11:49:33 -0400 Received: by mail-wm1-x331.google.com with SMTP id z204-v6so2374589wmc.5 for ; Fri, 05 Oct 2018 08:49:28 -0700 (PDT) Received: from zen.linaro.local ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id u76-v6sm3521928wmd.10.2018.10.05.08.49.18 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 05 Oct 2018 08:49:22 -0700 (PDT) Received: from zen.linaroharston (localhost [127.0.0.1]) by zen.linaro.local (Postfix) with ESMTP id 067913E07DB; Fri, 5 Oct 2018 16:49:12 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=AIO4WUa6ztDdHcOwmnxWnQEeyVjoNHgZKlm7LfAVX7k=; b=gYYbld+zifSn9K1DBJBuHRTV0klwmLDdhLdOWb7l6Om2bLoghGMGR7VBhSlIByieGi 8hmvX1nCqjZcuBRQMKoZDRNAPzqvwWzLdlFzEiyJw31g/Xo4SyOAJPUUqC6gwOoazJQy gbo4GQKb8vWDildtMAL9wHkgwxCDzS8qANOv0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=AIO4WUa6ztDdHcOwmnxWnQEeyVjoNHgZKlm7LfAVX7k=; b=BGAXxzDmjAxUFXEnGgfvqWl7SCflxqlr5b3hQZxmd4EO5FdmhrliDH9Fh5dFDGayp3 DybYCb7WW/4s5/XX3V7ARDSsn/azIAJCMj8ITTQjaHqdgLXcHUEoMIZs3XkQXV2aCt8z cNM46qNdSbSVzmYk4Ug2lArLRLWXz+gDYe9CyX/0D6opwDHtnvTo/D/EaFFCGOscmDcm F+Fmomi24yYStHugMJa6sYldw0GjJVqm2aqexWWCBguV8aJW2ETLOZiew8Pp8naspmhZ mu7aoDbguhFr4aO9e2PlJEBHnPort+H+Mrr2joabY3f6XWh88ozvo4WZB7DbCsXMREyc 4+hg== X-Gm-Message-State: ABuFfohFyxMbMZdsZJRvkcE6AWIz4n9uoIC0p60a5TVyxoB9eygkVshy skBm1iWUq4Pts1j3I/QEmx1QJY0T/zk= X-Google-Smtp-Source: ACcGV60L4Y9Yg6jR/CCnYsUseVNb8QfqZmEvML3yJX0Zay4zl/CasQqhfKfuSuL/EaWrY5FshmHI/g== X-Received: by 2002:a1c:af07:: with SMTP id y7-v6mr8566978wme.33.1538754567674; Fri, 05 Oct 2018 08:49:27 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Date: Fri, 5 Oct 2018 16:49:05 +0100 Message-Id: <20181005154910.3099-17-alex.bennee@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181005154910.3099-1-alex.bennee@linaro.org> References: <20181005154910.3099-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::331 Subject: [Qemu-devel] [RFC PATCH 16/21] trace: add infrastructure for building plugins X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Stefan Hajnoczi , cota@braap.org, =?UTF-8?q?Alex=20Benn=C3=A9e?= , vilanova@ac.upc.edu, Pavel.Dovgaluk@ispras.ru Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDMRC_1 RDKM_2 RSF_0 Z_629925259 SPT_0 This allows us to build any bundled plugins in the source tree. Out-of-tree builds can call Makefile.plugins to build in their own source tree: make -f $(QEMU_PATH)/trace/plugins/Makefile.plugins QEMU_SRC=3D$(QEMU_PAT= H) Signed-off-by: Alex Benn=C3=A9e --- Makefile | 5 ++++- trace/Makefile.objs | 24 ++++++++++++++++++++++++ trace/plugins/Makefile.plugins | 32 ++++++++++++++++++++++++++++++++ 3 files changed, 60 insertions(+), 1 deletion(-) create mode 100644 trace/plugins/Makefile.plugins diff --git a/Makefile b/Makefile index 1144d6e3ba..e04d1c5124 100644 --- a/Makefile +++ b/Makefile @@ -438,7 +438,7 @@ dummy :=3D $(call unnest-vars,, \ =20 include $(SRC_PATH)/tests/Makefile.include =20 -all: $(DOCS) $(TOOLS) $(HELPERS-y) recurse-all modules +all: $(DOCS) $(TOOLS) $(HELPERS-y) recurse-all modules plugins =20 qemu-version.h: FORCE $(call quiet-command, \ @@ -1091,6 +1091,9 @@ help: @echo ' all - Build all' ifdef CONFIG_MODULES @echo ' modules - Build all modules' +endif +ifdef CONFIG_TRACE_PLUGIN + @echo ' plugins - Build all plugins' endif @echo ' dir/file.o - Build specified target only' @echo ' install - Install QEMU, documentation and tools' diff --git a/trace/Makefile.objs b/trace/Makefile.objs index 4977f654a5..4f62022595 100644 --- a/trace/Makefile.objs +++ b/trace/Makefile.objs @@ -58,3 +58,27 @@ util-obj-$(CONFIG_TRACE_PLUGIN) +=3D plugins.o util-obj-y +=3D control.o target-obj-y +=3D control-target.o util-obj-y +=3D qmp.o + +###################################################################### +# Plugins +ifdef CONFIG_TRACE_PLUGIN + +PLUGINS=3D$(dir $(wildcard $(SRC_PATH)/trace/plugins/*/.)) + +.PHONY: plugins $(PLUGINS) + +plugins: $(PLUGINS) + $(info built all plugins $(PLUGINS)) + +$(PLUGINS): + $(call quiet-command, \ + (cd $@ && $(MAKE) -f $(SRC_PATH)/trace/plugins/Makefile.plugins \ + QEMU_SRC=3D$(SRC_PATH) \ + BUILD_DIR=3D$(BUILD_DIR)/trace/plugins), \ + "PLUGIN","in $@") + +else + +plugins: + +endif diff --git a/trace/plugins/Makefile.plugins b/trace/plugins/Makefile.plugins new file mode 100644 index 0000000000..0056d91c74 --- /dev/null +++ b/trace/plugins/Makefile.plugins @@ -0,0 +1,32 @@ +# -*- Mode: makefile -*- +# +# QEMU plugins +# +# This Makefile is used to build plugins for QEMU. Unlike the rest of +# the object files we build we don't have visibility of QEMU's +# internals. When called from the main makefile we build plugins into +# BUILD_DIR/plugins otherwise where ever the Makefile was called from. +# QEMU_SRC +# + +BUILD_DIR ?=3D $(CURDIR) +CC ?=3D cc + +ifndef QEMU_SRC +$(error need to define QEMU_SRC for the build) +endif + +GLIB_CFLAGS =3D $(shell pkg-config --cflags glib-2.0) +CFLAGS =3D -I$(QEMU_SRC)/include/plugins $(GLIB_CFLAGS) -fno-PIE -fPIC -O3= -g +LDFLAGS =3D $(shell pkg-config --libs glib-2.0) -shared + +SRC =3D $(wildcard *.c) +PLUGINS =3D $(addprefix $(BUILD_DIR)/,$(SRC:.c=3D.so)) + +$(BUILD_DIR)/%.so: %.c + $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< + +all: $(PLUGINS) + +clean: + rm -f $(PLUGIN_SO) $(PLUGIN_OBJ) --=20 2.17.1