all: inetd

include ../MCONFIG
include ../MRULES

OBJS=inetd.o servtab.o builtins.o sig.o setproctitle.o doalloc.o mysleep.o
ifeq ($(HAVE_DAEMON), 1)
CFLAGS+=-DHAVE_DAEMON
else
OBJS+=daemon.o
endif

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

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

include depend.mk
depend:
	$(CC) $(CFLAGS) -MM *.c > depend.mk

install: inetd
	install -d $(INSTALLROOT)$(SBINDIR)
	install -s -m$(DAEMONMODE) inetd $(INSTALLROOT)$(SBINDIR)
	install -d $(INSTALLROOT)$(MANDIR)/man8
	install -m$(MANMODE) inetd.8 $(INSTALLROOT)$(MANDIR)/man8

clean:
	rm -f *.o inetd
