source: rtems/cpukit/sapi/src/version.c

Last change on this file was aca1724, checked in by Sebastian Huber <sebastian.huber@…>, on 10/25/22 at 08:38:01

build: Optionally use a VERSION file

Define the RTEMS version in the wscript. Optionally use a VERSION file
to change the default values of the wscript. Allow the command line
option --rtems-version to override RTEMS_MAJOR. Remove support for
command line configurable options (--rtems-option).

Rename internal define RTEMS_VERSION_VC_KEY to
RTEMS_VERSION_CONTROL_KEY.

  • Property mode set to 100644
File size: 2.7 KB
Line 
1/* SPDX-License-Identifier: BSD-2-Clause */
2
3/**
4 * @file
5 *
6 * @ingroup RTEMSImplClassic
7 *
8 * @brief This source file contains the implementation of rtems_version(),
9 *   rtems_version_control_key(), rtems_version_major(), rtems_version_minor(),
10 *   and rtems_version_revision().
11 *
12 * The version strings are created from the various pieces of version
13 * information.  The main version number is part of the build system and is
14 * stamped into <rtems/score/cpuopts.h>.  The version control key string is
15 * extracted from the version control tool when the code is being built and is
16 * updated if it has changed.  It is defined in "version-vc-key.h".  The key
17 * may indicate there are local modification.
18 */
19
20/*
21 *  Copyright (C) 2017.
22 *  Chris Johns <chrisj@rtems.org>
23 *
24 * Redistribution and use in source and binary forms, with or without
25 * modification, are permitted provided that the following conditions
26 * are met:
27 * 1. Redistributions of source code must retain the above copyright
28 *    notice, this list of conditions and the following disclaimer.
29 * 2. Redistributions in binary form must reproduce the above copyright
30 *    notice, this list of conditions and the following disclaimer in the
31 *    documentation and/or other materials provided with the distribution.
32 *
33 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
34 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
35 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
36 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
37 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
38 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
39 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
40 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
41 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
42 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
43 * POSSIBILITY OF SUCH DAMAGE.
44 */
45
46#ifdef HAVE_CONFIG_H
47#include "config.h"
48#endif
49
50#include <rtems/version.h>
51#include <rtems/score/cpuopts.h>
52
53#include "version-vc-key.h"
54
55const char *rtems_version( void )
56{
57#ifdef RTEMS_VERSION_CONTROL_KEY
58  return RTEMS_VERSION "." RTEMS_VERSION_CONTROL_KEY;
59#else
60  return RTEMS_VERSION;
61#endif
62}
63
64int rtems_version_major( void )
65{
66  return __RTEMS_MAJOR__;
67}
68
69int rtems_version_minor( void )
70{
71  return __RTEMS_MINOR__;
72}
73
74int rtems_version_revision( void )
75{
76  return __RTEMS_REVISION__;
77}
78
79const char *rtems_version_control_key( void )
80{
81#ifdef RTEMS_VERSION_CONTROL_KEY
82  return RTEMS_VERSION_CONTROL_KEY;
83#else
84  return "";
85#endif
86}
Note: See TracBrowser for help on using the repository browser.