# $Id: Makefile,v 1.6 2002/05/01 21:15:20 issever Exp $

# ############################################################
# ### Settings
# ############################################################

# --- This makefile needs to know 2 important directories:
#     SRC: Where to install all the files needed to run SMM++
#     BIN: Where to install the startup file. This should be
#          along your PATH variable

# --- The default settings will install SMM++ nicely into an
#     usual unix environment (if you have root access).
BIN=/usr/local/bin
SRC=/usr/local/lib/smm

# --- If you don't have root access, you could choose to install
#     SMM++ locally in your home directory. Therefore use the
#     settings below, please. (You have to remove the '# ' characters 
#     at the beginning of the lines.)
# SRC=${HOME}/smm
# BIN=${HOME}/bin

# --- uncomment these, if you only want a temporary installation
# SRC=/tmp/smm
# BIN=/tmp/smm/bin

# ============================================================
# === optional settings
# ============================================================

# --- set ITKWISH to the path of the itkwish executable, if
#     automatic finding of this path doesn't work.
ITKWISH=`./itk.sh`

# --- This sets the default parameter, if SMM++ should start 
#     with a separate mapping window or not.
# set MAP to 1, if you want the mapper in a separate window
# set MAP to 0, if you want the mapper to be integrated
MAP=0

# --- The path to the smm-user directory; 
#     can be overwritten by the user via the shell variable 
#     SMMPATH.
#     In the context below $env(xxx) corresponds to the 
#     shellvariable xxx
USERDIR="\$$env\(HOME\)/.smm"

# --- TROUBLESHOOTING:
#     please refer to the troubleshooting section in the 
#     file INSTALL.
TROUBLEoptionmenu=0

# ############################################################
# ### Rules
# ############################################################
# ---  You don't need to edit/understand/read the rest of
#      this Makefile. If you can read Makefiles, feel free
#      to do whatever you like.

smm: Makefile
	@echo "--- Building startup file."
	@if [ -z ${ITKWISH} ] ; then \
	   echo "!!! Couldn't find itkwish executable." ; \
	   echo "    Please, enter this information by hand." ; \
	   echo "    You have to edit the line 'ITKWISH=\`./itk.sh\`' in the Makefile." ; \
	   echo "    Please, also refer to the INSTALL instructions." ; \
	   exit 1 ; \
	 fi
	@echo "#!${ITKWISH}"                         > smm
	@echo "set SMMPATH             ${USERDIR}"  >> smm
	@echo "set SMMSRCPATH          ${SRC}"      >> smm
	@echo "set SMMMAPWINDOW        ${MAP}"      >> smm
ifneq (${TROUBLEoptionmenu},0)
	@echo "set TROUBLE(optionmenu) 1"           >> smm
endif
	@echo "source \$$SMMSRCPATH/sources/startup.tcl" >> smm
	@chmod +x smm
install-bin:
	@echo "--- Installing startup file to '${BIN}'."
	@echo "    Please make sure, that '${BIN}' is part of your PATH variable."
	@echo "    Or start SMM++ with ${BIN}/smm."
	@install -d ${BIN}
	@install -c smm ${BIN}
uninstall-bin:
	@echo "--- Uninstalling startup file from '${BIN}'."
	@echo "    Leaving the bin-dir untouched."
	@rm -f ${BIN}/smm
install-src:
	@echo "--- Installing libraries to ${SRC}."
	@install -d ${SRC}
	@cp -Rp ../sources ${SRC} 
	@cp -Rp ../images ${SRC} 
	@cp -Rp ../config ${SRC} 
uninstall-src:
	@echo "--- Uninstalling libraries from ${SRC}."
	@rm -rf ${SRC}
install: install-bin install-src
uninstall: uninstall-bin uninstall-src



# ##############################################################################
# ### LOG MESSAGES
# ### As suggested by the CVS-manual this region is put to the end of the file.
# ##############################################################################
#
# $Log: Makefile,v $
# Revision 1.6  2002/05/01 21:15:20  issever
# renamed smm.tcl into startup.tcl and placed it again into sources
#
# Revision 1.5  2002/04/28 09:24:31  issever
# The startup file smm.tcl has been moved into the subsir sources/main.
#
# Revision 1.4  2001/08/19 16:02:28  issever
# make install was doing what it was designed for,..
# now it should.
#
# Revision 1.3  2001/08/19 15:35:00  issever
# Applied Edwins patch, which removes bashism by shism.
# Aditionally removed the docu part from the makefile,
# as the documentation will be distributed separately
# from now on.
#
# Revision 1.2  2001/08/19 12:25:42  issever
# Added the cvs keywords Id at start of the file
# and Log at the end of the file
#
#
