5 kx # Makefile for hdparm
5 kx
5 kx # DESTDIR is for non root installs (eg packages, NFS) only!
5 kx DESTDIR =
5 kx
5 kx binprefix =
5 kx manprefix = /usr
5 kx exec_prefix = $(binprefix)/
5 kx sbindir = $(exec_prefix)sbin
5 kx mandir = $(manprefix)/share/man
5 kx oldmandir = $(manprefix)/man
5 kx
5 kx CC ?= gcc
5 kx STRIP ?= strip
5 kx
5 kx 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)
5 kx
5 kx LDFLAGS := $(LDFLAGS)
5 kx
5 kx INSTALL = install
5 kx INSTALL_DATA = $(INSTALL) -m 644
5 kx INSTALL_DIR = $(INSTALL) -m 755 -d
5 kx INSTALL_PROGRAM = $(INSTALL)
5 kx
5 kx OBJS = hdparm.o identify.o sgio.o sysfs.o geom.o fallocate.o fibmap.o fwdownload.o dvdspeed.o wdidle3.o apt.o
5 kx
5 kx all:
5 kx $(MAKE) -j4 hdparm
5 kx
5 kx static:
5 kx LDFLAGS=-static $(MAKE)
5 kx
5 kx hdparm: Makefile hdparm.h sgio.h $(OBJS)
5 kx $(CC) $(LDFLAGS) -o hdparm $(OBJS)
5 kx
5 kx hdparm.o: hdparm.h sgio.h
5 kx
5 kx identify.o: hdparm.h
5 kx
5 kx dvdspeed.o: dvdspeed.c
5 kx
5 kx sgio.o: sgio.c sgio.h hdparm.h
5 kx
5 kx fwdownload.o: fwdownload.c sgio.h hdparm.h
5 kx
5 kx apt.o: apt.c
5 kx
5 kx install: all hdparm.8
5 kx if [ ! -z $(DESTDIR) ]; then $(INSTALL_DIR) $(DESTDIR) ; fi
5 kx if [ ! -z $(DESTDIR)$(sbindir) ]; then $(INSTALL_DIR) $(DESTDIR)$(sbindir) ; fi
5 kx if [ ! -z $(DESTDIR)$(mandir) ]; then $(INSTALL_DIR) $(DESTDIR)$(mandir) ; fi
5 kx if [ ! -z $(DESTDIR)$(mandir)/man8/ ]; then $(INSTALL_DIR) $(DESTDIR)$(mandir)/man8/ ; fi
5 kx if [ -f $(DESTDIR)$(sbindir)/hdparm ]; then rm -f $(DESTDIR)$(sbindir)/hdparm ; fi
5 kx if [ -f $(DESTDIR)$(mandir)/man8/hdparm.8 ]; then rm -f $(DESTDIR)$(mandir)/man8/hdparm.8 ;\
5 kx elif [ -f $(DESTDIR)$(oldmandir)/man8/hdparm.8 ]; then rm -f $(DESTDIR)$(oldmandir)/man8/hdparm.8 ; fi
5 kx $(INSTALL_PROGRAM) -D hdparm $(DESTDIR)$(sbindir)/hdparm
5 kx if [ -d $(DESTDIR)$(mandir) ]; then $(INSTALL_DATA) -D hdparm.8 $(DESTDIR)$(mandir)/man8/hdparm.8 ;\
5 kx elif [ -d $(DESTDIR)$(oldmandir) ]; then $(INSTALL_DATA) -D hdparm.8 $(DESTDIR)$(oldmandir)/man8/hdparm.8 ; fi
5 kx
5 kx clean:
5 kx -rm -f hdparm $(OBJS) core 2>/dev/null
5 kx