Makefile 3.5 KB
Newer Older
ballen4705's avatar
ballen4705 committed
1
2
# Makefile for smartmontools
#
ballen4705's avatar
ballen4705 committed
3
# $Id: Makefile,v 1.12 2002/10/11 12:48:27 ballen4705 Exp $
4
#
ballen4705's avatar
ballen4705 committed
5
# Copyright (C) 2002 Bruce Allen <smartmontools-support@lists.sourceforge.net>
ballen4705's avatar
ballen4705 committed
6
7
8
9
10
11
12
13
14
15
16
# 
# 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, or (at your option) any later
# version.
# 
# You should have received a copy of the GNU General Public License (for
# example COPYING); if not, write to the Free Software Foundation, Inc., 675
# Mass Ave, Cambridge, MA 02139, USA.

CC	= gcc
17
18
# CFLAGS = -fsigned-char -Wall -g 
CFLAGS	= -fsigned-char -Wall -O2
ballen4705's avatar
ballen4705 committed
19

20
21
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\
22
  smartd.8 smartd.c smartd.h smartd.initd TODO VERSION
23
24
25
26
27
28

counter=$(shell cat VERSION)
newcounter=$(shell ./add )
pkgname=smartmontools-5.0
pkgname2=$(pkgname)-$(counter)

ballen4705's avatar
ballen4705 committed
29
30
all: smartd smartctl

ballen4705's avatar
ballen4705 committed
31
32
smartctl: atacmds.o scsicmds.o smartctl.c smartctl.h ataprint.o scsiprint.o atacmds.h ataprint.h scsicmds.h scsiprint.h VERSION
	${CC} -DSMARTMONTOOLS_VERSION=$(counter) -o smartctl ${CFLAGS} atacmds.o scsicmds.o ataprint.o smartctl.c scsiprint.o
ballen4705's avatar
ballen4705 committed
33

ballen4705's avatar
ballen4705 committed
34
35
smartd:  atacmds.o scsicmds.o smartd.c smartd.h atacmds.h scsicmds.h VERSION
	${CC} -DSMARTMONTOOLS_VERSION=$(counter) -o smartd ${CFLAGS} scsicmds.o atacmds.o smartd.c
ballen4705's avatar
ballen4705 committed
36
37
38
39
40
41
42
43
44
45
46
47
48
49

ataprint.o: atacmds.o ataprint.h ataprint.c smartctl.h extern.h
	${CC} ${CFLAGS} -c ataprint.c

scsiprint.o: scsiprint.h scsiprint.c scsicmds.o smartctl.h extern.h scsicmds.h
	${CC} ${CFLAGS} -c scsiprint.c 

atacmds.o: atacmds.h atacmds.c
	${CC} ${CFLAGS} -c atacmds.c 

scsicmds.o: scsicmds.h scsicmds.c 
	${CC} ${CFLAGS} -c scsicmds.c

clean:
50
	rm -f *.o smartctl smartd *~ \#*\# smartmontools*.tar.gz smartmontools*.rpm temp.*
ballen4705's avatar
ballen4705 committed
51
52

install: smartctl smartd smartctl.8 smartd.8 smartd.initd
53
54
55
56
57
58
59
	install -m 755 -o root -g root -D smartctl $(DESTDIR)/usr/sbin/smartctl
	install -m 755 -o root -g root -D smartd $(DESTDIR)/usr/sbin/smartd
	install -m 644 -o root -g root -D smartctl.8 $(DESTDIR)/usr/share/man/man8/smartctl.8
	install -m 644 -o root -g root -D smartd.8 $(DESTDIR)/usr/share/man/man8/smartd.8
	install -m 755 -o root -g root -D smartd.initd $(DESTDIR)/etc/rc.d/init.d/smartd
	echo "To manually start smartd on bootup, run etc/rc.d/init.d/smartd start"
	echo "To Automatically start smartd on bootup, run /sbin/chkconfig --add smartd"
ballen4705's avatar
ballen4705 committed
60
61

uninstall:
62
63
	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
ballen4705's avatar
ballen4705 committed
64
	/sbin/chkconfig --del smartd
65
	/etc/rc.d/init.d/smartd stop
ballen4705's avatar
ballen4705 committed
66
	rm -f /etc/rc.d/init.d/smartd
67

68
69
# All this mess is to automatically increment the release numbers.
# The number of the next release is kept in the file "VERSION"
70
release: $(releasefiles)
71
72
73
74
75
76
77
78
79
80
81
82
	rm -rf $(pkgname)
	mkdir $(pkgname)
	cp -a $(releasefiles) $(pkgname)
	tar zcvf $(pkgname).tar.gz $(pkgname)
	mv -f $(pkgname) $(pkgname2)
	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
83
84
85
86
	rpm -ba smartmontools.spec
	mv /usr/src/redhat/RPMS/i386/$(pkgname)*.rpm .
	mv /usr/src/redhat/SRPMS/$(pkgname)*rpm .
	rm -f /usr/src/redhat/SOURCES/$(pkgname).tar.gz
87
88
	echo $(newcounter) > VERSION

89