#
# top oofem makefile
#
SHELL      = /bin/bash
BACKUPFILES=.+\.C$$|.+\.cpp$$|.+\.h$$|.+\.in$$|.+\.in\.[0-9]*$$|.+\.tex$$|.+\.el$$|.+\.sty$$|.+\.fig$$.+\.xmgr$$|.+\.eps$$|.+\.ps$$|.+\.pdf$$|.+\.png$$|.+\.shtml$$|makefile$$|do_release|.+\.txt$$|ChangeLog|README|VERSION|.+\.pl$$|.+\.py$$|.+\.cfg$$|.+\.html$$|*.+\.shtml$$|*.+\.img$$|*.+\.id$$|*.+\.src$$|*.+\.shtml$$|intro|mainpage|do_test$$|.+\.in$$|.+\.ctrl$$|.+t3d.in$$|.+t3d.out$$|.+configure$$|.+config.guess$$|.+config.sub$$|.+install.sh$$
EXCLUDEFILES=/\.svn/|/iml/|/targets/

all:
	if [ -d targets/${OOFEM_TARGET} ]; then \
		cd targets/${OOFEM_TARGET}; ${MAKE} OOFEM_TARGET=${OOFEM_TARGET};\
		echo;\
		echo ${OOFEM_TARGET} target done;\
		echo;\
	else\
		echo ;\
		echo Error: ${OOFEM_TARGET} not configured;\
		echo ;\
	fi

clean:
	cd targets/${OOFEM_TARGET}; ${MAKE} OOFEM_TARGET=${OOFEM_TARGET} clean

backup:
	rm -f oofem.tar.gz
	find . | grep -E -e '$(BACKUPFILES)'|grep -v -E -e '$(EXCLUDEFILES)'  > files_to_backup
	tar cvf oofem.tar --files-from files_to_backup
	gzip oofem.tar
