# makefile.path_info    Aug 97   WJS
#	Builds make_path_info_string, parse_path_info, and test_path_info
#	executables.  all option builds the first 2; test_path_info is
#	for testing the path_info_routines package.

#   8 Mar 08.  WJS
#     Add err_stub per mod to library requiring this (or recoding)
#  17 Jul 04.  WJS
#     Add dependency on build-env.pl (${CONFIG_FILE}).  Could also put in
#	h_file_dependency.include, but existing coding looks pretty good...
#  24 Apr 04.  WJS
#     Major overhaul reflecting move of path_info_routines to
#	"the library", its .h files to "the include directory", and the
#	inclusion of error_exit_defn.h into core.h
#     Add some dependencies; notably jgofs.a
#     Some comment reorg
#  20 Apr 99.  WJS
#     Add INCDIR & SRCDIR.
#  15 May 98.  WJS
#     Remove comments that don't start in col 1. They caused
#	trouble on IRIX systems. (Watch out for trailing whitespace after
#	macro defn, too - don't have any if you can avoid it)
#   7 May 98.  WJS
#     Bug fix - no space between -I and its directory.

#  BINDIR is where executables should end up
#  INCDIR is where path_info_routines.h & error_exit_defn.h live
#  LIBDIR is where the library containing path_info_routines.c lives
#  SRCDIR is where main programs' .c & .o files live

BINDIR = ../../bin
INCDIR = ../include
LIBDIR = ../lib
SRCDIR = .
LIBNAME = jgofs.a

DOPTIONS_FILE = ${INCDIR}/default.h
IOPTIONS_FILE = ${INCDIR}/inner.h

CFLAGS = -g
LIB = ${LIBDIR}/${LIBNAME}

INCLUDED_FILES = ${INCDIR}/core.h \
		 ${INCDIR}/path_info_routines.h \
		 ${DOPTIONS_FILE} \
		 ${IOPTIONS_FILE}

I_LIST = -I ${SRCDIR} -I ${INCDIR}
LIB_LIST = ${LIB}
SWITCHES = -DOPTIONS='"${DOPTIONS_FILE}"' -DINNEROPTIONS='"${IOPTIONS_FILE}"'

all: ${BINDIR}/make_path_info_string \
     ${BINDIR}/parse_path_info \
     ${CONFIG_FILE}

${BINDIR}/make_path_info_string: ${SRCDIR}/make_path_info_string.o \
				 ${LIBDIR}/err_stub.o \
				 ${LIB_LIST} \
				 ${CONFIG_FILE}
	$(CC) ${CFLAGS} \
		${SRCDIR}/make_path_info_string.o \
		${LIBDIR}/err_stub.o \
		${LIB_LIST} \
		-o $@

${BINDIR}/parse_path_info: ${SRCDIR}/parse_path_info.o \
			   ${LIBDIR}/err_stub.o \
			   ${LIB_LIST} \
			   ${CONFIG_FILE}
	$(CC) ${CFLAGS} \
		${LIBDIR}/err_stub.o \
		${SRCDIR}/parse_path_info.o \
		${LIB_LIST} \
		-o $@

${BINDIR}/test_path_info: ${SRCDIR}/test_path_info.o \
			  ${SRCDIR}/test_path_info_stdlib.o \
			  ${LIBDIR}/err_stub.o \
			  ${LIB_LIST} \
			  ${CONFIG_FILE}
	$(CC) ${CFLAGS} \
		${SRCDIR}/test_path_info.o \
		${SRCDIR}/test_path_info_stdlib.o \
		${LIBDIR}/err_stub.o \
		${LIB_LIST} \
		-o $@

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

${SRCDIR}/test_path_info.o: ${SRCDIR}/test_path_info.c ${CONFIG_FILE}
	$(CC) ${CFLAGS} \
		-c ${SRCDIR}/test_path_info.c \
		${SWITCHES} \
		-o $@

${SRCDIR}/test_path_info_stdlib.o: ${SRCDIR}/test_path_info_stdlib.c ${CONFIG_FILE}
	$(CC) ${CFLAGS} \
		-c ${SRCDIR}/test_path_info_stdlib.c \
		-o $@

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