From 4867085c0cd334004e8d67dff7bd53996f23ade6 Mon Sep 17 00:00:00 2001 From: Michael Brown Date: Fri, 2 Nov 2012 14:46:39 +0000 Subject: [build] Include version number within only a single object file Signed-off-by: Michael Brown --- src/core/main.c | 5 +++-- src/core/version.c | 41 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 44 insertions(+), 2 deletions(-) create mode 100644 src/core/version.c (limited to 'src/core') diff --git a/src/core/main.c b/src/core/main.c index 9ee31d2db..7b7755c94 100644 --- a/src/core/main.c +++ b/src/core/main.c @@ -21,6 +21,7 @@ FILE_LICENCE ( GPL2_OR_LATER ); #include #include #include +#include #include #include #include @@ -82,10 +83,10 @@ __asmcall int main ( void ) { * do so. * */ - printf ( NORMAL "\n\n" PRODUCT_NAME "\n" BOLD "iPXE " VERSION + printf ( NORMAL "\n\n" PRODUCT_NAME "\n" BOLD "iPXE %s" NORMAL " -- Open Source Network Boot Firmware -- " CYAN "http://ipxe.org" NORMAL "\n" - "Features:" ); + "Features:", product_version ); for_each_table_entry ( feature, FEATURES ) printf ( " %s", feature->name ); printf ( "\n" ); diff --git a/src/core/version.c b/src/core/version.c new file mode 100644 index 000000000..1aa22d8ec --- /dev/null +++ b/src/core/version.c @@ -0,0 +1,41 @@ +/* + * Copyright (C) 2012 Michael Brown . + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + * 02110-1301, USA. + */ + +FILE_LICENCE ( GPL2_OR_LATER ); + +/** @file + * + * Version number + * + */ + +#include +#include + +/** Version number feature */ +FEATURE_VERSION ( VERSION_MAJOR, VERSION_MINOR, VERSION_PATCH ); + +/** Product major version */ +const int product_major_version = VERSION_MAJOR; + +/** Product minor version */ +const int product_minor_version = VERSION_MINOR; + +/** Product version string */ +const char *product_version = VERSION; -- cgit v1.2.3-55-g7522