#
# Configuration control file
#
# $Header: Makefile[2.6] Wed Mar 10 11:56:21 1993 garfield@garfield frozen $
#

# --------------------------------------------------------------------
#		locations and general macros
# --------------------------------------------------------------------

# general path definitions

# where can I put the xf executable
INSTALLBINPATH = /usr/local/bin/

# where can I put the xf manual
INSTALLMANPATH = /usr/local/man

# the x11 include directory
X11_INCDIR = /usr/include/X11

# the x11 library directory
X11_LIBDIR = /usr/lib/X11

# the col(1) command 
COL_CMD = "col -b"

# the cpp command and flags
CPP_CMD = /lib/cpp
CPP_FLAGS = -P

# the Tcl MANPATH that shoud be used
TCL_MAN_PATH = "/usr/local/man"

# the Tcl MANARGS that shoud be used
TCL_MAN_ARGS = ""

# the Tk MANPATH that shoud be used
TK_MAN_PATH = "/usr/local/man"

# the Tk MANARGS that shoud be used
TK_MAN_ARGS = ""

# the widgets MANPATH that shoud be used
WIDGETS_MAN_PATH = "/usr/local/man"

# the widgets MANARGS that shoud be used
WIDGETS_MAN_ARGS = ""

# the additional widgets MANPATH that shoud be used
ADD_MAN_PATH = "/usr/local/man"

# the additional widgets MANARGS that shoud be used
ADD_MAN_ARGS = ""

# XF locations

# where can I find wish (the ultimate tool :-)
WISH_CMD = /usr/local/bin/wish

# where is the toplevel XF directory (with all the
# subdirectories...). Just to prevent misunderstandings...
# You can place xf everywhere you want.
XF_DIR = /usr/local/lib/xf2.2

# where can I find my library files
XF_LIB_DIR = $(XF_DIR)/lib

# where can I find my files
XF_SRC_DIR = $(XF_DIR)/src

# where are the additional widgets (if any)
XF_ADD_DIR = $(XF_DIR)/additionals

# where are the standard widgets
XF_ELEM_DIR = $(XF_DIR)/elements

# where are the help pages (if any)
XF_HELP_DIR = $(XF_DIR)/xfhelp/pages

# where are the iconbar icons located
XF_ICONS_DIR = $(XF_LIB_DIR)/icons

# where are the procedures (if any)
XF_PROC_DIR = $(XF_DIR)/procedures

# where are the tmp files (if created)
XF_TMP_DIR = /tmp

# where are the templates (if any)
XF_TMPLT_DIR = $(XF_DIR)/templates

# what name has the application defaults file
XF_APP_FILE = $(XF_LIB_DIR)/XF

# what name has the default binding file
XF_BIND_FILE = $(XF_SRC_DIR)/xfdefbind.tcl

# what name has the color file
XF_COLOR_FILE = $(XF_LIB_DIR)/Colors

# what name has the config file
XF_CONFIG_FILE = '~/.xf-config'

# what name has the cursor file
XF_CURSOR_FILE = $(XF_LIB_DIR)/Cursors

# what name has the font file
XF_FONT_FILE = $(XF_LIB_DIR)/Fonts

# what name has the iconbar file
XF_ICONBAR_FILE = $(XF_DIR)/xfconfig/standard/xf-iconbar.tcl

# what name has the keysym file
XF_KEYSYM_FILE = $(XF_LIB_DIR)/Keysyms

# what name has the default menubar file
XF_MENUBAR_FILE = $(XF_DIR)/xfconfig/standard/xf-menubar.tcl

# what name has the window positions file
XF_POS_FILE = $(XF_DIR)/xfconfig/standard/xf-positions

# the application default file
APP_TARGET = xf.ad

# default variant
XF_VARIANT = standard

###########################################################
# END OF CONFIGURATION PARAMETERS
# DO NOT CHANGE ANYTHING BELOW THIS LINE !!!!!!!!!!!!!!
###########################################################

# The base directory of the project's source repository area.

BASE = /home/stone/garfield/development/xf

# Path to this node system relative to the root of the source
# repository defined above (e.g. vc/save).

NODEPATH = 

# A short name for this node system

NODENAME = xf

# The operating system, $(TARGET) shall be built for.

HOSTSYSTEM = s-sunos_4

# The processor type.

HOSTTYPE = sun4

# Preprocessor switches. (eg. -DDEBUG)

SWITCHES = 

# Locations and modes for the installation of executables, header
# files, libraries and manuals.

INSTALLBASE = /usr/local
#INSTALLBINPATH = $(INSTALLBASE)/bin
INSTALLBINMODE = 755
INSTALLINCPATH = $(INSTALLBASE)/include
INSTALLINCMODE = 444
INSTALLLIBPATH = $(INSTALLBASE)/lib/shape
INSTALLLIBMODE = 644
#INSTALLMANPATH = $(INSTALLBASE)/man
INSTALLMANMODE = 444

# Directories, where local libraries and header files are to be
# installed for project wide use.

LIBPATH     = $(BASE)/lib
INCLUDEPATH = $(BASE)/include

# --------------------------------------------------------------------
#		the system's components
# --------------------------------------------------------------------

#
# The system (program, library, etc.) to be built. If you want to
# manage multiple programs, you should introduce multiple targets
# (like PROGTARGET LIBTARGET or any better names). In this case you 
# have to adjust the system building actions accordingly.

TARGET = xf

# The release number generator. The version number of this file will
# be used as release identifier for the whole system.

VERSIONFILE = Version	# source
VERSIONOBJECT =		# derived (if source contains program code)

# The names of the subdirectories containing subsystems which are also
# to be built.

SUBSYSTEMS = additionals demos elements lib procedures \
	     src templates xfappdef xfconfig xfhardcopy \
	     xfhelp xfpixmap xftutorial

# Aliases for (filesystem links to) $(TARGET).

ALIASES = 

# The regular source and header files.

SOURCES = ACKS About Bugs COPYRIGHT FAQ.config FAQ.install \
	  FAQ.running INSTALL MAILLIST README TODO \
	  Tk2.3-Tk3.2 XF1.4-XF2.1 xf.ad xf.1 xf.sh

HEADERS = 

# Auxiliary source and header files that are not genuine part of the
# system (eg. a test environment). These will also be processed on
# system building, but will *not* be included in releases.

AUXSOURCES = 

AUXHEADERS = 

# Sources of variant source components stored under equal names in
# different locations. During system builds, only one of each (equally
# named) group is chosen. Source distributions need all of them.

VARIANTSOURCES =

VARIANTHEADERS =

# The manuals

MANUALS = $(MAN1) $(MAN3) $(MAN4) $(MAN5) $(MAN6) $(MAN7) $(MAN8)
MAN1 = 
MAN3 = 
MAN4 = 
MAN5 = 
MAN6 = 
MAN7 = 
MAN8 = 

# All source components of the system (should not be changed)

COMPONENTS = $(SOURCES) $(HEADERS) $(MANUALS) Shapefile Makefile Dependencies

# The derived files. All files, that are autamatically produced during
# a build process should be listed here.

OBJECTS = $(VERSIONOBJECT)

# --------------------------------------------------------------------
#		tools, flags, libraries etc.
# --------------------------------------------------------------------

MAKE = make
SHELL = /bin/sh
CC = cc
CFLAGS  = -I$(INCLUDEPATH) $(SWITCHES) -O
LDFLAGS = -s
RANLIB  = /usr/bin/ranlib

# System libraries, local libraries and lint libraries.

SYSLIBS   = 
LOCALLIBS = 
LINTLIBS  =

# --------------------------------------------------------------------
#			the targets
# --------------------------------------------------------------------

# The default action (do not change)

all:

# my local targets
# this target looks a bit clumsy, but it should work :-),
# it fixes reported bugs with some cpp's
makeXF: +$(XF_VARIANT) xf.sh
	@-echo "installing: makexf"; \
	$(CPP_CMD) \
	$(CPP_FLAGS) \
	-DCPP_WISH_CMD=$(WISH_CMD) \
	-DCPP_INSTALLBINPATH=$(INSTALLBINPATH) \
	-DCPP_XF_DIR=$(XF_DIR) \
	-DCPP_XF_LIB_DIR=$(XF_LIB_DIR) \
	-DCPP_XF_ADD_DIR=$(XF_ADD_DIR) \
	-DCPP_XF_ELEM_DIR=$(XF_ELEM_DIR) \
	-DCPP_XF_HELP_DIR=$(XF_HELP_DIR) \
	-DCPP_XF_ICONS_DIR=$(XF_ICONS_DIR) \
	-DCPP_XF_PROC_DIR=$(XF_PROC_DIR) \
	-DCPP_XF_SRC_DIR=$(XF_SRC_DIR) \
	-DCPP_XF_TMP_DIR=$(XF_TMP_DIR) \
	-DCPP_XF_TMPLT_DIR=$(XF_TMPLT_DIR) \
	xf.sh | $(CPP_CMD) \
	$(CPP_FLAGS) \
	-DCPP_XF_APP_FILE=$(XF_APP_FILE) \
	-DCPP_XF_BIND_FILE=$(XF_BIND_FILE) \
	-DCPP_XF_COLOR_FILE=$(XF_COLOR_FILE) \
	-DCPP_XF_CONFIG_FILE=$(XF_CONFIG_FILE) \
	-DCPP_XF_CURSOR_FILE=$(XF_CURSOR_FILE) \
	-DCPP_XF_FONT_FILE=$(XF_FONT_FILE) \
	-DCPP_XF_ICONBAR_FILE=$(XF_ICONBAR_FILE) \
	-DCPP_XF_KEYSYM_FILE=$(XF_KEYSYM_FILE) \
	-DCPP_XF_MENUBAR_FILE=$(XF_MENUBAR_FILE) \
	-DCPP_XF_POS_FILE=$(XF_POS_FILE) \
	| sed 's/%%%/#/g' > xf

makeColors: +$(XF_VARIANT)
	@-echo "installing: Colors"; \
	cp $(X11_LIBDIR)/rgb.txt ./lib/Colors

makeCursors: +$(XF_VARIANT)
	@-echo "installing: Cursors"; \
	(sed 's/XC_//g' $(X11_INCDIR)/cursorfont.h | sed 's/#define num_glyphs//g' | awk -f ./lib/awkIt > ./lib/Cursors)

makeFonts: +$(XF_VARIANT)
	@-echo "installing: Fonts"; \
	xlsfonts > ./lib/Fonts

makeKeysyms: +$(XF_VARIANT)
	@-echo "installing: Keysyms"; \
	(sed 's/XK_//g' $(X11_INCDIR)/keysymdef.h | awk -f ./lib/awkIt > ./lib/Keysyms)

makeFAQ: +$(XF_VARIANT)
	cp ./FAQ.config $(XF_HELP_DIR)/XF/FAQ.config.H; \
	cp ./FAQ.install $(XF_HELP_DIR)/XF/FAQ.install.H; \
	cp ./FAQ.running $(XF_HELP_DIR)/XF/FAQ.running.H; \
	cp ./Bugs $(XF_HELP_DIR)/XF/Bugs.H

makeAbout: +$(XF_VARIANT)
	@-mkdir $(XF_HELP_DIR)/XF; \
	rm -f $(XF_HELP_DIR)/XF/About.H; \
	echo -n "XF " >> $(XF_HELP_DIR)/XF/About.H; \
	awk -f ./lib/printFirst ./Version >> $(XF_HELP_DIR)/XF/About.H; \
	cat ./About >> $(XF_HELP_DIR)/XF/About.H

makeAutoTemplates: +$(XF_VARIANT)
	@-echo "installing: auto_load templates"; \
	$(WISH_CMD) -f ./lib/makeAutoTmplt.tcl

makeMiscText: +$(XF_VARIANT)
	@-echo "installing: misc"

makeMisc: +$(XF_VARIANT) makeMiscText installmanuals installappdef makeAtFS

makeAtFS:
	@-if [ -d ./procedures/AtFS ]; then \
		touch ./procedures/AtFS; \
	else \
		mkdir ./procedures/AtFS; \
	fi

makexfhelp:

installMisc:
	@-cp strip_bw $(INSTALLBINPATH)
	@(cat ./xfhelp/xfhelp.sh | sed 's%^WISH_CMD=.*ish%WISH_CMD=$(WISH_CMD)%' | sed 's%^  XF_LOAD_PATH=%  XF_LOAD_PATH=$(XF_DIR)/xfhelp:%' > ./xfhelp/xfhelp)
	@if [ -f $(INSTALLBINPATH)/xfhelp ] && [ ! -w $(INSTALLBINPATH)/xfhelp ]; then \
		chmod u+w $(INSTALLBINPATH)/xfhelp; \
	fi
	@-cp ./xfhelp/xfhelp $(INSTALLBINPATH)/xfhelp
	@-chmod $(INSTALLBINMODE) $(INSTALLBINPATH)/xfhelp
	@if [ -f $(INSTALLMANPATH)/man1/xfhelp.1 ] && [ ! -w $(INSTALLMANPATH)/man1/xfhelp.1 ]; then \
		chmod u+w $(INSTALLMANPATH)/man1/xfhelp.1; \
	fi
	@-cp ./xfhelp/xfhelp.1 $(INSTALLMANPATH)/man1/xfhelp.1
	@-chmod $(INSTALLMANMODE) $(INSTALLMANPATH)/man1/xfhelp.1
	@(cat ./xftutorial/xftutorial.tcl | sed 's%^#!.*ish -f%#!$(WISH_CMD) -f%' > ./xftutorial/xftutorial)
	@if [ -f $(INSTALLBINPATH)/xftutorial ] && [ ! -w $(INSTALLBINPATH)/xftutorial ]; then \
		chmod u+w $(INSTALLBINPATH)/xftutorial; \
	fi
	@-cp ./xftutorial/xftutorial $(INSTALLBINPATH)/xftutorial
	@-chmod $(INSTALLBINMODE) $(INSTALLBINPATH)/xftutorial
	@if [ -f $(INSTALLMANPATH)/man1/xftutorial.1 ] && [ ! -w $(INSTALLMANPATH)/man1/xftutorial.1 ]; then \
		chmod u+w $(INSTALLMANPATH)/man1/xftutorial.1; \
	fi
	@-cp ./xftutorial/xftutorial.1 $(INSTALLMANPATH)/man1/xftutorial.1
	@-chmod $(INSTALLMANMODE) $(INSTALLMANPATH)/man1/xftutorial.1
	@(cat ./xfappdef/xfappdef.tcl | sed 's%^#!.*ish -f%#!$(WISH_CMD) -f%' > ./xfappdef/xfappdef)
	@if [ -f $(INSTALLBINPATH)/xfappdef ] && [ ! -w $(INSTALLBINPATH)/xfappdef ]; then \
		chmod u+w $(INSTALLBINPATH)/xfappdef; \
	fi
	@-cp ./xfappdef/xfappdef $(INSTALLBINPATH)/xfappdef
	@-chmod $(INSTALLBINMODE) $(INSTALLBINPATH)/xfappdef
	@if [ -f $(INSTALLMANPATH)/man1/xfappdef.1 ] && [ ! -w $(INSTALLMANPATH)/man1/xfappdef.1 ]; then \
		chmod u+w $(INSTALLMANPATH)/man1/xfappdef.1; \
	fi
	@-cp ./xfappdef/xfappdef.1 $(INSTALLMANPATH)/man1/xfappdef.1
	@-chmod $(INSTALLMANMODE) $(INSTALLMANPATH)/man1/xfappdef.1
	@(cat ./xfhardcopy/xfhardcopy.tcl | sed 's%^#!.*ish -f%#!$(WISH_CMD) -f%' > ./xfhardcopy/xfhardcopy)
	@if [ -f $(INSTALLBINPATH)/xfhardcopy ] && [ ! -w $(INSTALLBINPATH)/xfhardcopy ]; then \
		chmod u+w $(INSTALLBINPATH)/xfhardcopy; \
	fi
	@-cp ./xfhardcopy/xfhardcopy $(INSTALLBINPATH)/xfhardcopy
	@-chmod $(INSTALLBINMODE) $(INSTALLBINPATH)/xfhardcopy
	@if [ -f $(INSTALLMANPATH)/man1/xfhardcopy.1 ] && [ ! -w $(INSTALLMANPATH)/man1/xfhardcopy.1 ]; then \
		chmod u+w $(INSTALLMANPATH)/man1/xfhardcopy.1; \
	fi
	@-cp ./xfhardcopy/xfhardcopy.1 $(INSTALLMANPATH)/man1/xfhardcopy.1
	@-chmod $(INSTALLMANMODE) $(INSTALLMANPATH)/man1/xfhardcopy.1
	@(cat ./xfpixmap/xfpixmap.tcl | sed 's%^#!.*ish -f%#!$(WISH_CMD) -f%' > ./xfpixmap/xfpixmap)
	@if [ -f $(INSTALLBINPATH)/xfpixmap ] && [ ! -w $(INSTALLBINPATH)/xfpixmap ]; then \
		chmod u+w $(INSTALLBINPATH)/xfpixmap; \
	fi
	@-cp ./xfpixmap/xfpixmap $(INSTALLBINPATH)/xfpixmap
	@-chmod $(INSTALLBINMODE) $(INSTALLBINPATH)/xfpixmap
	@if [ -f $(INSTALLMANPATH)/man1/xfpixmap.1 ] && [ ! -w $(INSTALLMANPATH)/man1/xfpixmap.1 ]; then \
		chmod u+w $(INSTALLMANPATH)/man1/xfpixmap.1; \
	fi
	@-cp ./xfpixmap/xfpixmap.1 $(INSTALLMANPATH)/man1/xfpixmap.1
	@-chmod $(INSTALLMANMODE) $(INSTALLMANPATH)/man1/xfpixmap.1

checkTree:
	@-echo "checking XF tree"; \
	if [ -d $(XF_DIR)/src ] && \
	   [ -d $(XF_DIR)/lib ] && \
	   [ -d $(XF_DIR)/elements ] && \
	   [ -d $(XF_DIR)/additionals ] && \
	   [ -f $(XF_DIR)/src/xfmain.tcl ]; then \
		echo "XF tree is correct"; \
		touch installable1; \
	else \
		echo "The target directory $(XF_DIR)"; \
		echo "does not contain the XF source tree. Please unpack the XF"; \
		echo "distribution in $(XF_DIR)"; \
		echo "and install XF from there, or specify the current directoy as"; \
		echo "XF_DIR in the Makefile."; \
		touch installable1; \
		rm installable1; \
	fi; \
	echo "checking wish interpreter..."; \
	if [ -f $(WISH_CMD) ]; then \
		echo "Wish interpreter was found!"; \
		touch installable2; \
	else \
		echo "The specified wish interpreter does not exist!"; \
                echo "Please specify something different than:"; \
		echo "$(WISH_CMD)"; \
		echo "and install XF again."; \
		touch installable2; \
		rm installable2; \
	fi

Help3.2: +$(XF_VARIANT)
	@-echo "installing: Help based upon Tk3.2"; \
	./xfhelp/makeTcl3.2 -c $(COL_CMD) -m $(TCL_MAN_PATH) -a $(TCL_MAN_ARGS); \
	./xfhelp/makeTk3.2 -c $(COL_CMD) -m $(TK_MAN_PATH) -a $(TK_MAN_ARGS); \
	./xfhelp/makeWidgets3.2 -c $(COL_CMD) -m $(WIDGETS_MAN_PATH) -a $(WIDGETS_MAN_ARGS); \
	./xfhelp/makeAdd3.2 -c $(COL_CMD) -m $(ADD_MAN_PATH) -a $(ADD_MAN_ARGS)

Help3.3: +$(XF_VARIANT)
	@-echo "installing: Help based upon Tk3.3"; \
	./xfhelp/makeTcl3.3 -c $(COL_CMD) -m $(TCL_MAN_PATH) -a $(TCL_MAN_ARGS); \
	./xfhelp/makeTk3.3 -c $(COL_CMD) -m $(TK_MAN_PATH) -a $(TK_MAN_ARGS); \
	./xfhelp/makeWidgets3.3 -c $(COL_CMD) -m $(WIDGETS_MAN_PATH) -a $(WIDGETS_MAN_ARGS); \
	./xfhelp/makeAdd3.3 -c $(COL_CMD) -m $(ADD_MAN_PATH) -a $(ADD_MAN_ARGS)

Help3.6: +$(XF_VARIANT)
	@-echo "installing: Help based upon Tk3.6"; \
	./xfhelp/makeTcl3.3 -c $(COL_CMD) -m $(TCL_MAN_PATH) -a $(TCL_MAN_ARGS); \
	./xfhelp/makeTk3.3 -c $(COL_CMD) -m $(TK_MAN_PATH) -a $(TK_MAN_ARGS); \
	./xfhelp/makeWidgets3.3 -c $(COL_CMD) -m $(WIDGETS_MAN_PATH) -a $(WIDGETS_MAN_ARGS); \
	./xfhelp/makeAdd3.3 -c $(COL_CMD) -m $(ADD_MAN_PATH) -a $(ADD_MAN_ARGS)

installappdef: +$(XF_VARIANT) $(APP_TARGET)
	@-cp $(APP_TARGET) $(XF_APP_FILE)

xfHelp: +$(XF_VARIANT) installable1 installable2
	@-echo "Installing XF will perform the following steps:"; \
	echo "   make makeXF"; \
	echo "   make makeColors"; \
	echo "   make makeCursors"; \
	echo "   make makeFonts"; \
	echo "   make makeKeysyms"; \
	echo "   make makeAbout"; \
	echo "   make makeFAQ"; \
	echo "   make makeAutoTemplates"; \
	echo "   make $(INSTALLBINPATH)/$(TARGET)"; \
	echo "   make makeMisc"; \
	echo ""; \
	echo "To install the Tcl/Tk manual pages run:"; \
	echo "   make Help3.2"; \
	echo "or:"; \
	echo "   make Help3.3"; \
	echo "or:"; \
	echo "   make Help3.6"; \
	echo ""; \
	echo "Beginning installation:"

xfRelease:
	-mv Version Version.save; \
	find . -exec chmod u+w {} \; ;\
	find . -name Dependencies -exec rm -f {} \; ;\
	find . -name Version -exec rm -f {} \; ;\
	find . -name Shapefile -exec rm -f {} \; ;\
	find . -name AtFS -exec rm -rf {} \; ;\
	mv Version.save Version; \
	rm -rf ./man

transfer: clean write-tar

write-tar:
	-rm -f transfer.tar; \
	rm -f transfer.tar.Z; \
	gtar cfX transfer.tar ./lib/Tar.exclude *; \
	gtar df transfer.tar; \
	compress transfer.tar; \
	chmod a-w transfer.tar.Z

+standard:

targets: $(TARGET)

$(TARGET): $(LOCALLIBS) $(OBJECTS)
	@_aliases="$(ALIASES)"; \
	for i in $$_aliases; \
	do \
	  rm -f $$i; \
	  echo linking $(TARGET) to $$i; \
	  ln $(TARGET) $$i; \
	done

installtargets: makeXF makeColors makeCursors makeFonts makeKeysyms makeAbout makeFAQ makeAutoTemplates $(INSTALLBINPATH)/$(TARGET) makeMisc installMisc

$(INSTALLBINPATH)/$(TARGET): $(TARGET)
	@-echo "installing $(TARGET) in $(INSTALLBINPATH)"; \
	if [ -f $(INSTALLBINPATH)/$(TARGET) ] && \
	   [ ! -w $(INSTALLBINPATH)/$(TARGET) ]; \
	then \
	  chmod u+w $(INSTALLBINPATH)/$(TARGET); \
	fi; \
	cp $(TARGET) $(INSTALLBINPATH)/$(TARGET); \
	chmod $(INSTALLBINMODE) $(INSTALLBINPATH)/$(TARGET); \
	_aliases="$(ALIASES)"; \
	for i in $$_aliases; \
	do \
	  rm -f $(INSTALLBINPATH)/$$i; \
	  echo "linking $(INSTALLBINPATH)/$(TARGET) to $(INSTALLBINPATH)/$$i"; \
	  ln $(INSTALLBINPATH)/$(TARGET) $(INSTALLBINPATH)/$$i; \
	done

installmanuals: +$(XF_VARIANT) $(MANUALS)
	@-_manuals="$(MAN1) xf.1"; \
	for i in $$_manuals; \
	do \
	  echo "installing $$i in $(INSTALLMANPATH)/man1"; \
	  if [ -f $(INSTALLMANPATH)/man1/$$i ] && \
	     [ ! -w $(INSTALLMANPATH)/man1/$$i ]; \
	  then \
	    chmod u+w $(INSTALLMANPATH)/man1/$$i; \
	  fi; \
	  cp $$i $(INSTALLMANPATH)/man1/$$i; \
	  chmod $(INSTALLMANMODE) $(INSTALLMANPATH)/man1/$$i; \
	done

# The cleanup action. Removes all automatically rederivable files.

doclean: +$(XF_VARIANT)
	rm -f $(TARGET) $(ALIASES) $(OBJECTS) *~ Prot.*

# Recursive builds. Performed *before* building $(TARGET)

subsystems:
	@_subsystems="$(SUBSYSTEMS)"; \
	for i in $$_subsystems; \
	do \
	  echo cd $$i; \
	  (cd $$i; $(MAKE) \
		BASE=$(BASE) \
		HOSTSYSTEM=$(HOSTSYSTEM) \
		HOSTTYPE=$(HOSTTYPE) \
		SWITCHES="$(SWITCHES)" \
		WISH_CMD=$(WISH_CMD) \
		XF_DIR=$(XF_DIR) \
		INSTALLBASE=$(INSTALLBASE) \
		INSTALLBINPATH=$(INSTALLBINPATH) \
		INSTALLBINMODE=$(INSTALLBINMODE) \
		INSTALLINCPATH=$(INSTALLINCPATH) \
		INSTALLINCMODE=$(INSTALLINCMODE) \
		INSTALLLIBPATH=$(INSTALLLIBPATH) \
		INSTALLLIBMODE=$(INSTALLLIBMODE) \
		INSTALLMANPATH=$(INSTALLMANPATH) \
		INSTALLMANMODE=$(INSTALLMANMODE) \
		LIBPATH=$(LIBPATH) \
		INCLUDEPATH=$(INCLUDEPATH) \
		MAKE="$(MAKE)" \
		SHELL="$(SHELL)" \
		CC="$(CC)" \
		CFLAGS="$(CFLAGS)" \
		LDFLAGS="$(LDFLAGS)" \
		RANLIB="$(RANLIB)" \
		SYSLIBS="$(SYSLIBS)" \
		BINDDEFAULT=$(BINDDEFAULT) \
		BINDINSTALL=$(BINDINSTALL) \
		COMPILER=$(COMPILER) \
		QUALITY=$(QUALITY) \
		TOTALRELEASEBASE=$(TOTALRELEASEBASE) \
		PARTIALRELEASEBASE=$(PARTIALRELEASEBASE) \
		SHAPELIBPATH=$(SHAPELIBPATH) \
		ALLTARGETS= \
		MAINTARGET= \
		$(MAINTARGET) ); \
	done

# --------------------------------------------------------------------
#			internals (do not modify)
# --------------------------------------------------------------------

install: +install $(ALLTARGETS)

clean: +clean $(ALLTARGETS)

+all:
	@-if [ -n "$(ALLTARGETS)" ]; \
	then : ; \
	else \
	  $(MAKE) ALLTARGETS="subsystems targets" MAINTARGET=all \
		BASE=$(BASE) \
		HOSTSYSTEM=$(HOSTSYSTEM) \
		HOSTTYPE=$(HOSTTYPE) \
		SWITCHES="$(SWITCHES)" \
		WISH_CMD=$(WISH_CMD) \
		XF_DIR=$(XF_DIR) \
		INSTALLBASE=$(INSTALLBASE) \
		INSTALLBINPATH=$(INSTALLBINPATH) \
		INSTALLBINMODE=$(INSTALLBINMODE) \
		INSTALLINCPATH=$(INSTALLINCPATH) \
		INSTALLINCMODE=$(INSTALLINCMODE) \
		INSTALLLIBPATH=$(INSTALLLIBPATH) \
		INSTALLLIBMODE=$(INSTALLLIBMODE) \
		INSTALLMANPATH=$(INSTALLMANPATH) \
		INSTALLMANMODE=$(INSTALLMANMODE) \
		LIBPATH=$(LIBPATH) \
		INCLUDEPATH=$(INCLUDEPATH) \
		MAKE="$(MAKE)" \
		SHELL="$(SHELL)" \
		CC="$(CC)" \
		CFLAGS="$(CFLAGS)" \
		LDFLAGS="$(LDFLAGS)" \
		RANLIB="$(RANLIB)" \
		SYSLIBS="$(SYSLIBS)" all; \
	fi

+install:
	@-if [ -n "$(ALLTARGETS)" ]; \
	then : ; \
	else \
	  $(MAKE) ALLTARGETS="checkTree xfHelp installtargets" \
		MAINTARGET=install \
		BASE=$(BASE) \
		HOSTSYSTEM=$(HOSTSYSTEM) \
		HOSTTYPE=$(HOSTTYPE) \
		SWITCHES="$(SWITCHES)" \
		WISH_CMD=$(WISH_CMD) \
		XF_DIR=$(XF_DIR) \
		INSTALLBASE=$(INSTALLBASE) \
		INSTALLBINPATH=$(INSTALLBINPATH) \
		INSTALLBINMODE=$(INSTALLBINMODE) \
		INSTALLINCPATH=$(INSTALLINCPATH) \
		INSTALLINCMODE=$(INSTALLINCMODE) \
		INSTALLLIBPATH=$(INSTALLLIBPATH) \
		INSTALLLIBMODE=$(INSTALLLIBMODE) \
		INSTALLMANPATH=$(INSTALLMANPATH) \
		INSTALLMANMODE=$(INSTALLMANMODE) \
		LIBPATH=$(LIBPATH) \
		INCLUDEPATH=$(INCLUDEPATH) \
		MAKE="$(MAKE)" \
		SHELL="$(SHELL)" \
		CC="$(CC)" \
		CFLAGS="$(CFLAGS)" \
		LDFLAGS="$(LDFLAGS)" \
		RANLIB="$(RANLIB)" \
		SYSLIBS="$(SYSLIBS)" install; \
	fi

+clean:
	@-if [ -n "$(ALLTARGETS)" ]; \
	then : ; \
	else \
	  $(MAKE) ALLTARGETS="subsystems doclean" MAINTARGET=clean \
		BASE=$(BASE) \
		HOSTSYSTEM=$(HOSTSYSTEM) \
		HOSTTYPE=$(HOSTTYPE) \
		SWITCHES="$(SWITCHES)" \
		WISH_CMD=$(WISH_CMD) \
		XF_DIR=$(XF_DIR) \
		INSTALLBASE=$(INSTALLBASE) \
		INSTALLBINPATH=$(INSTALLBINPATH) \
		INSTALLBINMODE=$(INSTALLBINMODE) \
		INSTALLINCPATH=$(INSTALLINCPATH) \
		INSTALLINCMODE=$(INSTALLINCMODE) \
		INSTALLLIBPATH=$(INSTALLLIBPATH) \
		INSTALLLIBMODE=$(INSTALLLIBMODE) \
		INSTALLMANPATH=$(INSTALLMANPATH) \
		INSTALLMANMODE=$(INSTALLMANMODE) \
		LIBPATH=$(LIBPATH) \
		INCLUDEPATH=$(INCLUDEPATH) \
		MAKE="$(MAKE)" \
		SHELL="$(SHELL)" \
		CC="$(CC)" \
		CFLAGS="$(CFLAGS)" \
		LDFLAGS="$(LDFLAGS)" \
		RANLIB="$(RANLIB)" \
		SYSLIBS="$(SYSLIBS)" clean; \
	fi

