thisconfigdir=./..
myfulldir=util
mydir=util
MY_SUBDIRS=et ss profile pty dyn db2 send-pr
BUILDTOP=$(REL)$(U)

MAC_SUBDIRS = profile et

editsh = sed -e 's,@''ARADD''@,$(ARADD),g' -e 's,@''ARCHIVE''@,$(ARCHIVE),g'
HOST_TYPE=@HOST_TYPE@
HAVE_GCC=@HAVE_GCC@
SLIBSH=sed -e 's,@''CC''@,$(CC),g' -e 's,@''HOST_TYPE''@,$(HOST_TYPE),g' -e 's,@''HAVE_GCC''@,$(HAVE_GCC),g'

all-recurse: libupdate makeshlib
all-mac::

NO_OUTDIR=1
all-windows::
	@echo Making in util\windows
	cd windows
	$(MAKE) -$(MFLAGS)
	@echo Making in util\et
	cd ..\et
	$(MAKE) -$(MFLAGS) 
	@echo Making in util\profile
	cd ..\profile
	$(MAKE) -$(MFLAGS) 
	cd ..

clean-windows::
	@echo Making clean in util\windows
	cd windows
	$(MAKE) -$(MFLAGS) clean
	@echo Making clean in util\et
	cd ..\et
	$(MAKE) -$(MFLAGS) clean
	@echo Making clean in util\profile
	cd ..\profile
	$(MAKE) -$(MFLAGS) clean
	cd ..

# this is necessary because the db2 build, which is intended to be
# standalone, of course does not know to make symlinks in the right
# magic places in the krb5 build tree so other parts of the tree can
# find db2.  So we make those links here.  this can't use CopyHeader,
# because there's no way in this make setup to do stuff after the
# subdirectory recursion.  fortunately, one does not need a
# destination to make a link...

all-unix::
	$(RM) ../include/db.h ../include/db-config.h ../include/db-ndbm.h \
		../lib/libdb.a
	ln -s ../util/db2/obj/db.h ../include
	ln -s ../util/db2/obj/db-config.h ../include
	ln -s ../util/db2/obj/libdb.a ../lib
	if test '$(srcdir)' = . ; then \
		ln -s ../util/db2/include/db-ndbm.h ../include; \
	else \
		ln -s $(srcdir)/db2/include/db-ndbm.h ../include; \
	fi

clean-unix::
	$(RM) ../include/db.h ../include/db-config.h ../include/db-ndbm.h \
		../lib/libdb.a

unixmac: libupdate

libupdate: $(srcdir)/libupdate.sh
	$(RM) $@ $@.tmp
	$(editsh) $(srcdir)/libupdate.sh > $@.tmp && chmod +x $@.tmp && mv $@.tmp $@

makeshlib: $(srcdir)/makeshlib.sh Makefile
	 $(RM) $@ $@.tmp
	 $(SLIBSH) $(srcdir)/makeshlib.sh >$@.tmp&&chmod a+x $@.tmp&&mv $@.tmp $@


#
# We only need this for AIX, but we generate it for all systems.
#
all-prerecurse:: aix.bincmds

aix.bincmds: Makefile
	 echo libpath $(KRB5_LIBDIR):`pwd`/$(TOPLIBD):/usr/lib:/lib >aix.bincmds
clean::
	$(RM) libupdate makeshlib

install::
	@echo nothing to install in util
