From patchwork Fri Dec 12 12:35:18 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Karel Zak X-Patchwork-Id: 5482101 Return-Path: X-Original-To: patchwork-linux-btrfs@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id BE9D2BEEA8 for ; Fri, 12 Dec 2014 12:37:05 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 1D4B02017D for ; Fri, 12 Dec 2014 12:37:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 45F1520172 for ; Fri, 12 Dec 2014 12:36:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S967778AbaLLMgG (ORCPT ); Fri, 12 Dec 2014 07:36:06 -0500 Received: from mx1.redhat.com ([209.132.183.28]:58020 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S966556AbaLLMgF (ORCPT ); Fri, 12 Dec 2014 07:36:05 -0500 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id sBCCa5t7014202 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Fri, 12 Dec 2014 07:36:05 -0500 Received: from x2.net.home (ovpn-113-55.phx2.redhat.com [10.3.113.55]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id sBCCa4qD030634; Fri, 12 Dec 2014 07:36:04 -0500 From: Karel Zak To: linux-btrfs@vger.kernel.org Cc: Karel Zak Subject: [PATCH 04/10] btrfs-progs: use ./configure to generate version.h Date: Fri, 12 Dec 2014 13:35:18 +0100 Message-Id: <1418387724-20188-5-git-send-email-kzak@redhat.com> In-Reply-To: <1418387724-20188-1-git-send-email-kzak@redhat.com> References: <1418387724-20188-1-git-send-email-kzak@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The original homemade solution is unnecessary, autotools provides better infrastructure to generate files. Signed-off-by: Karel Zak --- Makefile.in | 4 ---- configure.ac | 9 +++++++++ version.h.in | 11 +++++++++++ version.sh | 30 +++--------------------------- 4 files changed, 23 insertions(+), 31 deletions(-) create mode 100644 version.h.in diff --git a/Makefile.in b/Makefile.in index 0dd83ea..dad1685 100644 --- a/Makefile.in +++ b/Makefile.in @@ -154,10 +154,6 @@ test: # static: $(progs_static) -version.h: - @echo " [SH] $@" - $(Q)bash version.sh - $(libs_shared): $(libbtrfs_objects) $(lib_links) send.h @echo " [LD] $@" $(Q)$(CC) $(CFLAGS) $(libbtrfs_objects) $(LDFLAGS) $(lib_LIBS) \ diff --git a/configure.ac b/configure.ac index 7a6c264..937d50f 100644 --- a/configure.ac +++ b/configure.ac @@ -3,6 +3,10 @@ AC_INIT([btrfs-progs], [linux-btrfs@vger.kernel.org],, [http://btrfs.wiki.kernel.org]) +dnl library version +LIBBTRFS_MAJOR=0 +LIBBTRFS_MINOR=1 +LIBBTRFS_PATCHLEVEL=1 AC_PREREQ([2.60]) @@ -74,11 +78,16 @@ AC_SUBST([LZO2_LIBS_STATIC]) AC_SUBST([LZO2_CFLAGS]) +dnl library stuff +AC_SUBST([LIBBTRFS_MAJOR]) +AC_SUBST([LIBBTRFS_MINOR]) +AC_SUBST([LIBBTRFS_PATCHLEVEL]) AC_CONFIG_HEADERS([config.h]) AC_CONFIG_FILES([ Makefile +version.h ]) AC_OUTPUT diff --git a/version.h.in b/version.h.in new file mode 100644 index 0000000..012d265 --- /dev/null +++ b/version.h.in @@ -0,0 +1,11 @@ +#ifndef __LIBBTRFS_VERSION_H__ +#define __LIBBTRFS_VERSION_H__ + +#define BTRFS_LIB_MAJOR @LIBBTRFS_MAJOR@ +#define BTRFS_LIB_MINOR @LIBBTRFS_MINOR@ +#define BTRFS_LIB_PATCHLEVEL @LIBBTRFS_PATCHLEVEL@ + +#define BTRFS_LIB_VERSION ( BTRFS_LIB_MAJOR * 10000 + \ + BTRFS_LIB_MINOR * 100 + \ + BTRFS_LIB_PATCHLEVEL ) +#endif diff --git a/version.sh b/version.sh index 456853c..42b47c4 100755 --- a/version.sh +++ b/version.sh @@ -9,9 +9,6 @@ v="v3.17.3" opt=$1 -lib_major=0 -lib_minor=1 -lib_patchlevel=1 which git &> /dev/null if [ $? == 0 -a -d .git ]; then @@ -32,30 +29,9 @@ fi if [ "$opt" = "--configure" ]; then # Omit the trailing newline, so that m4_esyscmd can use the result directly. echo "$v" | tr -d '\n' - exit 0 +else + echo "$v" fi -echo "/* NOTE: this file is autogenerated by version.sh, do not edit */" > .build-version.h -echo "#ifndef __BUILD_VERSION" >> .build-version.h -echo >> .build-version.h -echo "#define __BUILD_VERSION" >> .build-version.h -echo >> .build-version.h -echo "#define BTRFS_LIB_MAJOR $lib_major" >> .build-version.h -echo "#define BTRFS_LIB_MINOR $lib_minor" >> .build-version.h -echo "#define BTRFS_LIB_PATCHLEVEL $lib_patchlevel" >> .build-version.h -echo >> .build-version.h -echo "#define BTRFS_LIB_VERSION ( BTRFS_LIB_MAJOR * 10000 + \\" >> .build-version.h -echo " BTRFS_LIB_MINOR * 100 + \\" >> .build-version.h -echo " BTRFS_LIB_PATCHLEVEL )" >> .build-version.h -echo >> .build-version.h -echo "#define BTRFS_BUILD_VERSION \"Btrfs $v\"" >> .build-version.h -echo "#endif" >> .build-version.h +exit 0 -diff -q version.h .build-version.h >& /dev/null - -if [ $? == 0 ]; then - rm .build-version.h - exit 0 -fi - -mv .build-version.h version.h