# file: $(NEDC_NFC)/src/util/shell/Makefile
#
# revision history:
#
# 20221216 (ML): initial version
#
# This Makefile builds all the classes in this directory and puts them in
# $NEDC_NFC/lib and adjusts the permissions
#

# get the current directory of Makefile
#
mkfile_path := $(abspath $(lastword $(MAKEFILE_LIST)))
mkfile_dir := $(dir $(mkfile_path))

# set the variable to the root of folder
#
NEDC_NFC=$(realpath $(mkfile_dir)/../../..)

# define source and object files
#
EEG_DOWNSAMPLE = ./nedc_edf_downsample/nedc_edf_downsample.py
EEG_DOWNSAMPLE_FILE := nedc_edf_downsample.py

EEG_IMAGE = ./nedc_eeg_image/nedc_eeg_image.py
EEG_IMAGE_FILE := nedc_eeg_image.py

EEG_DECODE = ./nedc_resnet_decode/nedc_resnet_decode.py
EEG_DECODE_FILE := nedc_resnet_decode.py

EEG_TRAIN = ./nedc_resnet_train/nedc_resnet_train.py
EEG_TRAIN_FILE := nedc_resnet_train.py

# define an installation target
#
install:
	rm -f $(NEDC_NFC)/lib/$(EEG_DOWNSAMPLE_FILE)
	cp -f $(EEG_DOWNSAMPLE) $(NEDC_NFC)/lib/$(EEG_DOWNSAMPLE_FILE)
	cd $(NEDC_NFC)/lib; chmod u+rwx,g+rwx,o+rx $(EEG_DOWNSAMPLE_FILE)

	rm -f $(NEDC_NFC)/lib/$(EEG_IMAGE_FILE)
	cp -f $(EEG_IMAGE) $(NEDC_NFC)/lib/$(EEG_IMAGE_FILE)
	cd $(NEDC_NFC)/lib; chmod u+rwx,g+rwx,o+rx $(EEG_IMAGE_FILE)

	rm -f $(NEDC_NFC)/lib/$(EEG_DECODE_FILE)
	cp -f $(EEG_DECODE) $(NEDC_NFC)/lib/$(EEG_DECODE_FILE)
	cd $(NEDC_NFC)/lib; chmod u+rwx,g+rwx,o+rx $(EEG_DECODE_FILE)

	rm -f $(NEDC_NFC)/lib/$(EEG_TRAIN_FILE)
	cp -f $(EEG_TRAIN) $(NEDC_NFC)/lib/$(EEG_TRAIN_FILE)
	cd $(NEDC_NFC)/lib; chmod u+rwx,g+rwx,o+rx $(EEG_TRAIN_FILE)

#
# end of file
