thisconfigdir=./..
myfulldir=include/krb5
mydir=krb5
MY_SUBDIRS=.
BUILDTOP=$(REL)..$(S)..
KRB5RCTMPDIR= @KRB5_RCTMPDIR@

##DOSBUILDTOP = ..\..
NO_OUTPRE=1

KRB5_HEADERS = adm.h adm_proto.h kdb.h kdb_dbm.h winsock.h

# these are installed here for the build from lib/krb5/error_tables but 
# also need to be in the installed tree
ET_HEADERS = adm_err.h asn1_err.h kdb5_err.h krb5_err.h
BUILT_HEADERS = osconf.h

all-unix:: autoconf.h $(BUILT_HEADERS)
all-mac:: $(BUILT_HEADERS)
all-windows:: autoconf.h $(BUILT_HEADERS)

##DOS##autoconf.h: ..\win-mac.h
##DOS##	$(CP) ..\win-mac.h $@
##DOS##osconf.h: stock\osconf.h
##DOS##	$(CP) stock\osconf.h $@

# We need to comment out the Unix autoconf.h and osconf.h block below
# if we're building for Windows.  Thus, we need to enclose them
# between the lines "##DOS##!if 0" and "##DOS##!endif".  We enclosed
# the entire section between the long hashed lines to make the block
# stand out.

###############################################################################
##DOS##!if 0
# Should only rebuild autoconf.h here (use CONFIG_FILES=), but the weird krb5
# makefile post-processing is unconditional and would trash the makefile.
autoconf.h: autoconf.stamp
autoconf.stamp: $(srcdir)/autoconf.h.in $(thisconfigdir)/config.status
	(cd $(thisconfigdir) && $(SHELL) config.status)
	touch autoconf.stamp

SYSCONFDIR = @sysconfdir@
LOCALSTATEDIR = @localstatedir@
BINDIR = @bindir@
SBINDIR = @sbindir@
PROCESS_REPLACE = -e "s+@KRB5RCTMPDIR+$(KRB5RCTMPDIR)+" \
		  -e "s+@PREFIX+$(INSTALL_PREFIX)+" \
		  -e "s+@EXEC_PREFIX+$(INSTALL_EXEC_PREFIX)+" \
		  -e "s+@BINDIR+$(BINDIR)+" \
		  -e "s+@SBINDIR+$(SBINDIR)+" \
	-e 's+@LOCALSTATEDIR+$(LOCALSTATEDIR)+' \
	-e 's+@SYSCONFDIR+$(SYSCONFDIR)+' 

OSCONFSRC = $(srcdir)/stock/osconf.h

osconf.h: $(OSCONFSRC)
	cat $(OSCONFSRC) | sed $(PROCESS_REPLACE) > osconf.new
	@if cmp -s osconf.new osconf.h ; then :; \
	else (set -x; $(RM) osconf.h ; $(CP) osconf.new osconf.h; $(RM) osconf.new) fi
##DOS##!endif
###############################################################################

depend::

install::

clean::
	$(RM) osconf.new $(BUILT_HEADERS)

clean-unix::
	$(RM) $(ET_HEADERS) autoconf.h autoconf.stamp
clean-mac::
	$(RM) osconf.h autoconf.h autoconf.stamp
clean-windows::
	$(RM) osconf.h autoconf.h autoconf.stamp
