#===========================================================================
#
# SHARE src Makefile
#
# author: Scott Binegar 
#
# Modification History:
#
#   Date       OPR         Who       Reason
# --------   -------   ------------  -----------------------------------------
# 09/20/01   n/a       S. Binegar    first version
# 12/18/07   59094     MSwam         skip "tests" directory
# 12/23/09   64182     MSwam         changes for Linux
# 08/25/10   57271     MSwam         adjust clean to ensure directory exists
#===========================================================================
#
# Determine the operating system
include $(SHAREROOT)/platform.defs

# Get a list of the script files in this directory
script_files = $(filter-out %CVS Makefile tests %~, $(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 '$(<)' '$(@)'
	@chmod ugo+x $(@)


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


