###########################################################################
#
# Makefile system for GILDAS softwares (2003-2012).
#
# Please be careful: element order often matters in makefiles.
#
###########################################################################

include $(gagadmdir)/Makefile.def

###########################################################################

CONF_FILES = bash_profile login

###########################################################################

ifeq ($(GAG_TARGET_KIND),cygwin)
# Under cygwin, library path (for DLLs) must be put in $PATH
# NB: mingw installer uses its own mechanism
SEDSRC = \sed \
	-e 's?\$${GAG_LIB_DEP_PATH}?$(GAG_LIB_DEP_PATH)?g' \
	-e 's?\$${GAG_VERS}?$(GAG_VERS)?g' \
	-e 's?VAR_LIBRARY_PATH?PATH?g'
else
# Under all other systems, library path must be put in $LD_LIBRARY_PATH
SEDSRC = \sed \
	-e 's?\$${GAG_LIB_DEP_PATH}?$(GAG_LIB_DEP_PATH)?g' \
	-e 's?\$${GAG_VERS}?$(GAG_VERS)?g' \
	-e 's?VAR_LIBRARY_PATH?LD_LIBRARY_PATH?g'
endif

###########################################################################

include $(gagadmdir)/Makefile.etc

###########################################################################

integ: integ-message

integ-message:
	@(echo)
	@(echo "Compilation succeeded! Bye.")
	@(echo)

ifeq ($(GAG_TARGET_KIND),mingw)
default-install: install-mingw
else
default-install: install-message
endif

install-message:
	@(echo)
	@(echo "***************************************************************************")
	@(echo "Installation succeeded!")
	@(echo)
	@(echo "bash users: You should add in your ~/.bash_profile the following lines")
	@(echo "    export GAG_ROOT_DIR=$(gagexedir)")
	@(echo "    export GAG_EXEC_SYSTEM=$(GAG_EXEC_SYSTEM)")
	@(echo '    source $$GAG_ROOT_DIR/etc/bash_profile')
	@(echo)
	@(echo "csh users:  You should add in your ~/.login the following lines")
	@(echo "    setenv GAG_ROOT_DIR $(gagexedir)")
	@(echo "    setenv GAG_EXEC_SYSTEM $(GAG_EXEC_SYSTEM)")
	@(echo '    source $$GAG_ROOT_DIR/etc/login')
	@(echo)
	@(echo "You should then exit this xterm and open a new one to reset your path.")
	@(echo "GILDAS should be ready for use (e.g. type greg @ gag_demo:demo).")
	@(echo "Bye.")
	@(echo "***************************************************************************")
	@(echo)

install-mingw:
	@(sh win-build-setup.sh)

###########################################################################
