# makefile.listvar	 25 Aug 04.  WJS
#	(from makefile.list)

#  BINDIR is where executables should end up
#  LIBDIR is where jgofs library lives
#  MASTERINCDIR is where "system" .h files live
#  SRCDIR is where the main program sources are (and where their object
#       files will end up)
BINDIR = ../../bin
LIBDIR = ../lib
MASTERINCDIR = ../include
SRCDIR = .

OPTIONS = ${MASTERINCDIR}/default.h
INNEROPTIONS = ${MASTERINCDIR}/inner.h

#	Program-specific compilation flags
CFLAGS = -g

#	.h files on which serv depends
#	This list is used for dependency only - I_LIST and the source
#	code control which files are actually used in the compilation.
#	Be nice if we could tie the 2 together, wouldn't it?!
include ${MASTERINCDIR}/h_file_dependency_macros.include

#	List of directories from .h files in INCLUDED_FILES, separated by -Is 
#	Order of specification is significant.
#	No problem if no .h files in a directory and/or if a directory
#	  does not exist.
#	(-I ${SRCDIR} is default; included here to show syntax)
#	(Could get rid of -Is if I knew how to parse in make.  Sigh)
I_LIST = -I${MASTERINCDIR} -I${SRCDIR}

#	Compile-time constants
SWITCHES = -DOPTIONS='"${OPTIONS}"' -DINNEROPTIONS='"${INNEROPTIONS}"'

#       libraries required.  SYSLIB list needs leading hyphens
LIB_LIST = ${LIBDIR}/jgofs.a
#SYSLIB_LIST =


all: ${BINDIR}/listvar ${CONFIG_FILE}


${BINDIR}/listvar: ${SRCDIR}/listvar.o ${LIB_LIST} ${CONFIG_FILE}
	@- test -d ${BINDIR} || mkdir ${BINDIR}
	$(CC) ${CFLAGS} \
		${SRCDIR}/listvar.o \
		${LIB_LIST} \
		-o $@

${SRCDIR}/listvar.o: ${SRCDIR}/listvar.c \
		  ${INCLUDED_FILES} ${JDBFUNCDEFNS_H_DEPENDS} \
		  ${CONFIG_FILE}
	$(CC) ${CFLAGS} \
		${SWITCHES} \
		${I_LIST} \
		-c ${SRCDIR}/listvar.c \
		-o $@
