#
# Makefile 1.00 Peter Braam <braam@cs.cmu.edu>
#

include config.mk

SUBDIR:=linux$(UTS_SHORT)

help all:
	@echo "Pick one of the following targets:"
	@echo -e "\tmake config\t\t- configure and check system setup"
	@echo -e "\tmake coda.o\t\t- build Coda module"
	@echo -e "\tmake install\t\t- install Coda module"
	@echo -e "\tmake clean\t\t- clean up the directory"

config .prereq.ok:
	@./Configure

kcheck:
	@. config.out ; \
	if [ "$$CHECK" != "" ] ; then \
	    if [ "`cksum < $$CHECK`" != "$$CKSUM" ] ; then \
		/bin/echo -n "Kernel configuration has changed." ; \
		/bin/echo "  Please re-run 'make config'." ; \
		exit 1 ; \
	    fi ; \
	fi

coda.o: .prereq.ok
	( cd $(SUBDIR) ; make )

install: .prereq.ok
	( cd $(SUBDIR) ; make install ) 

clean:
	cd linux2.0 ; rm -f core core.* *.o .*.o *.s *.a *~ .depend .depfiles/*.d
	cd linux2.2 ; rm -f core core.* *.o .*.o *.s *.a *~ .depend .depfiles/*.d
	cd linux2.4 ; rm -f core core.* *.o .*.o *.s *.a *~ .depend .depfiles/*.d

distclean: clean
	rm -rf .prereq.ok config.out linux2.0/.depfiles linux2.2/.depfiles
	( cd linux2.2 ; make clean )
	( cd linux2.0 ; make clean )
