#
# Installation vars
#
afsbackupdir=@afsbackupdir@
afsbosconfigdir=@afsbosconfigdir@
afsconfdir=@afsconfdir@
afsdbdir=@afsdbdir@
afslocaldir=@afslocaldir@
afslogsdir=@afslogsdir@
afssrvbindir=@afssrvbindir@
afskerneldir=@afskerneldir@
afssrvlibexecdir=@afssrvlibexecdir@
afssrvsbindir=@afssrvsbindir@
afsdatadir=@afsdatadir@
bindir=@bindir@
exec_prefix=@exec_prefix@
datarootdir=@datarootdir@
datadir=@datadir@
includedir=@includedir@
libdir=@libdir@
libexecdir=@libexecdir@
localstatedir=@localstatedir@
mandir=@mandir@
prefix=@prefix@
sbindir=@sbindir@
sysconfdir=@sysconfdir@
viceetcdir=@viceetcdir@/


#
# Programs and other defines
#
AR = @AR@
AS = @AS@
ASFLAGS = @ASFLAGS@
AFSD_LIBS = @AFSD_LIBS@
AFSD_LDFLAGS = @AFSD_LDFLAGS@
CC = @CC@
CPP = @CPP@
CPPFLAGS_roken = @CPPFLAGS_roken@
CCOBJ = @CCOBJ@
CCXPG2 = @CCXPG2@
CFLAGS = @CFLAGS@
CP = @CP@
DARWIN_INFOFILE=@DARWIN_INFOFILE@
DBG = @DBG@
DEST = @DEST@
DIR_roken = @DIR_roken@
FSINCLUDES = @FSINCLUDES@
INCLUDE_LIBINTL = @INCLUDE_libintl@
KERN_DBG = @KERN_DBG@
KERN_OPTMZ = @KERN_OPTMZ@
LD = @LD@
LDFLAGS_roken = @LDFLAGS_roken@
LDFLAGS_hcrypto = @LDFLAGS_hcrypto@
LEX = @LEX@
LIB_AFSDB = @LIB_AFSDB@
LIB_crypt = @LIB_crypt@
LIB_curses = @LIB_curses@
LIB_hcrypto = @LIB_hcrypto@
LIB_roken = @LIB_roken@
LIBS = @LIBS@
LIB_LIBINTL = @LIB_libintl@
LINUX_KERNEL_PATH = @LINUX_KERNEL_PATH@
LINUX_KERNEL_BUILD = @LINUX_KERNEL_BUILD@
LINUX_LIBAFS_NAME = @LINUX_LIBAFS_NAME@
LINUX_KERNEL_PACKAGING = @LINUX_KERNEL_PACKAGING@
LINUX_VERSION = @LINUX_VERSION@
LINUX_VERS = @LINUX_VERSION@
LWP_OPTMZ = @LWP_OPTMZ@
LWP_DBG = @LWP_DBG@
MKAFS_OSTYPE = @MKAFS_OSTYPE@
AFS_PARAM_COMMON = @AFS_PARAM_COMMON@
MT_CC = @MT_CC@
MT_CFLAGS = @MT_CFLAGS@
MT_LIBS = @MT_LIBS@
MV = @MV@
NO_STRIP_BIN = @NO_STRIP_BIN@
OPTMZ = @OPTMZ@
PAM_CFLAGS = @PAM_CFLAGS@
PAM_LIBS = @PAM_LIBS@
PAM_OPTMZ = @PAM_OPTMZ@
PAM_DBG = @PAM_DBG@
PATH_CPP = @PATH_CPP@
RANLIB = @RANLIB@
REGEX_OBJ = @REGEX_OBJ@
REGEX_OBJ_PIC = @REGEX_OBJ_PIC@
RM = @RM@
RXDEBUG = @RXDEBUG@
ROKEN_HEADERS = @ROKEN_HEADERS@
ROKEN_LIBOBJS = @LIBOBJS@
SHLIB_CFLAGS = @SHLIB_CFLAGS@
SHLIB_LDFLAGS = @SHLIB_LDFLAGS@
SHLIB_LINKER = @SHLIB_LINKER@
SHLIB_SUFFIX = @SHLIB_SUFFIX@
SYS_NAME = @AFS_SYSNAME@
TOP_INCDIR = @TOP_INCDIR@
TOP_LIBDIR = @TOP_LIBDIR@
TOP_JLIBDIR= @TOP_JLIBDIR@
TOP_OBJDIR = @TOP_OBJDIR@
TOP_SRCDIR = @TOP_SRCDIR@
VPATH = ${srcdir}
XCFLAGS64 = @XCFLAGS64@
XCFLAGS = @XCFLAGS@
XLDFLAGS64 = @XLDFLAGS64@
XLDFLAGS = @XLDFLAGS@
XLIBELFA = @XLIBELFA@
XLIBKVM = @XLIBKVM@
XLIBS = @XLIBS@
YACC = @YACC@

#
# Install targets
#

INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@

#
# Special build targets
#
dest_XFS_SIZE_CHECK = @dest_XFS_SIZE_CHECK@
install_XFS_SIZE_CHECK = @install_XFS_SIZE_CHECK@
XFS_SIZE_CHECK = @XFS_SIZE_CHECK@
AIX32 = @AIX32@
AIX64 = @AIX64@

#
# Paths to build dirs
#
# Could be absolute, but leaving as relative for now
#UKERNELDIR = ${TOP_OBJDIR}/src/libuafs
#KERNELDIR = ${TOP_OBJDIR}/src/libafs
UKERNELDIR = ../libuafs
KERNELDIR = ../libafs

#
# Build helper apps
#
COMPILE_ET = ${TOP_OBJDIR}/src/comerr/compile_et
RXGEN = ${TOP_OBJDIR}/src/rxgen/rxgen
SHELL = /bin/sh

#
# "Pretty" build line stuff
#

# Default to disabling the "pretty" build lines
# If the user specifies 'V=0', the variables below expand to their _V0
# variants, which enable the "pretty" build lines
V=1

RUNCMD=RUNCMD () { \
	echo "  $$1  $$2"; \
	shift; shift; \
	"$$@" || failcode=$$?; \
	if [ x"$$failcode" != x ] ; then \
		echo >&2; \
		echo "FAILED COMMAND: $$@" >&2; \
		echo >&2; \
		echo "In dir:" >&2; \
		pwd >&2; \
		echo >&2; \
		exit $$failcode; \
	fi; \
	exit 0; \
} ; RUNCMD

RUN_CC_NOQ_V0=${RUNCMD} CC "`pwd`/$@"
RUN_LD_NOQ_V0=${RUNCMD} LD "`pwd`/$@"

# Prefixing a command with $(Q) will suppress that line from being printed
# during a "pretty" make, so the RUNCMD function above can decide itself how
# much to print. The Q is just for "quiet", and Q kinda looks like @.
#
# The _NOQ variants of the RUN_ commands are for when a compiler invocation is
# in the middle of e.g. a switch/case or an if/else, etc. In those cases, we
# want to prefix the _entire_ command with $(Q), not just the compiler, linker,
# etc.
Q_V0=@
Q=$(Q_V$(V))

RUN_CC=$(Q)$(RUN_CC_NOQ_V$(V))
RUN_LD=$(Q)$(RUN_LD_NOQ_V$(V))

RUN_CC_NOQ=$(RUN_CC_NOQ_V$(V))
RUN_LD_NOQ=$(RUN_LD_NOQ_V$(V))

#
# Common/standard cflags/paths/etc
# Cflags defaults, will be overridden later if necessary
#
# -I. and -I${srcdir} are only needed for objdir builds - we should
# conditionalise them on that.

COMMON_INCL=$(MODULE_INCLUDE) -I${TOP_OBJDIR}/src/config -I${TOP_INCDIR} \
	    -I${srcdir} -I. 

COMMON_CFLAGS=$(CFLAGS) ${DBG} ${OPTMZ} $(XCFLAGS) \
	      ${COMMON_INCL} ${INCLUDE_LIBINTL} \
	      $(CPPFLAGS_roken) $(ARCHFLAGS)

COMMON_LDFLAGS=$(LDFLAGS) $(LDFLAGS_hcrypto) $(LDFLAGS_roken) $(DBG) $(OPTMZ)

# LWP Flags
LWP_CFLAGS=$(COMMON_CFLAGS) $(MODULE_CFLAGS)
LWP_LDFLAGS=$(COMMON_LDFLAGS) $(MODULE_LDFLAGS) $(XLDFLAGS) $(ARCHFLAGS)
LWP_CCRULE        =$(RUN_CC) $(CCOBJ) $(LWP_CFLAGS) $(CFLAGS_$(@)) -o $@ -c
LWP_CCRULE_NOQ=$(RUN_CC_NOQ) $(CCOBJ) $(LWP_CFLAGS) $(CFLAGS_$(@)) -o $@ -c

# Pthreaded
PTH_CFLAGS=$(COMMON_CFLAGS) $(MODULE_CFLAGS) $(MT_CFLAGS)
PTH_LDFLAGS=$(COMMON_LDFLAGS) $(MODULE_LDFLAGS) $(MT_LDFLAGS)
PTH_CCRULE        =$(RUN_CC) $(MT_CC) $(PTH_CFLAGS) $(CFLAGS_$(@)) -o $@ -c
PTH_CCRULE_NOQ=$(RUN_CC_NOQ) $(MT_CC) $(PTH_CFLAGS) $(CFLAGS_$(@)) -o $@ -c

# Shared
SHD_CFLAGS=$(COMMON_CFLAGS) $(MODULE_CFLAGS) $(MT_CFLAGS) $(SHLIB_CFLAGS)
SHD_LDFLAGS=$(COMMON_LDFLAGS) $(MODULE_LDFLAGS) $(SHLIB_LDFLAGS)
SHD_CCRULE        =$(RUN_CC) $(MT_CC) $(SHD_CFLAGS) $(CFLAGS_$(@)) -o $@ -c
SHD_CCRULE_NOQ=$(RUN_CC_NOQ) $(MT_CC) $(SHD_CFLAGS) $(CFLAGS_$(@)) -o $@ -c

# Default rules. These will be overriden if the module Makefile specifically
# includes a particular type (lwp, pthread, or shared)

AFS_LDRULE         =$(RUN_LD) $(CC) $(AFS_LDFLAGS) $(AFS_CFLAGS) $(LDFLAGS_$(@)) -o $@
AFS_LDRULE_NOQ =$(RUN_LD_NOQ) $(CC) $(AFS_LDFLAGS) $(AFS_CFLAGS) $(LDFLAGS_$(@)) -o $@

