summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2008-07-07 15:21:56 -0700
committerH. Peter Anvin <hpa@zytor.com>2008-07-07 15:21:56 -0700
commit07ff8e874b0bd1d1c4fa893c94063fbedf6e3315 (patch)
tree38fdb21cf0feb6a7c68acdc767833a9b25edb504
parentfd40500625723610a9abe7fb20775da4d88ca4dc (diff)
downloadsyslinux-07ff8e874b0bd1d1c4fa893c94063fbedf6e3315.tar.gz
Centralize more of the version number machinery
Centralize more (most) of the version number machinery to version.pl.
-rw-r--r--Makefile14
-rw-r--r--core/Makefile5
-rw-r--r--core/comboot.inc2
-rw-r--r--core/extlinux.asm2
-rw-r--r--core/isolinux.asm2
-rw-r--r--core/ldlinux.asm2
-rw-r--r--core/pxelinux.asm2
-rw-r--r--extlinux/main.c5
-rw-r--r--memdisk/Makefile7
-rw-r--r--memdisk/memdisk.asm2
-rw-r--r--memdisk/setup.c5
-rw-r--r--version2
-rwxr-xr-xversion.pl29
13 files changed, 49 insertions, 30 deletions
diff --git a/Makefile b/Makefile
index 1a073b27..6b90c094 100644
--- a/Makefile
+++ b/Makefile
@@ -15,8 +15,7 @@
#
topdir = .
include $(topdir)/MCONFIG
-
-VERSION := $(shell cat version)
+-include $(topdir)/version.mk
#
# The BTARGET refers to objects that are derived from ldlinux.asm; we
@@ -31,7 +30,7 @@ VERSION := $(shell cat version)
# syslinux.exe is BTARGET so as to not require everyone to have the
# mingw suite installed
-BTARGET = version.gen version.h
+BTARGET = version.gen version.h version.mk
BOBJECTS = $(BTARGET) \
mbr/mbr.bin mbr/gptmbr.bin \
core/pxelinux.0 core/isolinux.bin core/isolinux-debug.bin \
@@ -46,7 +45,7 @@ BOBJECTS = $(BTARGET) \
# for "make installer".
BSUBDIRS = codepage core memdisk com32 mbr memdump gpxe sample \
libinstaller dos win32
-ITARGET =
+ITARGET =
IOBJECTS = $(ITARGET) dos/copybs.com utils/gethostip utils/mkdiskimage \
mtools/syslinux linux/syslinux extlinux/extlinux
ISUBDIRS = libinstaller mtools linux extlinux utils
@@ -89,10 +88,11 @@ installer:
installer-local: $(ITARGET) $(BINFILES)
version.gen: version version.pl
- $(PERL) version.pl $< $@ '%define'
-
+ $(PERL) version.pl $< $@ '%define < @'
version.h: version version.pl
- $(PERL) version.pl $< $@ '#define'
+ $(PERL) version.pl $< $@ '#define < @'
+version.mk: version version.pl
+ $(PERL) version.pl $< $@ '< := @'
local-install: installer
mkdir -m 755 -p $(INSTALLROOT)$(BINDIR)
diff --git a/core/Makefile b/core/Makefile
index 73508c1c..f5b9b4e5 100644
--- a/core/Makefile
+++ b/core/Makefile
@@ -18,6 +18,9 @@
MAKEFLAGS += -r
MAKE += -r
+topdir = ..
+include $(topdir)/version.mk
+
CC = gcc
TMPFILE = $(shell mktemp /tmp/gcc_ok.XXXXXX)
@@ -43,8 +46,6 @@ NINCLUDE =
PERL = perl
-VERSION := $(shell cat ../version)
-
# This is very similar to cp437; technically it's for Norway and Denmark,
# but it's unlikely the characters that are different will be used in
# filenames by other users.
diff --git a/core/comboot.inc b/core/comboot.inc
index 5367f6f7..ca11852f 100644
--- a/core/comboot.inc
+++ b/core/comboot.inc
@@ -454,7 +454,7 @@ comapi_get_version:
; Number of API functions supported
mov P_AX,int22_count
; SYSLINUX version
- mov P_CX,(VER_MAJOR << 8)+VER_MINOR
+ mov P_CX,(VERSION_MAJOR << 8)+VERSION_MINOR
; SYSLINUX derivative ID byte
mov P_DX,my_id
; For future use
diff --git a/core/extlinux.asm b/core/extlinux.asm
index d4fc9cd9..24d0d926 100644
--- a/core/extlinux.asm
+++ b/core/extlinux.asm
@@ -565,7 +565,7 @@ ldlinux_sys:
syslinux_banner db 0Dh, 0Ah
db 'EXTLINUX '
- db VERSION, ' ', DATE_STR, ' ', 0
+ db VERSION_STR, ' ', DATE_STR, ' ', 0
db 0Dh, 0Ah, 1Ah ; EOF if we "type" this in DOS
align 8, db 0
diff --git a/core/isolinux.asm b/core/isolinux.asm
index a3871835..69023700 100644
--- a/core/isolinux.asm
+++ b/core/isolinux.asm
@@ -795,7 +795,7 @@ writestr_early equ writestr
; Data that needs to be in the first sector
; -----------------------------------------------------------------------------
-syslinux_banner db CR, LF, 'ISOLINUX ', VERSION, ' ', DATE_STR, ' ', 0
+syslinux_banner db CR, LF, 'ISOLINUX ', VERSION_STR, ' ', DATE_STR, ' ', 0
copyright_str db ' Copyright (C) 1994-', year, ' H. Peter Anvin'
db CR, LF, 0
isolinux_str db 'isolinux: ', 0
diff --git a/core/ldlinux.asm b/core/ldlinux.asm
index 8fed9b37..ea42d88b 100644
--- a/core/ldlinux.asm
+++ b/core/ldlinux.asm
@@ -588,7 +588,7 @@ syslinux_banner db 0Dh, 0Ah
%else
db 'SYSLINUX '
%endif
- db VERSION, ' ', DATE_STR, ' ', 0
+ db VERSION_STR, ' ', DATE_STR, ' ', 0
db 0Dh, 0Ah, 1Ah ; EOF if we "type" this in DOS
align 8, db 0
diff --git a/core/pxelinux.asm b/core/pxelinux.asm
index c6a092cd..43985828 100644
--- a/core/pxelinux.asm
+++ b/core/pxelinux.asm
@@ -2727,7 +2727,7 @@ localboot_msg db 'Booting from local disk...', CR, LF, 0
trying_msg db 'Trying to load: ', 0
fourbs_msg db BS, BS, BS, BS, 0
default_str db 'default', 0
-syslinux_banner db CR, LF, 'PXELINUX ', VERSION, ' ', DATE_STR, ' ', 0
+syslinux_banner db CR, LF, 'PXELINUX ', VERSION_STR, ' ', DATE_STR, ' ', 0
cfgprefix db 'pxelinux.cfg/' ; No final null!
cfgprefix_len equ ($-cfgprefix)
diff --git a/extlinux/main.c b/extlinux/main.c
index 819f74b5..e9226fce 100644
--- a/extlinux/main.c
+++ b/extlinux/main.c
@@ -812,7 +812,7 @@ static const char *find_device(const char *mtab_file, dev_t dev)
mtab = setmntent(mtab_file, "r");
if (!mtab)
return NULL;
-
+
while ( (mnt = getmntent(mtab)) ) {
if ( (!strcmp(mnt->mnt_type, "ext2") ||
!strcmp(mnt->mnt_type, "ext3")) &&
@@ -1001,7 +1001,8 @@ main(int argc, char *argv[])
opt.reset_adv = 1;
break;
case 'v':
- fputs("extlinux " VERSION "\n", stderr);
+ fputs("extlinux " VERSION_STR
+ " Copyright 1994-" YEAR_STR " H. Peter Anvin \n", stderr);
exit(0);
default:
usage(EX_USAGE);
diff --git a/memdisk/Makefile b/memdisk/Makefile
index 1ce43c2a..005ab1d4 100644
--- a/memdisk/Makefile
+++ b/memdisk/Makefile
@@ -10,7 +10,8 @@
##
## -----------------------------------------------------------------------
-VERSION := $(shell cat ../version)
+topdir = ..
+include $(topdir)/version.mk
TMPFILE = $(shell mktemp /tmp/gcc_ok.XXXXXX)
@@ -25,14 +26,14 @@ FREE := $(call gcc_ok,-ffreestanding,) $(call gcc_ok,-fno-stack-protector,)
CFLAGS = $(M32) $(FREE) -g -W -Wall -Wno-sign-compare \
-Os -fomit-frame-pointer -march=i386 -mregparm=3 $(ALIGN) \
- -DVERSION='"$(VERSION)"' -DDATE='"$(DATE)"'
+ -DDATE='"$(DATE)"'
SFLAGS = $(M32) -march=i386 -D__ASSEMBLY__
LDFLAGS = $(M32) -g
INCLUDE = -I../com32/include
LD = ld -m elf_i386
NASM = nasm
NASMOPT = -O9999
-NFLAGS = -dVERSION='"$(VERSION)"' -dDATE='"$(DATE)"' -dWITH_EDD
+NFLAGS = -dDATE='"$(DATE)"' -dWITH_EDD
NINCLUDE =
OBJCOPY = objcopy
PERL = perl
diff --git a/memdisk/memdisk.asm b/memdisk/memdisk.asm
index 15d662d2..eb4370ab 100644
--- a/memdisk/memdisk.asm
+++ b/memdisk/memdisk.asm
@@ -918,7 +918,7 @@ Mover_dummy2: dd 0, 0, 0, 0 ; More space for the BIOS
alignb 4, db 0
MemDisk_Info equ $ ; Pointed to by installation check
MDI_Bytes dw MDI_Len ; Total bytes in MDI structure
-MDI_Version db VER_MINOR, VER_MAJOR ; MEMDISK version
+MDI_Version db VERSION_MINOR, VERSION_MAJOR ; MEMDISK version
PatchArea equ $ ; This gets filled in by the installer
diff --git a/memdisk/setup.c b/memdisk/setup.c
index 32dd8ed5..b9466335 100644
--- a/memdisk/setup.c
+++ b/memdisk/setup.c
@@ -15,11 +15,12 @@
#include "conio.h"
#include "version.h"
#include "memdisk.h"
+#include "../version.h"
const char memdisk_version[] =
-"MEMDISK " VERSION " " DATE;
+"MEMDISK " VERSION_STR " " DATE;
const char copyright[] =
-"Copyright " FIRSTYEAR "-" COPYYEAR " H. Peter Anvin";
+"Copyright " FIRSTYEAR "-" YEAR_STR " H. Peter Anvin";
extern const char _binary_memdisk_bin_start[], _binary_memdisk_bin_end[];
extern const char _binary_memdisk_bin_size[]; /* Weird, I know */
diff --git a/version b/version
index 84ec12aa..eddff853 100644
--- a/version
+++ b/version
@@ -1 +1 @@
-3.71
+3.71 2008
diff --git a/version.pl b/version.pl
index ee5c5c6c..a08ce835 100755
--- a/version.pl
+++ b/version.pl
@@ -5,20 +5,35 @@
use Fcntl;
+sub defx($$$) {
+ my($def, $name, $val) = @_;
+
+ $def =~ s/\</${name}/g;
+ $def =~ s/\@/${val}/g;
+
+ return $def."\n";
+}
+
($vfile, $vout, $def) = @ARGV;
sysopen(VERSION, $vfile, O_RDONLY) or die "$0: Cannot open $vfile\n";
-$version = <VERSION>;
-chomp $version;
+$vfile = <VERSION>;
+chomp $vfile;
close(VERSION);
-unless ( $version =~ /^([0-9]+)\.([0-9]+)$/ ) {
+unless ( $vfile =~ /^(([0-9]+)\.([0-9]+))\s+([0-9]+)$/ ) {
die "$0: Cannot parse version format\n";
}
-$vma = $1+0; $vmi = $2+0;
+$version = $1;
+$vma = $2+0;
+$vmi = $3+0;
+$year = $4;
sysopen(VI, $vout, O_WRONLY|O_CREAT|O_TRUNC)
or die "$0: Cannot create $vout: $!\n";
-print VI "$def VERSION \"$version\"\n";
-print VI "$def VER_MAJOR $vma\n";
-print VI "$def VER_MINOR $vmi\n";
+print VI defx($def, 'VERSION', $version);
+print VI defx($def, 'VERSION_STR', '"'.$version.'"');
+print VI defx($def, 'VERSION_MAJOR', $vma);
+print VI defx($def, 'VERSION_MINOR', $vmi);
+print VI defx($def, 'YEAR', $year);
+print VI defx($def, 'YEAR_STR', '"'.$year.'"');
close(VI);