#
#	This is Sub Makefile for Add Background to Image.
#

#### Input extention ####
# Defined at Main

#### Suffixes rule ####
.SUFFIXES: .$(NUL) .$(IN_BACK) .$(BACK)

#### INCLUDE ####
-include ${EOS_HOME}/tutorial/TIPS/NulImage/Makefile/Makefile-lib

#### Definition ####
# Defined at Main

# For TIPS/NulImage/Makefile.config
NUL_FILE_NAME=$(BACK_FILE_NAME)
NUL_SIZE_X=$(BACK_IN_SIZE_X)
NUL_SIZE_Y=$(BACK_IN_SIZE_Y)
NUL_SIZE_Z=$(BACK_IN_SIZE_Z)
NUL_VALUE=$(BACK_IN_VALUE)
NUL_LENGTH=$(BACK_LENGTH)


#### Rules of the list created ####


##### Commands #####
IniBackImage::
	export NUL=$(IN_BACK); \
	make NulImage;

BackImage::
	make $(BACK_FILE_NAME).$(BACK);

help_BackImage::
	@echo
	@echo "BackImage"
	@echo "This is Sub Makefile for Add Background to Image."
	@echo
	@echo "	(Command):"
	@echo "		IniBackImage:		Create Inner of Background Image."
	@echo "		BackImage:		Add Background to Image."
	@echo
	@echo "	(Setting Data):"
	@echo "		BACK_FILE_NAME:		filename of input and output"
	@echo "		IN_BACK:		extention of input"
	@echo "		BACK:			extention of output"
	@echo "		BACK_IN_SIZE_X:		Nx of inner of output"
	@echo "		BACK_IN_SIZE_Y:		Ny of inner of output"
	@echo "		BACK_IN_SIZE_Z:		Nz of inner of output"
	@echo "		BACK_IN_VALUE:		value of inner of output"
	@echo "		BACK_SIZE_X:		Nx of output"
	@echo "		BACK_SIZE_Y:		Ny of output"
	@echo "		BACK_SIZE_Z:		Nz of output"
	@echo "		BACK_VALUE:		value of output"
	@echo "		BACK_LENGTH:		length of output"

##### Commands(Input to Output) #####
ifdef IN_BACK
ifdef BACK
.$(IN_BACK).$(BACK):
	$(ENV_SWITCH)mrcImage3DPad -i $*.$(IN_BACK) -o $*.$(BACK) -M 1 -v $(BACK_VALUE) \
						-Nx $(BACK_SIZE_X) -Ny $(BACK_SIZE_Y) -Nz $(BACK_SIZE_Z);
endif #BACK
endif #IN_BACK
