# Makefile for DPS to MOSFLM, Harry Powell
#
# This goes in the top level directory of the MOSFLM distribution with DPS
# indexing.
#
# This has been tested under OSF on an Alpha, Irix 5.3 and 6.2 on SGI, and
# Linux on a Pentium PC. The expected "HOSTTYPE"s are "alpha", "iris4d", 
# "iris4d6.4"
# and "i386-linux" (linked to i486-linux). It's possible that you might have to 
# include another type for MOSFLM to build on your system.
# 
#-----------------------------------------------------------------------------
#

#ifndef CCP4_LIB
#define CCP4_LIB ${CLIB}
#endif
DPS        = ${PWD}
DPSFLAG    = "DPS = ${DPS}"

all:	
	@echo "****************************************************************"
	@echo "             Making libraries for system ${HOSTTYPE}"
	@echo "****************************************************************"
	make libs
	@echo "****************************************************************"
	@echo "           Making IPMOSFLM for system ${HOSTTYPE}"
	@echo "****************************************************************"
	cd mosflm ; make -f Makefile.${HOSTTYPE} mosflm ${DPSFLAG}

##########################################################################
#                                                                        #
# NOTE WELL! Digital UNIX, OSF/1, Linux don't need the -print for "find" #
#            to work properly below, but IRIX does!                      #
#                                                                        #
##########################################################################
libs:
	rm -f `find ./index -name "*.a" -print`
	rm -f `find ./src -name "*.a" -print`
	rm -f `find ./lib -name "*.a" -print`
	rm -f `find ./util -name "*.a" -print`
	cd index ; make -f Makefile.${HOSTTYPE} ${DPSFLAG}
	rm -f `find ./cbf -name "*.a" -print`
	cd cbf ; make -f Makefile.${HOSTTYPE}

force:
	rm bin/mosflm
	make mosflm

mosflm: lib/DPSLIB.a cbf/lib/libcbf.a
	cd mosflm ; make -f Makefile.${HOSTTYPE} mosflm ${DPSFLAG}

clean:
	rm -f `find . -name "*.o" -print`

realclean:
	rm -f `find . -name "*.a" -print`
	rm -f `find . -name "*.o" -print`
	rm -f `find . -name "*~" -print`
	rm -f bin/mosflm
