# makefile.list  18 Aug 99  WJS

# 29 Jul 08.  wjs
#   Comment out the INCLUDE_ATTRIBUTES_SWITCH  to make a master
# 20 Jul 06.  wjs
#   INCLUDE_ATTRIBUTES_SWITCH (note this is optional, so this
#   particular file is NOT a master, distributed one)
# 30 Aug 04.  wjs
#   JDBFUNCDEFNS_H_DEPENDS
# 17 Jul 04.  wjs
#   Modify .h file dependency logic some more
#  7 Jul 04.  wjs
#   Add ${CONFIG_FILE} (build-env) dependencies to force makes
#   Modify .h file dependency logic some
# 22 Apr 04.  wjs
#   Comment mod to reflect that utils is expected to be in jgofs.a
# 12 Feb 04.  wjs
#   Previous make file didn't last long!  Assume more stuff in library
#   Rename stuff.  Add creation of BINDIR if non-existent
#  4 Feb 04.  wjs
#   list now needs defgb_utils.  Assume it's NOT in library
#   Unfortunately, defgb_utils wants defgb.h.  Who knows where
#     THAT should be?!  Use SRCDIR for now...
# 17 Dec 03.  wjs
#   list now uses a quadruple of .h files.  INNEROPTIONS added
#  4 Dec 03.  wjs
#   list now uses a triple of .h files.  core.h added
# 14 Feb 02.  wjs
#   list now uses a couple of .h files; one its own, another 
#   default.h via -DOPTIONS

# Mod. September 15, 1999.  Add dependency for jgofs.a.  rcg

#       Assume "jgofs 1.5 distribution tree structure" with this file
#  residing in root/src/*, along with source .c file.  Further assume
#  default directory when make executed is this source directory

#  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 list 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?!
#	list.h depends on utils.h & path_info_routines.h.  The
#	include file knows their dependencies
include ${MASTERINCDIR}/h_file_dependency_macros.include
INCLUDED_FILES = ${SRCDIR}/list.h

#	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}"'
####SWITCHES = -DOPTIONS='"${OPTIONS}"' -DINNEROPTIONS='"${INNEROPTIONS}"' \
####	   -DINCLUDE_ATTRIBUTES_SWITCH

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


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


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

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