chiark / gitweb /
bfc2923b345ac456f461a507f29ae0baaed7159b
[elogind.git] / extras / scsi_id / Makefile
1 #
2 # Copyright (C) 2003 IBM
3 #
4 # This program is free software; you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation; version 2 of the License.
7 #
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 # General Public License for more details.
12 #
13 # You should have received a copy of the GNU General Public License
14 # along with this program; if not, write to the Free Software
15 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16
17 SCSI_ID_VERSION=0.4
18
19 prefix =
20 etcdir =        ${prefix}/etc
21 sbindir =       ${prefix}/sbin
22 mandir =        ${prefix}/usr/share/man
23
24 INSTALL  = /usr/bin/install -c
25 INSTALL_PROGRAM = ${INSTALL}
26 INSTALL_DATA  = ${INSTALL} -m 644
27
28 # Note some of the variables used here are set when built under udev, and
29 # otherwise might not be set.
30
31 override CFLAGS+=-Wall -fno-builtin
32
33 PROG=scsi_id
34 SYSFS=-lsysfs
35
36 #
37 # Built static and stripped when built with udev.
38 #
39 # STRIP=-s
40 # LDFLAGS=$(STRIP)
41 LD=$(CC)
42
43 OBJS=   scsi_id.o scsi_serial.o
44
45 all:    $(PROG)
46
47 # XXX use a compressed man page?
48
49 install: all
50         $(INSTALL_PROGRAM) -D $(PROG) $(DESTDIR)$(sbindir)/$(PROG)
51         $(INSTALL_DATA) -D scsi_id.8 $(DESTDIR)$(mandir)/man8/scsi_id.8
52         @if [ ! -r $(DESTDIR)$(etcdir)/scsi_id.config ]; then \
53                 echo $(INSTALL_DATA) -D ./scsi_id.config  $(DESTDIR)$(etcdir); \
54                 $(INSTALL_DATA) -D ./scsi_id.config $(DESTDIR)$(etcdir)/scsi_id.config; \
55         fi
56         
57 uninstall:
58         -rm $(DESTDIR)$(sbindir)/$(PROG)
59         -rm $(DESTDIR)$(mandir)/man8/scsi_id.8
60         -rm $(DESTDIR)$(etcdir)/scsi_id.config
61
62 GEN_HEADER=scsi_id_version.h
63
64 scsi_id_version.h:
65         @echo "/* This file is auto-generated by the Makefile */" > $@
66         @echo \#define SCSI_ID_VERSION     \"$(SCSI_ID_VERSION)\" >> $@
67         @echo \#define SCSI_ID_CONFIG_FILE     \"$(etcdir)/scsi_id.config\" >> $@
68 $(OBJS): scsi_id.h scsi.h scsi_id_version.h
69
70 clean:
71         rm -f $(PROG) $(OBJS) $(GEN_HEADER)
72
73 $(PROG):        $(OBJS)
74         $(LD) $(LDFLAGS) -o $(PROG) $(CRT0) $(OBJS) $(SYSFS) $(LIB_OBJS) $(ARCH_LIB_OBJS)