# file: $(NEDC_NFC)/src/util/shell/Makefile
#
# revision history:
#
# 20221216 (ML): initial version
#
# This Makefile builds all the bash script in this directory and place it
# in ./bin of the root directory
#

# 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_RESNET = nedc_eeg_resnet.sh
EEG_RESNET_BFILE := $(basename $(EEG_RESNET))

EEG_ENV = nedc_eeg_resnet_env.sh
EEG_ENV_BFILE := $(basename $(EEG_ENV))

EEG_TRAIN = nedc_eeg_resnet_train.sh
EEG_TRAIN_BFILE := $(basename $(EEG_TRAIN))

EEG_DECODE = nedc_eeg_resnet_decode.sh
EEG_DECODE_BFILE := $(basename $(EEG_DECODE))

EEG_SCORE = nedc_eeg_score.sh
EEG_SCORE_BFILE := $(basename $(EEG_SCORE))

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

	rm -f $(NEDC_NFC)/bin/$(EEG_ENV_BFILE)
	cp -f $(EEG_ENV) $(NEDC_NFC)/bin/$(EEG_ENV_BFILE)
	cd $(NEDC_NFC)/bin; chmod u+rwx,g+rwx,o+rx $(EEG_ENV_BFILE)

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

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

	rm -f $(NEDC_NFC)/bin/$(EEG_SCORE_BFILE)
	cp -f $(EEG_SCORE) $(NEDC_NFC)/bin/$(EEG_SCORE_BFILE)
	cd $(NEDC_NFC)/bin; chmod u+rwx,g+rwx,o+rx $(EEG_SCORE_BFILE)

#
# end of file
