#
# $Id: Imakefile,v 1.6 93/12/11 14:46:27 warlord Exp $
#

/*
 * Redefine the main foreach_subdirs() macro so that the utilities path
 * is set.
 */
#undef foreach_subdirs
#define foreach_subdirs(name,subdirs)                                   @@\
name:: FRC								@@\
	@for d in subdirs; \						@@\
	do \								@@\
		(cd $$d; echo "### Making" name "in" `pwd`;	\	@@\
			PATH=`pwd`/util/bin:$${PATH} \			@@\
			make $(FLAGS) $(MFLAGS) DESTDIR=$(DESTDIR) name ; \ @@\
			echo "### Done with" `pwd`);		\	@@\
	done


#if defined(vax) || defined(ibm032)
ARCH=bsd-4.3
#endif
#if defined(ultrix) 
ARCH=Ultrix
#endif
#if defined(_AIX)
ARCH=Aix
#endif
#if defined(sun)
ARCH=SunOs
#endif

/* We process util twice so that installs will work properly */
#define ISUBDIRS config include lib ckinit charon ckermit ctelnet clogin

BINDIR=	$(ARCH) athena
LIBDIR=	$(ARCH) athena
BUILDDIRS=$(ARCH) athena


depend::	Makefiles

foreach_subdirs(buildlib, ${LIBDIR})
foreach_subdirs(buildbin, ${BINDIR})
foreach_subdirs(instlib, ${LIBDIR})
foreach_subdirs(instbin, ${BINDIR})
foreach_subdirs(cleanbuild, ${BUILDDIRS})
foreach_subdirs(dependbuild, ${BUILDDIRS})

install::
	-for d in 1 2 3 4 5 6 7 8; do mkdir $(DESTDIR)$(ATHMANDIR)/man$$d; done

install:: install.man

#ifdef _AIX32
install::
	$(RM) $(DESTDIR)/bin
	-ln -s usr/bin $(DESTDIR)/bin
#endif
