SHELL = /bin/sh

#=============================================================================
#
#  INSTALL_DIR   --- Root directory into which the product is to be installed.
#  INSTALL_FILES --- Names of the files to be installed.
#  CLEAN_FILES   --- Names of specific files to be deleted when the directory
#                    is cleaned.  Files matching one of a default set of file
#                    name templates will be deleted automatically
#                    (i.e., *~ core *.bak *.orig *.old .#* #*# *.o).  This
#                    variable is for declaring additional files to delete which
#                    don't match any of the file name templates.
#  CCFILES       --- C++ source files in ../../src with embedded HTML(sans .cc)
#  SCRIPTS       --- TCL scripts in ../../etc with embedded HTML (sans .tcl)
#
#  For example, for the product "mySch":
#     INSTALL_DIR   = $(MYSCH_DIR)
#     INSTALL_FILES = *.html
#     CLEAN_FILES   = 
#     CCFILES       = src1 src2
#     SCRIPTS       = proc1 proc2
#
#=============================================================================

INSTALL_DIR	= $(TS_DIR)
INSTALL_FILES	= *.html *.htm
CLEAN_FILES	= 
CC_DOCS		= merge.html \
		  tclMerge.html \
		  resolve.html \
		  tclResolve.html \
		  targets.html \
		  tclTargets.html \
		  tclTile.html

TCL_DOCS	= setObjectStatus.htm \
		  runMerge.htm \
		  resolve.htm \
		  targetSelect.htm \
		  fieldQualitySet.htm \
		  chunkExport.htm \
		  tile.htm \
		  qa.htm \
		  utils.htm

#=============================================================================
#
# You should not have to edit any of the rest of this file.
#
#=============================================================================

SRC = ../../src
ETC = ../../etc

# Default rules for compiling
VPATH=$(ETC):$(SRC)
.SUFFIXES: .cc .tcl .html .htm
.tcl.htm:
	tcl2html $(ETC)/$*.tcl > $*.htm
.cc.html:
	c2html $(SRC)/$*.cc > $*.html

#===========================================================================
# STANDARD TARGETS
#===========================================================================

default:
	@echo Please invoke this makefile using sdssmake. >&2
	@exit 1

all : index.html

install :
	@if [ "$(INSTALL_DIR)" = "" ]; then \
		echo You have not specified a destination directory >&2; \
		exit 1; \
	fi     
	@ rm -rf $(INSTALL_DIR)/doc/www
	@ mkdir $(INSTALL_DIR)/doc/www
	@if [ "$(INSTALL_FILES)" != "" ]; then \
		cp $(INSTALL_FILES) $(INSTALL_DIR)/doc/www; \
		chmod 644 $(INSTALL_DIR)/doc/www/*; \
	fi

clean :
	@$(SDSSTOOLS_DIR)/bin/clean
	rm -f $(CLEAN_FILES)
	rm -f index.html $(CC_DOCS) $(TCL_DOCS)

make :
	@/bin/rm -f Makefile~
	@mv Makefile Makefile~
	@sed 1,/\^#START_DEPEND/\!d Makefile~ > Makefile
	@echo "" >> Makefile
	@for h in $(CC_DOCS); do \
		f="`echo $$h | sed -e 's%\\.html%%'`";\
		echo $$f.html:"	"$$f.cc >> Makefile;\
	done
	@for h in $(TCL_DOCS); do \
		f="`echo $$h | sed -e 's%\\.htm%%'`";\
		echo $$f.htm:"	"$$f.tcl >> Makefile;\
	done

#===========================================================================
# ADDITIONAL TARGETS
#===========================================================================

index.html : $(CC_DOCS) $(TCL_DOCS)
	htmlSearch -index ts > index.html

#===========================================================================
# INCLUDE FILE DEPENDENCIES
#===========================================================================
#
# include file dependencies.
# All lines below START_DEPEND are machine generated; Do Not Edit
# 
#START_DEPEND

merge.html:	merge.cc
tclMerge.html:	tclMerge.cc
resolve.html:	resolve.cc
tclResolve.html:	tclResolve.cc
targets.html:	targets.cc
tclTargets.html:	tclTargets.cc
tclTile.html:	tclTile.cc
setObjectStatus.htm:	setObjectStatus.tcl
runMerge.htm:	runMerge.tcl
resolve.htm:	resolve.tcl
targetSelect.htm:	targetSelect.tcl
fieldQualitySet.htm:	fieldQualitySet.tcl
chunkExport.htm:	chunkExport.tcl
tile.htm:	tile.tcl
qa.htm:	qa.tcl
utils.html:	utils.tcl
