#===========================================================================
#
# SHARE src Makefile
#
# author: Scott Binegar 
#
# Modification History:
#
#   Date       OPR         Who       Reason
# --------   -------   ------------  -----------------------------------------
# 09/20/01   n/a       S. Binegar    first version
# 01/31/03   47450     Sontag        Added lines for AIX
# 07/20/04   49860     Sontag        Added lines for Windows via MinGW
# 10/10/06   52073     Sontag        Added lines for Mac OSX, cleanup MinGW
# 12/21/09   63939     MSwam         use include for platform.defs
# 08/25/10   65561     MSwam         adjust clean in case cd fails
#===========================================================================
# Eliminate implicit rules
.SUFFIXES:

include ../../platform.defs

# Get a list of the script files in this directory
script_files = $(filter-out %CVS Makefile %~, $(wildcard *))


# Define the destination directory path
dest_path = ../../bin/$(OS_SUB_DIR)

# Add the destination path to each of the files
dest_script_files = $(addprefix $(dest_path)/, $(script_files))


all: $(dest_script_files)
	@echo "Finished updating scripts";

#
# Define rule to determine if destination file needs updating
#
$(dest_script_files) : $(dest_path)/% : %
	@echo "Updating $<"
	@cp -f '$(<)' '$(@)'
ifneq ($(OS_SUB_DIR),cygwin_mingw)
	@chmod ugo+x '$(@)'
endif

# Delete the installed scripts
.PHONY: clean
clean:
	@echo "Deleting installed script files..."
	[ -d $(dest_path) ] && (cd $(dest_path); rm -f $(script_files))

