# ------------------ USER CONFIGURABLE SETTINGS ---------------------------
# The directories where files will be installed, you may want to change these.
BINDIR=/usr/sbin
MANDIR=/usr/man
ETCDIR=/etc

# Compiler flags.
CC = gcc
CFLAGS = -O -Wall -fomit-frame-pointer -pipe -Dlint

# If you are using gcc 2.5.8 this will get you QMAGIC executables
# later versions of gcc do this by default.
#LDFLAGS = -Xlinker -qmagic
LDFLAGS = 
# ------------------ END OF USER CONFIGURATIONS ---------------------------

OBJFILES=apcd.o parse.o upsnet.o
SOURCEFILES=apcd.c parse.c upsnet.c
HFILES=apcd.h version.h 
DOCFILES=README
DISTFILES=Makefile $(SOURCEFILES) $(HFILES) $(DOCFILES)

all:	apcd

apcd.o: 	apcd.c apcd.h
parse.o: 	parse.c apcd.h
upsnet.o:	upsnet.c apcd.h

apcd: $(OBJFILES)
	$(CC) $(CFLAGS) $(LDFLAGS) $(OBJFILES) -o apcd

install: apcd
	install -o root -g bin apcd ${BINDIR}/apcd
	install -o root -g bin doc/apcd.man ${MANDIR}/man8/apcd.8
	install -o root -g bin apcd.conf ${ETCDIR}/apcd.conf
	chmod 4744 ${BINDIR}/apcd
clean:
	rm -f *.o apcd

dep:
	$(CPP) -M *.c > .depend

#
# include a dependency file if one exists
#
ifeq (.depend,$(wildcard .depend))
include .depend
endif
