| 1 |
# Makefile for hdparm |
| 2 |
|
| 3 |
# DESTDIR is for non root installs (eg packages, NFS) only! |
| 4 |
DESTDIR = |
| 5 |
|
| •6 |
binprefix = /usr |
| 7 |
manprefix = /usr |
| 8 |
exec_prefix = $(binprefix)/ |
| 9 |
sbindir = $(exec_prefix)sbin |
| 10 |
mandir = $(manprefix)/share/man |
| 11 |
oldmandir = $(manprefix)/man |
| 12 |
|
| 13 |
CC ?= gcc |
| 14 |
STRIP ?= strip |
| 15 |
|
| 16 |
CFLAGS := -O2 -W -Wall -Wbad-function-cast -Wcast-align -Wpointer-arith -Wcast-qual -Wshadow -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -fkeep-inline-functions -Wwrite-strings -Waggregate-return -Wnested-externs -Wtrigraphs $(CFLAGS) |
| 17 |
|
| 18 |
INSTALL = install |
| 19 |
INSTALL_DATA = $(INSTALL) -m 644 |
| 20 |
INSTALL_DIR = $(INSTALL) -m 755 -d |
| 21 |
INSTALL_PROGRAM = $(INSTALL) |
| 22 |
|
| 23 |
OBJS = hdparm.o identify.o sgio.o sysfs.o geom.o fallocate.o fibmap.o fwdownload.o dvdspeed.o wdidle3.o apt.o |
| 24 |
|
| 25 |
all: |
| •26 |
make hdparm |
| 27 |
|
| 28 |
static: |
| 29 |
LDFLAGS=-static $(MAKE) |
| 30 |
|
| 31 |
hdparm: Makefile hdparm.h sgio.h $(OBJS) |
| 32 |
$(CC) $(LDFLAGS) -o hdparm $(OBJS) |
| 33 |
$(STRIP) hdparm |
| 34 |
|
| 35 |
hdparm.o: hdparm.h sgio.h |
| 36 |
|
| 37 |
identify.o: hdparm.h |
| 38 |
|
| •39 |
dvdspeed.o: dvdspeed.c hdparm.h |
| 40 |
|
| 41 |
sgio.o: sgio.c sgio.h hdparm.h |
| 42 |
|
| 43 |
fwdownload.o: fwdownload.c sgio.h hdparm.h |
| 44 |
|
| •45 |
apt.o: apt.c hdparm.h sgio.h |
| 46 |
|
| 47 |
wdidle3.o: hdparm.h sgio.h |
| 48 |
|
| 49 |
sysfs.o: hdparm.h |
| 50 |
|
| 51 |
geom.o: hdparm.h |
| 52 |
|
| 53 |
fallocate.o: hdparm.h |
| 54 |
|
| 55 |
fibmap.o: hdparm.h |
| 56 |
|
| 57 |
install: all hdparm.8 |
| 58 |
if [ ! -z $(DESTDIR) ]; then $(INSTALL_DIR) $(DESTDIR) ; fi |
| 59 |
if [ ! -z $(DESTDIR)$(sbindir) ]; then $(INSTALL_DIR) $(DESTDIR)$(sbindir) ; fi |
| 60 |
if [ ! -z $(DESTDIR)$(mandir) ]; then $(INSTALL_DIR) $(DESTDIR)$(mandir) ; fi |
| 61 |
if [ ! -z $(DESTDIR)$(mandir)/man8/ ]; then $(INSTALL_DIR) $(DESTDIR)$(mandir)/man8/ ; fi |
| 62 |
if [ -f $(DESTDIR)$(sbindir)/hdparm ]; then rm -f $(DESTDIR)$(sbindir)/hdparm ; fi |
| 63 |
if [ -f $(DESTDIR)$(mandir)/man8/hdparm.8 ]; then rm -f $(DESTDIR)$(mandir)/man8/hdparm.8 ;\ |
| 64 |
elif [ -f $(DESTDIR)$(oldmandir)/man8/hdparm.8 ]; then rm -f $(DESTDIR)$(oldmandir)/man8/hdparm.8 ; fi |
| 65 |
$(INSTALL_PROGRAM) -D hdparm $(DESTDIR)$(sbindir)/hdparm |
| 66 |
if [ -d $(DESTDIR)$(mandir) ]; then $(INSTALL_DATA) -D hdparm.8 $(DESTDIR)$(mandir)/man8/hdparm.8 ;\ |
| 67 |
elif [ -d $(DESTDIR)$(oldmandir) ]; then $(INSTALL_DATA) -D hdparm.8 $(DESTDIR)$(oldmandir)/man8/hdparm.8 ; fi |
| 68 |
|
| 69 |
clean: |
| 70 |
-rm -f hdparm $(OBJS) core 2>/dev/null |
| 71 |
|