#===========================================================================
# scripts Makefile
#===========================================================================
# 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 '$(<)' '$(@)'
	@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))
