# GNUmakefile          Section: All sections
#      Copyright 1994, Center for Computer Vision and Visualization,
#      University of Florida.  All rights reserved.
#
# GNUmakefile for creating the iah library.
# Each directory, except for support directories, corresponds to a
#   chapter in the IAH.  Each chapter has several sections, each
#   of which describes a separate algorithm.
# Target  all  which should be the first target in the make file
#   will invoke a make in each of the chapter directories.
#   This will invoke a make in each algorithm directory, to build
#   the iah library and headers.
#
# Modify the TOP define below to be the root of the iah directory
#   tree.  It is assumed that include/  and  lib/  should be
#   built below this root.

#######################################################################
# Modify the following symbols to control compilation
#######################################################################

# The support directories should be made first.

SUPPORTDIRS = support


# These chapters include directories that are used by
#   other chapters, hence they should be made after SUPPORTDIRS,
#   but before ALLOTHERCHAPTERS

SUPPORTCHAPTERS = statistical


ALLOTHERCHAPTERS = \
	image-enhancement \
	thresholding \
	thinning-skeletonizing \
	morphological-transforms \
	edge-detection \
	edge-thinning-boundary-finding \
	linear-transforms \
	pattern-matching-shape-detection \
	connected-component \
	image-descriptors \
	neural-networks \
	cellular-automata


ALLDIRS = ${SUPPORTDIRS} ${SUPPORTCHAPTERS} ${ALLOTHERCHAPTERS}

# The  all  target simply calls gnumake in each subdirectory

all: gnumake.iah  puresupport supportchapters allotherchapters


# Force the gnumake.iah to be the most current
${ALLDIRS}:	gnumake.iah  gnumake.iah-chp


clean:	${ALLDIRS}
	for subdir in ${ALLDIRS} ; \
	do  (cd $${subdir}; ${MAKE} clean); done

spotless:	${ALLDIRS}
	for subdir in ${ALLDIRS} ; \
	do  (cd $${subdir}; ${MAKE} spotless); done


# This rule recursively ensures that the most current GNUmakefile
#   is available in each directory.
# The  all  target should, perhaps, be dependent on this rule.

co-gnu: gnumake.iah-chp
	for subdir in ${ALLDIRS} ; \
	do  (cd $${subdir}; \
		if [ ! -w GNUmakefile ] ; then co GNUmakefile; fi; \
		${MAKE} co-gnu); done

print-srcs: GNUmakefile gnumake.iah gnumake.iah-chp
	enscript -2rG GNUmakefile gnumake.iah gnumake.iah-chp
	for subdir in ${ALLDIRS} ; \
	do  (cd $${subdir}; ${MAKE} print-srcs); done


# Make the supporting algorithms...
puresupport: ${SUPPORTDIRS}
	for subdir in ${SUPPORTDIRS} ; \
	do  (cd $${subdir}; ${MAKE}); done

# Make the supporting chapters, used by other algorithms
supportchapters: ${SUPPORTCHAPTERS}
	for subdir in ${SUPPORTCHAPTERS} ; \
	do  (cd $${subdir}; ${MAKE}); done

# Make all other chapters
allotherchapters: ${ALLOTHERCHAPTERS}
	for subdir in ${ALLOTHERCHAPTERS} ; \
	do  (cd $${subdir}; ${MAKE}); done


# These targets have been added for testing the recursive make of
#   individual directories.  However, since directories actually
#   exist with the name I *want* the target to be, e.g. support
#   each target is named  directory-dir, e.g. support-dir

support-dir:
	cd support; ${MAKE} all

statistical-dir:
	cd statistical; ${MAKE} all

image-enhancement-dir:
	cd image-enhancement; ${MAKE} all

thresholding-dir:
	cd thresholding; ${MAKE} all

thinning-skeletonizing-dir:
	cd thinning-skeletonizing; ${MAKE} all

morphological-transforms-dir:
	cd morphological-transforms; ${MAKE} all

edge-detection-dir:
	cd edge-detection; ${MAKE} all

edge-thinning-boundary-finding-dir:
	cd edge-thinning-boundary-finding; ${MAKE} all

linear-transforms-dir:
	cd linear-transforms; ${MAKE} all

pattern-matching-shape-detection-dir:
	cd pattern-matching-shape-detection; ${MAKE} all

connected-component-dir:
	cd connected-component; ${MAKE} all

image-descriptors-dir:
	cd image-descriptors; ${MAKE} all

neural-networks-dir:
	cd neural-networks; ${MAKE} all

cellular-automata-dir:
	cd cellular-automata; ${MAKE} all
