From patchwork Fri Apr 9 22:06:21 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steven Rostedt X-Patchwork-Id: 12195119 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.2 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_2 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BF8B8C433ED for ; Fri, 9 Apr 2021 22:06:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 77772610D0 for ; Fri, 9 Apr 2021 22:06:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234838AbhDIWGh (ORCPT ); Fri, 9 Apr 2021 18:06:37 -0400 Received: from mail.kernel.org ([198.145.29.99]:51298 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234517AbhDIWGh (ORCPT ); Fri, 9 Apr 2021 18:06:37 -0400 Received: from gandalf.local.home (cpe-66-24-58-225.stny.res.rr.com [66.24.58.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 48292610CF for ; Fri, 9 Apr 2021 22:06:23 +0000 (UTC) Date: Fri, 9 Apr 2021 18:06:21 -0400 From: Steven Rostedt To: Linux Trace Devel Subject: [PATCH v2] libtracefs: Update libtracefs.pc when version changes Message-ID: <20210409180621.62f8c90c@gandalf.local.home> X-Mailer: Claws Mail 3.17.8 (GTK+ 2.24.33; x86_64-pc-linux-gnu) MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-trace-devel@vger.kernel.org From: "Steven Rostedt (VMware)" When the libtracefs version changes, the libtracefs.pc needs to be updated, otherwise it may install the wrong version number. Signed-off-by: Steven Rostedt (VMware) --- Changes since v1: - Fixed version define calculation - Fixed alignment of updating tfs_version.h - Remove tfs_version.h in make clean .gitignore | 1 + Makefile | 31 ++++++++++++++++++++++++++++++- 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index d2d39fb..ff3e014 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,4 @@ lib/ patches/ build_prefix build_uninstall +tfs_version.h diff --git a/Makefile b/Makefile index 9de3217..a3ae0b8 100644 --- a/Makefile +++ b/Makefile @@ -203,10 +203,12 @@ endef BUILD_PREFIX := $(BUILD_OUTPUT)/build_prefix +VERSION_FILE = tfs_version.h + $(BUILD_PREFIX): force $(Q)$(call build_prefix,$(prefix)) -$(PKG_CONFIG_FILE) : ${PKG_CONFIG_SOURCE_FILE}.template $(BUILD_PREFIX) +$(PKG_CONFIG_FILE) : ${PKG_CONFIG_SOURCE_FILE}.template $(BUILD_PREFIX) $(VERSION_FILE) $(Q) $(call do_make_pkgconfig_file,$(prefix)) tags: force @@ -310,6 +312,32 @@ all: $(DEFAULT_TARGET) $(bdir): @mkdir -p $(bdir) +VERSION = $(TFS_VERSION) +PATCHLEVEL = $(TFS_PATCHLEVEL) +EXTRAVERSION = $(TFS_EXTRAVERSION) + +define make_version.h + (echo '/* This file is automatically generated. Do not modify. */'; \ + echo \#define VERSION_CODE $(shell \ + expr $(VERSION) \* 256 + $(PATCHLEVEL)); \ + echo '#define EXTRAVERSION ' $(EXTRAVERSION); \ + echo '#define VERSION_STRING "'$(VERSION).$(PATCHLEVEL).$(EXTRAVERSION)'"'; \ + ) > $1 +endef + +define update_version.h + ($(call make_version.h, $@.tmp); \ + if [ -r $@ ] && cmp -s $@ $@.tmp; then \ + rm -f $@.tmp; \ + else \ + echo ' UPDATE $@'; \ + mv -f $@.tmp $@; \ + fi); +endef + +$(VERSION_FILE): force + $(Q)$(call update_version.h) + $(LIBTRACEFS_STATIC): force $(Q)mkdir -p $(bdir) $(Q)$(MAKE) -C $(src)/src $@ @@ -323,5 +351,6 @@ clean: $(MAKE) -C $(src)/src clean $(RM) $(TARGETS) $(bdir)/*.a $(bdir)/*.so $(bdir)/*.so.* $(bdir)/*.o $(bdir)/.*.d $(RM) $(PKG_CONFIG_FILE) + $(RM) $(VERSION_FILE) .PHONY: clean