summaryrefslogtreecommitdiff
path: root/extras/scsi_id/Makefile
blob: 24c1b3212824467d8937e716a37da4d4e5b78462 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
#
# Copyright (C) 2003 IBM
#
# 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; version 2 of the License.
#
# 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA

SCSI_ID_VERSION=0.9

prefix =
etcdir =        ${prefix}/etc
sbindir =	${prefix}/sbin
mandir =	${prefix}/usr/share/man

INSTALL  = /usr/bin/install -c
INSTALL_PROGRAM = ${INSTALL}
INSTALL_DATA  = ${INSTALL} -m 644

# Note some of the variables used here are set when built under udev, and
# otherwise might not be set.

CFLAGS+=-Wall -fno-builtin

PROG=scsi_id
SYSFS=-lsysfs

#
# Built static and stripped when built with udev.
#
# STRIP=-s
# LDFLAGS=$(STRIP)
LD=$(CC)

OBJS=	scsi_id.o scsi_serial.o

all:	$(PROG)

# XXX use a compressed man page?

install: all
	$(INSTALL_PROGRAM) -D $(PROG) $(DESTDIR)$(sbindir)/$(PROG)
	$(INSTALL_DATA) -D scsi_id.8 $(DESTDIR)$(mandir)/man8/scsi_id.8
	@if [ ! -r $(DESTDIR)$(etcdir)/scsi_id.config ]; then \
		echo $(INSTALL_DATA) -D ./scsi_id.config  $(DESTDIR)$(etcdir); \
		$(INSTALL_DATA) -D ./scsi_id.config $(DESTDIR)$(etcdir)/scsi_id.config; \
	fi
	
uninstall:
	-rm $(DESTDIR)$(sbindir)/$(PROG)
	-rm $(DESTDIR)$(mandir)/man8/scsi_id.8
	-rm $(DESTDIR)$(etcdir)/scsi_id.config

GEN_HEADER=scsi_id_version.h

scsi_id_version.h:
	@echo "/* This file is auto-generated by the Makefile */" > $@
	@echo \#define SCSI_ID_VERSION     \"$(SCSI_ID_VERSION)\" >> $@
	@echo \#define SCSI_ID_CONFIG_FILE     \"$(etcdir)/scsi_id.config\" >> $@
$(OBJS): scsi_id.h scsi.h scsi_id_version.h

clean:
	rm -f $(PROG) $(OBJS) $(GEN_HEADER)

spotless: clean

.c.o:
	$(QUIET) $(CC) $(CFLAGS) -c -o $@ $<

$(PROG):	$(OBJS)
	$(QUIET) $(LD) $(LDFLAGS) -o $(PROG) $(CRT0) $(OBJS) $(SYSFS) $(LIB_OBJS) $(ARCH_LIB_OBJS)