# %%% copyright-cmetz-96
# This software is Copyright 1996-1997 by Craig Metz, All Rights Reserved.
# The Inner Net License Version 2 applies to this software.
# You should have received a copy of the license with this software. If
# you didn't get a copy, you may request one from <license@inner.net>.
#

DOTS=./
include GNUmakefile.inc

SUBDIRS=support etc finger fingerd ftp ftpd include inetd man misc ping tftp

all clean:
	@for i in $(SUBDIRS); do if [ -d $$i ]; then ( cd $$i; $(MAKE) $@); fi; done

makeinstdirs:
	@-mkdir -p $(DESTDIR)
	@-mkdir -p $(DESTDIR)$(LIBEXECDIR)
	@-mkdir -p $(DESTDIR)$(USR_BINDIR)
	@-mkdir -p $(DESTDIR)$(USR_SBINDIR)
	@-mkdir -p $(DESTDIR)$(SBINDIR)
	@-mkdir -p $(DESTDIR)$(SCRIPTDIR)
	@-mkdir -p $(DESTDIR)$(INCDIR)
	@-mkdir -p $(DESTDIR)$(LIBDIR)
	@-mkdir -p $(DESTDIR)$(MANDIR)
	@-mkdir -p $(DESTDIR)$(MANDIR)/man1
	@-mkdir -p $(DESTDIR)$(MANDIR)/man3
	@-mkdir -p $(DESTDIR)$(MANDIR)/man4
	@-mkdir -p $(DESTDIR)$(MANDIR)/man5
	@-mkdir -p $(DESTDIR)$(MANDIR)/man8

install: makeinstdirs
	@echo "GNUmakefile.config -> $(DESTDIR)$(LIBDIR)/GNUmakefile.config"
	@install -c -m 644 GNUmakefile.config $(DESTDIR)$(LIBDIR)
	@echo "GNUmakefile.prog.tmpl -> $(DESTDIR)$(LIBDIR)/GNUmakefile.prog.tmpl"
	@install -c -m 644 GNUmakefile.prog.tmpl $(DESTDIR)$(LIBDIR)
	@echo "GNUmakefile.inc -> $(DESTDIR)$(LIBDIR)/GNUmakefile.inc"
	@cat GNUmakefile.inc | sed 's:^INSTALLED=0$$:INSTALLED=1:' | sed 's:@CONFIG_DIR@:$(DESTDIR)$(LIBDIR)/:g' > $(DESTDIR)$(LIBDIR)/GNUmakefile.inc
	@chmod 644 $(DESTDIR)$(LIBDIR)/GNUmakefile.inc
	@for i in $(SUBDIRS); do if [ -d $$i ]; then ( cd $$i; $(MAKE) $@); fi; done
