#   File:       Makefile
#   Date:       Date: March 2005
#   Revision :   Revision: 1.1 

# shell to use for executing make commands
SHELL = /bin/sh

CC = gcc
					## for linux
CFLAGS = -L./Lib -w
INCLUDE = -I./Include  -Wall
AR = ar
ARCHIVES = ./Lib/libmvcd.a  ./Lib/libmatrixSHEN_1.a   
LIBS = -lm  -lmatrixSHEN_1  -lmvcd   #-lcres
EXEC= ConcatenateDisplacementsLinux ImageDisplacementLinux ResampleDeformationLinux SwitchXYLinux CreateTemplateWithTumorLinux DeformImageLinux 


./%.o: ./%.c
	$(CC) -c $(CFLAGS) $(INCLUDE) $< -o $@

./%.o: ./%.cxx
	$(CC) -c $(CFLAGS) $(INCLUDE) $< -o $@

./%.o: ./%.cpp
	$(CC) -c $(CFLAGS) $(INCLUDE) $< -o $@
	

all :  clobber  $(ARCHIVES)  $(EXEC)  clean	 ##clobber $(ARCHIVES)  ImageDisplacementLinux  clean 

./Lib/libmvcd.a :  mvcd.o
	ar -rv $@ $^
	ranlib $@

./Lib/libmatrixSHEN_1.a :  matrixSHEN_1.o
	ar -rv $@ $^
	ranlib $@
	

##################################################################

ConcatenateDisplacementsLinux: ConcatenateDisplacements.o
	$(CC) $(CFLAGS) $^ -o $@ $(LIBS)


##################################################################

ImageDisplacementLinux: ImageDisplacementPhys.o
	$(CC) $(CFLAGS) $^ -o $@ $(LIBS)


##################################################################

ResampleDeformationLinux: ResampleDeformationFieldCos.o
	$(CC) $(CFLAGS) $^ -o $@ $(LIBS)


##################################################################

SwitchXYLinux: SwitchXY.o
	$(CC) $(CFLAGS) $^ -o $@ $(LIBS)


##################################################################

CreateTemplateWithTumorLinux: CreateTemplateWithTumor.o
	$(CC) $(CFLAGS) $^ -o $@ $(LIBS)


##################################################################


DeformImageLinux: DeformImage.o
	$(CC) $(CFLAGS) $^ -o $@ $(LIBS)


##################################################################

clean :
	rm -rf ./*~ ./*.o 			# $(EXEC)

clobber :
	rm -rf ./*~ ./*.o $(ARCHIVES)	# $(EXEC)

##################################################################


