Skip to content
Snippets Groups Projects
Commit 5da72708 authored by ballen4705's avatar ballen4705
Browse files

Automatic versioning in Makefile and executables

git-svn-id: https://smartmontools.svn.sourceforge.net/svnroot/smartmontools/trunk@25 4ea69e1a-61f1-4043-bf83-b5c94c648137
parent f2171679
Branches
No related tags found
No related merge requests found
# Makefile for smartmontools # Makefile for smartmontools
# #
# $Id: Makefile,v 1.9 2002/10/11 09:20:32 ballen4705 Exp $ # $Id: Makefile,v 1.10 2002/10/11 12:15:49 ballen4705 Exp $
# #
# Copyright (C) 2002 Bruce Allen <smartmontools-support@lists.sourceforge.net> # Copyright (C) 2002 Bruce Allen <smartmontools-support@lists.sourceforge.net>
# #
...@@ -17,6 +17,15 @@ CC = gcc ...@@ -17,6 +17,15 @@ CC = gcc
# CFLAGS = -fsigned-char -Wall -g # CFLAGS = -fsigned-char -Wall -g
CFLAGS = -fsigned-char -Wall -O2 CFLAGS = -fsigned-char -Wall -O2
releasefiles=atacmds.c atacmds.h ataprint.c ataprint.h CHANGELOG COPYING extern.h Makefile\
README scsicmds.c scsicmds.h scsiprint.c scsiprint.h smartctl.8 smartctl.c smartctl.h\
smartd.8 smartd.c smartd.h smartd.initd TODO
counter=$(shell cat VERSION)
newcounter=$(shell ./add )
pkgname=smartmontools-5.0
pkgname2=$(pkgname)-$(counter)
all: smartd smartctl all: smartd smartctl
smartctl: atacmds.o scsicmds.o smartctl.c smartctl.h ataprint.o scsiprint.o atacmds.h ataprint.h scsicmds.h scsiprint.h smartctl: atacmds.o scsicmds.o smartctl.c smartctl.h ataprint.o scsiprint.o atacmds.h ataprint.h scsicmds.h scsiprint.h
...@@ -37,8 +46,14 @@ atacmds.o: atacmds.h atacmds.c ...@@ -37,8 +46,14 @@ atacmds.o: atacmds.h atacmds.c
scsicmds.o: scsicmds.h scsicmds.c scsicmds.o: scsicmds.h scsicmds.c
${CC} ${CFLAGS} -c scsicmds.c ${CC} ${CFLAGS} -c scsicmds.c
atacmds.h: VERSION
cat atacmds.h | sed '/SMARTMONTOOLS_VERSION/d' > temp.atacmds.h
echo "#define SMARTMONTOOLS_VERSION " $(counter) > temp.head
cat temp.head temp.atacmds.h > atacmds.h
rm -f temp.atacmds.h temp.head
clean: clean:
rm -f *.o smartctl smartd *~ \#*\# smartmontools*.tar.gz smartmontools*.rpm rm -f *.o smartctl smartd *~ \#*\# smartmontools*.tar.gz smartmontools*.rpm temp.*
install: smartctl smartd smartctl.8 smartd.8 smartd.initd install: smartctl smartd smartctl.8 smartd.8 smartd.initd
install -m 755 -o root -g root -D smartctl $(DESTDIR)/usr/sbin/smartctl install -m 755 -o root -g root -D smartctl $(DESTDIR)/usr/sbin/smartctl
...@@ -50,27 +65,31 @@ install: smartctl smartd smartctl.8 smartd.8 smartd.initd ...@@ -50,27 +65,31 @@ install: smartctl smartd smartctl.8 smartd.8 smartd.initd
echo "To Automatically start smartd on bootup, run /sbin/chkconfig --add smartd" echo "To Automatically start smartd on bootup, run /sbin/chkconfig --add smartd"
uninstall: uninstall:
rm -f /usr/sbin/smartctl /usr/sbin/smartd /usr/share/man/man8/smartctl.8 /usr/share/man/man8/smartd.8 /usr/share/man/man8/smartctl.8.gz /usr/share/man/man8/smartd.8.gz rm -f /usr/sbin/smartctl /usr/sbin/smartd /usr/share/man/man8/smartctl.8 /usr/share/man/man8/smartd.8\
/usr/share/man/man8/smartctl.8.gz /usr/share/man/man8/smartd.8.gz
/sbin/chkconfig --del smartd /sbin/chkconfig --del smartd
/etc/rc.d/init.d/smartd stop /etc/rc.d/init.d/smartd stop
rm -f /etc/rc.d/init.d/smartd rm -f /etc/rc.d/init.d/smartd
releasefiles=atacmds.c atacmds.h ataprint.c ataprint.h CHANGELOG COPYING extern.h Makefile\ # All this mess is to automatically increment the release numbers.
README scsicmds.c scsicmds.h scsiprint.c scsiprint.h smartctl.8 smartctl.c smartctl.h\ # The number of the next release is kept in the file "VERSION"
smartd.8 smartd.c smartd.h smartd.initd TODO
pkgname=smartmontools-5.0
workdir=$(pkgname)
release: $(releasefiles) release: $(releasefiles)
rm -rf $(workdir) rm -rf $(pkgname)
mkdir $(workdir) mkdir $(pkgname)
cp -a $(releasefiles) $(workdir) cp -a $(releasefiles) $(pkgname)
tar zcvf $(pkgname).tar.gz $(workdir) tar zcvf $(pkgname).tar.gz $(pkgname)
rm -rf $(workdir) mv -f $(pkgname) $(pkgname2)
cp $(pkgname).tar.gz /usr/src/redhat/SOURCES tar zcvf $(pkgname2).tar.gz $(pkgname2)
rm -rf $(pkgname2)
mv -f $(pkgname).tar.gz /usr/src/redhat/SOURCES/
cat smartmontools.spec | sed '/Release:/d' > temp.spec
echo "Release: " $(counter) > temp.version
cat temp.version temp.spec > smartmontools.spec
rm -f temp.spec temp.version
rpm -ba smartmontools.spec rpm -ba smartmontools.spec
mv /usr/src/redhat/RPMS/i386/$(pkgname)*.rpm . mv /usr/src/redhat/RPMS/i386/$(pkgname)*.rpm .
mv /usr/src/redhat/SRPMS/$(pkgname)*rpm . mv /usr/src/redhat/SRPMS/$(pkgname)*rpm .
rm -f /usr/src/redhat/SOURCES/$(pkgname).tar.gz rm -f /usr/src/redhat/SOURCES/$(pkgname).tar.gz
echo $(newcounter) > VERSION
1
#!/bin/bash
#
# This is a utility called in the Makefile. It's used together with
# the file "counter" to automatically increment release numbers.
#
a=`cat counter`
let a+=1
echo $a
// $Id: atacmds.h,v 1.5 2002/10/11 09:20:32 ballen4705 Exp $ #define SMARTMONTOOLS_VERSION 2
// $Id: atacmds.h,v 1.6 2002/10/11 12:15:49 ballen4705 Exp $
/* /*
* atacmds.h * atacmds.h
* *
...@@ -20,8 +21,8 @@ ...@@ -20,8 +21,8 @@
// These are the major and minor versions for smartd and smartctl // These are the major and minor versions for smartd and smartctl
#define PROJECTHOME "http://smartmontools.sourceforge.net/" #define PROJECTHOME "http://smartmontools.sourceforge.net/"
#define VERSION_MAJOR 5 #define RELEASE_MAJOR 5
#define VERSION_MINOR 0 #define RELEASE_MINOR 0
#include <sys/ioctl.h> #include <sys/ioctl.h>
#include <linux/hdreg.h> #include <linux/hdreg.h>
......
// $Id: smartctl.c,v 1.5 2002/10/11 09:20:32 ballen4705 Exp $ // $Id: smartctl.c,v 1.6 2002/10/11 12:15:50 ballen4705 Exp $
/* /*
* smartctl.c * smartctl.c
* *
...@@ -57,10 +57,6 @@ unsigned char printcopyleft = FALSE; ...@@ -57,10 +57,6 @@ unsigned char printcopyleft = FALSE;
void Usage ( void){ void Usage ( void){
printf( "smartctl version %i.%i - S.M.A.R.T. Control Program\n",
VERSION_MAJOR, VERSION_MINOR);
printf("Home page of project is " PROJECTHOME "\n\n");
printf( "usage: smartctl -[options] [device]\n"); printf( "usage: smartctl -[options] [device]\n");
printf( "Read Only Options:\n"); printf( "Read Only Options:\n");
printf( "\t\t%c\t\tPrint Copyright and License information\n", printf( "\t\t%c\t\tPrint Copyright and License information\n",
...@@ -218,18 +214,19 @@ int main (int argc, char **argv){ ...@@ -218,18 +214,19 @@ int main (int argc, char **argv){
int fd; int fd;
char *device; char *device;
printf("smartctl version %d.%d-%d Copyright (C) 2002 Bruce Allen\n",RELEASE_MAJOR,RELEASE_MINOR,SMARTMONTOOLS_VERSION);
printf("Home page of project is %s\n\n",PROJECTHOME);
// Part input arguments // Part input arguments
ParseOpts (argc,argv); ParseOpts (argc,argv);
// Print Copyright/License info if needed // Print Copyright/License info if needed
if (printcopyleft){ if (printcopyleft){
printf("smartctl version %d.%d Copyright (C) 2002 Bruce Allen\n",VERSION_MAJOR,VERSION_MINOR);
printf("Home page of project is %s\n\n",PROJECTHOME);
printf("smartctl comes with ABSOLUTELY NO WARRANTY. This\n"); printf("smartctl comes with ABSOLUTELY NO WARRANTY. This\n");
printf("is free software, and you are welcome to redistribute it\n"); printf("is free software, and you are welcome to redistribute it\n");
printf("under the terms of the GNU General Public License Version 2.\n"); printf("under the terms of the GNU General Public License Version 2.\n");
printf("See http://www.gnu.org for further details.\n\n"); printf("See http://www.gnu.org for further details.\n\n");
printf("CVS version ID %s\n","$Id: smartctl.c,v 1.5 2002/10/11 09:20:32 ballen4705 Exp $"); printf("CVS version ID %s\n","$Id: smartctl.c,v 1.6 2002/10/11 12:15:50 ballen4705 Exp $");
exit(0); exit(0);
} }
......
// $Id: smartctl.cpp,v 1.5 2002/10/11 09:20:32 ballen4705 Exp $ // $Id: smartctl.cpp,v 1.6 2002/10/11 12:15:50 ballen4705 Exp $
/* /*
* smartctl.c * smartctl.c
* *
...@@ -57,10 +57,6 @@ unsigned char printcopyleft = FALSE; ...@@ -57,10 +57,6 @@ unsigned char printcopyleft = FALSE;
void Usage ( void){ void Usage ( void){
printf( "smartctl version %i.%i - S.M.A.R.T. Control Program\n",
VERSION_MAJOR, VERSION_MINOR);
printf("Home page of project is " PROJECTHOME "\n\n");
printf( "usage: smartctl -[options] [device]\n"); printf( "usage: smartctl -[options] [device]\n");
printf( "Read Only Options:\n"); printf( "Read Only Options:\n");
printf( "\t\t%c\t\tPrint Copyright and License information\n", printf( "\t\t%c\t\tPrint Copyright and License information\n",
...@@ -218,18 +214,19 @@ int main (int argc, char **argv){ ...@@ -218,18 +214,19 @@ int main (int argc, char **argv){
int fd; int fd;
char *device; char *device;
printf("smartctl version %d.%d-%d Copyright (C) 2002 Bruce Allen\n",RELEASE_MAJOR,RELEASE_MINOR,SMARTMONTOOLS_VERSION);
printf("Home page of project is %s\n\n",PROJECTHOME);
// Part input arguments // Part input arguments
ParseOpts (argc,argv); ParseOpts (argc,argv);
// Print Copyright/License info if needed // Print Copyright/License info if needed
if (printcopyleft){ if (printcopyleft){
printf("smartctl version %d.%d Copyright (C) 2002 Bruce Allen\n",VERSION_MAJOR,VERSION_MINOR);
printf("Home page of project is %s\n\n",PROJECTHOME);
printf("smartctl comes with ABSOLUTELY NO WARRANTY. This\n"); printf("smartctl comes with ABSOLUTELY NO WARRANTY. This\n");
printf("is free software, and you are welcome to redistribute it\n"); printf("is free software, and you are welcome to redistribute it\n");
printf("under the terms of the GNU General Public License Version 2.\n"); printf("under the terms of the GNU General Public License Version 2.\n");
printf("See http://www.gnu.org for further details.\n\n"); printf("See http://www.gnu.org for further details.\n\n");
printf("CVS version ID %s\n","$Id: smartctl.cpp,v 1.5 2002/10/11 09:20:32 ballen4705 Exp $"); printf("CVS version ID %s\n","$Id: smartctl.cpp,v 1.6 2002/10/11 12:15:50 ballen4705 Exp $");
exit(0); exit(0);
} }
......
// $Id: smartd.c,v 1.6 2002/10/11 09:20:32 ballen4705 Exp $ // $Id: smartd.c,v 1.7 2002/10/11 12:15:50 ballen4705 Exp $
/* /*
* smartd.c * smartd.c
* *
...@@ -64,8 +64,8 @@ void printout(int priority,char *fmt, ...){ ...@@ -64,8 +64,8 @@ void printout(int priority,char *fmt, ...){
/* prints help information for command syntax */ /* prints help information for command syntax */
void Usage ( void){ void Usage ( void){
printout(LOG_INFO,"smartd version %i.%i - S.M.A.R.T. Daemon\n", printout(LOG_INFO,"smartd version %d.%d-%d - S.M.A.R.T. Daemon\n",
VERSION_MAJOR, VERSION_MINOR); RELEASE_MAJOR, RELEASE_MINOR,SMARTMONTOOLS_VERSION);
printout(LOG_INFO,"usage: smartd -[opts] \n"); printout(LOG_INFO,"usage: smartd -[opts] \n");
printout(LOG_INFO,"Read Only Commands:\n"); printout(LOG_INFO,"Read Only Commands:\n");
printout(LOG_INFO,"\t\t%c\t\tStart smartd in debug Mode\n",DEBUGMODE); printout(LOG_INFO,"\t\t%c\t\tStart smartd in debug Mode\n",DEBUGMODE);
...@@ -264,7 +264,7 @@ char copyleftstring[]= ...@@ -264,7 +264,7 @@ char copyleftstring[]=
"is free software, and you are welcome to redistribute it\n" "is free software, and you are welcome to redistribute it\n"
"under the terms of the GNU General Public License Version 2.\n" "under the terms of the GNU General Public License Version 2.\n"
"See http://www.gnu.org for further details.\n\n" "See http://www.gnu.org for further details.\n\n"
"CVS Version ID $Id: smartd.c,v 1.6 2002/10/11 09:20:32 ballen4705 Exp $\n"; "CVS Version ID $Id: smartd.c,v 1.7 2002/10/11 12:15:50 ballen4705 Exp $\n";
const char opts[] = { DEBUGMODE, EMAILNOTIFICATION, PRINTCOPYLEFT,'\0' }; const char opts[] = { DEBUGMODE, EMAILNOTIFICATION, PRINTCOPYLEFT,'\0' };
...@@ -304,12 +304,14 @@ int main (int argc, char **argv){ ...@@ -304,12 +304,14 @@ int main (int argc, char **argv){
if (printcopyleft){ if (printcopyleft){
debugmode=1; debugmode=1;
printout(LOG_INFO,"smartd version %d.%d Copyright (C) Bruce Allen 2002\n",VERSION_MAJOR,VERSION_MINOR); printout(LOG_INFO,"smartd version %d.%d-%d Copyright (C) Bruce Allen 2002\n",
RELEASE_MAJOR,RELEASE_MINOR,SMARTMONTOOLS_VERSION);
printout(LOG_INFO,copyleftstring); printout(LOG_INFO,copyleftstring);
exit(0); exit(0);
} }
printout(LOG_INFO,"smartd version %d.%d Copyright (C) Bruce Allen 2002\n",VERSION_MAJOR,VERSION_MINOR); printout(LOG_INFO,"smartd version %d.%d-%d Copyright (C) Bruce Allen 2002\n",
RELEASE_MAJOR,RELEASE_MINOR,SMARTMONTOOLS_VERSION);
if (!debugmode){ if (!debugmode){
daemon_init(); daemon_init();
......
// $Id: smartd.cpp,v 1.6 2002/10/11 09:20:32 ballen4705 Exp $ // $Id: smartd.cpp,v 1.7 2002/10/11 12:15:50 ballen4705 Exp $
/* /*
* smartd.c * smartd.c
* *
...@@ -64,8 +64,8 @@ void printout(int priority,char *fmt, ...){ ...@@ -64,8 +64,8 @@ void printout(int priority,char *fmt, ...){
/* prints help information for command syntax */ /* prints help information for command syntax */
void Usage ( void){ void Usage ( void){
printout(LOG_INFO,"smartd version %i.%i - S.M.A.R.T. Daemon\n", printout(LOG_INFO,"smartd version %d.%d-%d - S.M.A.R.T. Daemon\n",
VERSION_MAJOR, VERSION_MINOR); RELEASE_MAJOR, RELEASE_MINOR,SMARTMONTOOLS_VERSION);
printout(LOG_INFO,"usage: smartd -[opts] \n"); printout(LOG_INFO,"usage: smartd -[opts] \n");
printout(LOG_INFO,"Read Only Commands:\n"); printout(LOG_INFO,"Read Only Commands:\n");
printout(LOG_INFO,"\t\t%c\t\tStart smartd in debug Mode\n",DEBUGMODE); printout(LOG_INFO,"\t\t%c\t\tStart smartd in debug Mode\n",DEBUGMODE);
...@@ -264,7 +264,7 @@ char copyleftstring[]= ...@@ -264,7 +264,7 @@ char copyleftstring[]=
"is free software, and you are welcome to redistribute it\n" "is free software, and you are welcome to redistribute it\n"
"under the terms of the GNU General Public License Version 2.\n" "under the terms of the GNU General Public License Version 2.\n"
"See http://www.gnu.org for further details.\n\n" "See http://www.gnu.org for further details.\n\n"
"CVS Version ID $Id: smartd.cpp,v 1.6 2002/10/11 09:20:32 ballen4705 Exp $\n"; "CVS Version ID $Id: smartd.cpp,v 1.7 2002/10/11 12:15:50 ballen4705 Exp $\n";
const char opts[] = { DEBUGMODE, EMAILNOTIFICATION, PRINTCOPYLEFT,'\0' }; const char opts[] = { DEBUGMODE, EMAILNOTIFICATION, PRINTCOPYLEFT,'\0' };
...@@ -304,12 +304,14 @@ int main (int argc, char **argv){ ...@@ -304,12 +304,14 @@ int main (int argc, char **argv){
if (printcopyleft){ if (printcopyleft){
debugmode=1; debugmode=1;
printout(LOG_INFO,"smartd version %d.%d Copyright (C) Bruce Allen 2002\n",VERSION_MAJOR,VERSION_MINOR); printout(LOG_INFO,"smartd version %d.%d-%d Copyright (C) Bruce Allen 2002\n",
RELEASE_MAJOR,RELEASE_MINOR,SMARTMONTOOLS_VERSION);
printout(LOG_INFO,copyleftstring); printout(LOG_INFO,copyleftstring);
exit(0); exit(0);
} }
printout(LOG_INFO,"smartd version %d.%d Copyright (C) Bruce Allen 2002\n",VERSION_MAJOR,VERSION_MINOR); printout(LOG_INFO,"smartd version %d.%d-%d Copyright (C) Bruce Allen 2002\n",
RELEASE_MAJOR,RELEASE_MINOR,SMARTMONTOOLS_VERSION);
if (!debugmode){ if (!debugmode){
daemon_init(); daemon_init();
......
Release: 3
Summary: SMARTmontools - for monitoring S.M.A.R.T. disks and devices Summary: SMARTmontools - for monitoring S.M.A.R.T. disks and devices
Name: smartmontools Name: smartmontools
Version: 5.0 Version: 5.0
Release: 1
License: GPL License: GPL
Group: Applications/System Group: Applications/System
Source0: http://prdownloads.sourceforge.net/%{name}-%{version}.tar.gz Source0: http://prdownloads.sourceforge.net/%{name}-%{version}.tar.gz
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment