#
#  PROJECT
#      CSV Library (Libcsv)
#
#  DESCRIPTION
#      The top-level Makefile
#
#  DEVELOPER
#      Scott C. Karlin   (scott@cs.princeton.edu)
#
#  HISTORY
#      24 Apr 2003  sck  Initial Version
#      23 May 2003  sck  Added test subdirectory
#
#  CVS ID
#      $Id: Makefile,v 1.2 2003/05/23 17:05:53 scott Exp $
#

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

SUBDIRS = src test

##############################################################################
#
#  The Shell
#
SHELL = /bin/sh

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

.PHONY : all install clean veryclean distclean


define submake
	for i in $(SUBDIRS); do \
	   if [ -f $$i/Makefile ]; then \
	      (cd $$i; ${MAKE} $@); \
	   fi \
	done
endef



all:	install


install:
	@$(submake)

clean:
	@$(submake)

veryclean:
	@$(submake)

distclean:
	@$(submake)


##############################################################################
#
#  Sanity check that we are not trying to simultaneously build and clean
#
ifeq ($(findstring all,$(MAKECMDGOALS)),all)            #  *all
ifeq ($(findstring clean,$(MAKECMDGOALS)),clean)        #  *clean
$(error Cannot simultaneously build/install and clean)
endif
endif

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