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
|
# If running RedHat uncomment below, other linuxes seem to use /etc for
# status files, but RedHat uses /var/run...
CC = @CC@
CFLAGS = @CFLAGS@
all : bpowerd @failscript@
bpowerd : bpowerd.c
$(CC) $(CFLAGS) -o bpowerd bpowerd.c
debug : bpowerd.c
$(CC) -DDEBUG -g -o bpowerdebug bpowerd.c
@failscript@ : bpowerfail.@init@
cp bpowerfail.@init@ @failscript@
install : bpowerd @failscript@ bpowerd.init
install -s -m 755 bpowerd /usr/sbin/bpowerd
install -m 644 bpowerd.man /usr/man/man8/bpowerd.8
install -m 755 @failscript@ @initd@/@failscript@
cp /etc/inittab /etc/inittab.bak
gawk -F ':' '{\
if( $1 == "pf" ) {\
print "pf::powerwait:@initd@/@failscript@ start"} \
else if ( $1 == "pn" ) {\
print "pn::powerfailnow:@initd@/@failscript@ now"} \
else if ( $1 == "po" ) {\
print "po::powerokwait:@init@/@failscript@ stop"} \
else {print $0}}}' /etc/inittab.bak >/etc/inittab
clean :
rm -f bpowerd @failscript@ bpowerdebug *~
realclean : clean
rm -f Makefile config.h *.old *.log bpowerd.man INSTALL \
bpowerfail.sysv bpowerfail.bsd config.cache
.PHONY : all clean realclean
|