### Makefile for kerberos tree -- maximal passed arguments
srcdir = .

prefix = /usr/kerberos

exec_prefix = $(prefix)
bindir = $(exec_prefix)/bin
libdir = $(exec_prefix)/lib
tooldir = $(libdir)

program_transform_name =

##

SHELL = /bin/sh


SUBDIRS = "this is set via configure, don't edit this"
OTHERS = 

ALL = all
INSTALL_TARGET = install

#### host and target specific makefile fragments come in here.
###


# The first rule in the file had better be this one.  Don't put any above it.
all:
	for i in $(SUBDIRS); do \
	(cd $$i && $(MAKE) $(MFLAGS) "CC=$(CC)" RESOLV=$(RESOLV) all) ;\
	if [ $$? != 0 ]; then exit 1; else true; fi ; \
	done

# These rules are sufficient to build this from a working tree, but don't have
# enough dependencies, so don't use for development!
crlogin: appl/bsd/crlogin
	 -rm crlogin
	 ln appl/bsd/crlogin .

install-crlogin:
	-mkdir ${DESTDIR}
	-mkdir ${DESTDIR}${PROGDIR}
	$(INSTALLPROG) appl/bsd/crlogin ${DESTDIR}$(PROGDIR)/crlogin

appl/bsd/crlogin: include/krb.h lib/kstream/libkstream.a lib/krb/libkrb.a lib/des/libdes.a
	(cd appl/bsd; $(MAKE) $(MFLAGS) "CC=$(CC)" RESOLV=$(RESOLV) crlogin)

include/krb.h:
	(cd include; $(MAKE) $(MFLAGS) "CC=$(CC)" RESOLV=$(RESOLV) all)

lib/kstream/libkstream.a:
	(cd lib/kstream; $(MAKE) $(MFLAGS) "CC=$(CC)" RESOLV=$(RESOLV) all)

lib/krb/libkrb.a:
	(cd lib/krb; $(MAKE) $(MFLAGS) "CC=$(CC)" RESOLV=$(RESOLV) all)

lib/des/libdes.a:
	(cd lib/des; $(MAKE) $(MFLAGS) "CC=$(CC)" RESOLV=$(RESOLV) all)

roll:
	for i in $(SUBDIRS); do \
	(cd $$i; $(MAKE) $(MFLAGS) "CC=$(CC)" RESOLV=$(RESOLV) all);\
	(cd $$i; $(RM) *.o);\
	done

depend:
	for i in $(SUBDIRS); do \
	(cd $$i; $(MAKE) $(MFLAGS) "CC=$(CC)" depend)\
	done

install:
	-mkdir ${DESTDIR}
	-mkdir ${DESTDIR}${BASEDIR}
	-mkdir ${DESTDIR}${USRDIR}
	-mkdir ${DESTDIR}${INCLDIR}
	-mkdir ${DESTDIR}${SVRDIR}
	-mkdir ${DESTDIR}${MANDIR}
	-mkdir ${DESTDIR}${MANDIR}/man1
	-mkdir ${DESTDIR}${MANDIR}/man3
	-mkdir ${DESTDIR}${MANDIR}/man5
	-mkdir ${DESTDIR}${MANDIR}/man8
	-mkdir ${DESTDIR}${DAEMDIR}
	-mkdir ${DESTDIR}${PROGDIR}
	-mkdir ${DESTDIR}${USRLIB}
	-mkdir ${DESTDIR}${LIBDIR}
	-mkdir ${DESTDIR}${LINTLIBDIR}
	-mkdir ${DESTDIR}${KDBDIR}
	-mkdir ${DESTDIR}${INSTDIR}
	for i in $(SUBDIRS); do \
	(cd $$i; $(MAKE) $(MFLAGS) "CC=$(CC)" DESTDIR=$(DESTDIR) install)\
	done

clean:
	for i in $(SUBDIRS); do \
	(cd $$i; $(MAKE) $(MFLAGS) clean)\
	done


.PHONY: all check dvi info install-info install-info-dirs
.PHONY: do-info do-check do-dvi do-install-info
.PHONY: do-clean do-mostlyclean do-distclean do-realclean
.NOEXPORT:

# Do a target for all the subdirectories.  A ``make do-X'' will do a
# ``make X'' in all subdirectories (because, in general, X depends on
# fdo-X, a ``make X'' will also do this, but it may do additional work
# as well).
# This target ensures that $(BASE_FLAGS_TO_PASS) appears only once,
# because it is so large that it can easily overflow the command line
# length limit on some systems.
do-info do-check do-dvi do-install-info do-clean do-mostlyclean do-distclean do-realclean:
	@target=`echo $@ | sed -e 's/^do-//'`; \
	rootme=`pwd`; export rootme; \
	srcroot=`cd $(srcdir); pwd`; export srcroot; \
	for i in $(SUBDIRS); do \
	  if [ -f ./$$i/localenv ] || [ -f ./$$i/Makefile ]; then \
	    case $$i in \
	    $(TARGET_LIBS) ) \
	      for flag in $(EXTRA_TARGET_FLAGS); do \
		eval `echo "$$flag" | sed -e "s|^\(.*\)=\(.*\)|\1='\2'|"`; \
	      done; \
	      ;; \
	    gcc) \
	      for flag in $(EXTRA_GCC_FLAGS); do \
		eval `echo "$$flag" | sed -e "s|^\(.*\)=\(.*\)|\1='\2'|"`; \
	      done; \
	      ;; \
	    *) \
	      for flag in $(EXTRA_HOST_FLAGS); do \
		eval `echo "$$flag" | sed -e "s|^\(.*\)=\(.*\)|\1='\2'|"`; \
	      done; \
	      ;; \
	    esac ; \
	    export AR AS CC CXX NM RANLIB XTRAFLAGS; \
	    if (cd ./$$i; \
	        $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
			"CC=$${CC}" "CXX=$${CXX}" "NM=$${NM}" \
			"RANLIB=$${RANLIB}" "XTRAFLAGS=$${XTRAFLAGS}" \
			$${target}); \
	    then true; else exit 1; fi; \
	  else true; fi; \
	done

info: do-info
check: do-check
dvi: do-dvi

install-info: install-info-dirs do-install-info dir.info
	$(INSTALL_DATA) dir.info $(infodir)/dir.info

do-install-info: install-info-dirs

all.normal: \
	all-hello


.PHONY: clean distclean mostlyclean realclean local-clean local-distclean

local-clean:
	-rm -f *.a TEMP errs core *.o *~ \#* TAGS *.E

local-distclean:
	-rm -f Makefile config.status

mostlyclean: do-mostlyclean local-clean
distclean: do-distclean local-clean local-distclean
realclean: do-realclean local-clean local-distclean

uninstall:
	@echo "the uninstall target is not supported in this tree"


### hello
all-hello: all-libiberty
	@if [ -f ./hello/Makefile ] ; then \
		rootme=`pwd` ; export rootme ; \
		(cd ./hello; $(MAKE) $(FLAGS_TO_PASS) all) ; \
	else \
		true ; \
	fi

install-hello: force
	@if [ -f ./hello/Makefile ] ; then \
		rootme=`pwd` ; export rootme ; \
		(cd ./hello; $(MAKE) $(FLAGS_TO_PASS) install) ; \
	else \
		true ; \
	fi



### other supporting targets

MAKEDIRS= \
	$(prefix) \
	$(exec_prefix) \
	$(tooldir)

#	$(bindir) \
#	$(libdir) \
#	$(includedir) \
#	$(datadir) \
#	$(docdir) \
#	$(mandir) \
#	$(man1dir) \
#	$(man5dir)

#	$(man2dir) \
#	$(man3dir) \
#	$(man4dir) \
#	$(man6dir) \
#	$(man7dir) \
#	$(man8dir)

install-dirs:
	for i in $(MAKEDIRS) ; do \
		echo Making $$i... ; \
		parent=`echo $$i|sed -e 's@/[^/]*$$@@'`; \
		if [ -d $$parent ] ; then true ; else mkdir $$parent ; fi ; \
		if [ ! -d $$i ] ; then \
			if mkdir $$i ; then \
				true ; \
			else \
				exit 1 ; \
			fi ; \
		else \
			true ; \
		fi ; \
	done

install-info-dirs:
	if [ -d $(prefix) ] ; then true ; else mkdir $(prefix) ; fi
	-parent=`echo $(infodir)|sed -e 's@/[^/]*$$@@'`; \
	if [ -d $$parent ] ; then true ; else mkdir $$parent ; fi
	-if [ -d $(infodir) ] ; then true ; else mkdir $(infodir) ; fi

dir.info: do-install-info
	$(srcdir)/texinfo/gen-info-dir $(infodir) $(srcdir)/texinfo/dir.info-template > dir.info.new
	mv -f dir.info.new dir.info

dist:
	@echo "Building a full distribution of this tree isn't done"
	@echo "via 'make dist'.  Check out the etc/ subdirectory" 

etags tags: TAGS

TAGS:
	etags `$(MAKE) ls`

ls:
	@echo Makefile
	@for i in $(SUBDIRS); \
	do \
		(cd $$i; \
			pwd=`pwd`; \
			wd=`basename $$pwd`; \
			for j in `$(MAKE) ls`; \
			do \
				echo $$wd/$$j; \
			done) \
	done

force:

# with the gnu make, this is done automatically.

Makefile: $(srcdir)/Makefile.in $(host_makefile_frag) $(target_makefile_frag) $(common_makefile_frag)
	$(SHELL) ./config.status

# end of Makefile.in
# NOPOSTFIX
