##
## settings
##
prefix=@prefix@
exec_prefix=@exec_prefix@
sbindir=@sbindir@
bindir=@bindir@
mandir=@mandir@
sysconfdir=@sysconfdir@

##
## autoconf
##
CPP=@CPP@
CXXCPP=@CXXCPP@
CC=@CC@
CXX=@CXX@
DEFS=-D_USAGI -DINET6 @DEFS@
CFLAGS=@CFLAGS@ $(DEFS) -D_PATH_INETDCONF=\"$(_PATH_INETDCONF)\" \
	-D_PATH_INETDPID=\"$(_PATH_INETDPID)\" \
 	-D_PATH_INETD=\"$(_PATH_INETD)\"
CXXFLAGS=@CXXFLAGS@ $(DEFS)

OBJS=inetd.o servtab.o builtins.o sig.o setproctitle.o doalloc.o mysleep.o
LIBOBJS=@LIBOBJS@
LDFLASG=@LDFLAGS@
LIBS=@LIBS@

_PATH_INETDCONF=@_PATH_INETDCONF@
_PATH_INETDPID=@_PATH_INETDPID@
_PATH_INETD=$(sbindir)/inetd

INSTALL=@INSTALL@
INSTALL_PROG=@INSTALL_PROGRAM@
INSTALL_DATA=@INSTALL_DATA@
INSTALL_DIR=@INSTALL_DIR@

##
## targets
##
TARGET = inetd

all:	$(TARGET)

clean:
	-rm -f *.o $(TARGET)
distclean: clean
	-rm -f config.*
	-rm -f Makefile

install: inetd
	$(INSTALL_DIR) $(sbindir)
	$(INSTALL_PROG) -s inetd $(sbindir)
	$(INSTALL_DIR) $(mandir)/man8
	$(INSTALL_DATA) inetd.8 $(mandir)/man8
	$(INSTALL_DIR) $(sysconfdir)
	$(INSTALL_DATA) etc/inetd.conf.sample $(sysconfdir)

##
## dependencies
##
inetd: $(OBJS)
	$(CC) $(LDFLAGS) $^ $(LIBS) -o $@

$(OBJS): builtins.h inetd.h mysleep.h pathnames.h servtab.h \
         setproctitle.h sig.h
