#:ts=8
#
# $Id: Makefile,v 0.33 1995/08/23 21:29:12 steppler Exp $
#
# Makefile CNCL lib
#
TOPDIR	= ..

include $(TOPDIR)/make.conf

OBJS	= CNCL.o Object.o Class.o Param.o

FILES	= CNCL.c CNCL.h Class.c Class.h Makefile Object.c Object.h Param.c \
	Param.h Template.cP Template.hP minmax.h

# Comment if you don't want the UNIX specific classes
UNIXDIR = unix
# Comment if you don't want the ezd interface classes
EZDDIR  = ezd
# Comment if you don't want the fuzzy logic classes
FUZZYDIR= fuzzy
# Comment if you don't want the GNU libg++ specific classes
# and the GIST interface
GISTDIR = gnu gist

SUBDIRS	= stat container random misc events array persistent\
	  $(UNIXDIR) $(EZDDIR) $(FUZZYDIR) $(GISTDIR)
TESTDIRS= . $(SUBDIRS)

LIBCNCL	= libcncl.a
LIBCNCLG= libcncl_g.a
LIBCNCLP= libcncl_p.a

objs:	$(OBJS)

all:	objs all-src lib

lib:	$(LIBCNCL)

lib_o:
	$(MAKE) all DEBUG="-O6 -Wall"    LIBCNCL=$(LIBCNCL)

lib_g:
	$(MAKE) all DEBUG="-g -Wall"     LIBCNCL=$(LIBCNCLG)

lib_p:
	$(MAKE) all DEBUG="$(DEBUG) -pg" LIBCNCL=$(LIBCNCLP)

$(LIBCNCL)::
	rm -f $(LIBCNCL)
	$(AR) rv $(LIBCNCL) *.o
	for d in $(SUBDIRS); do \
	  if [ -d $$d ]; then \
	    ar rv $(LIBCNCL) $$d/*.o || exit; \
	  fi \
	done
	$(RANLIB) $(LIBCNCL)

clean-tests clean-test::	all-clean-test

clean-lib:
	rm -f libcncl*.a

veryclean distclean::	clean-lib

install::	install-h install-lib install-lib_g install-lib_p

install-h:
	-mkdir $(includedir)/CNCL
	cp *.h $(includedir)/CNCL
	cp ../config.h $(includedir)/CNCL
	cp Template.hP Template.cP $(includedir)/CNCL

install-lib:
	-if [ -f $(LIBCNCL) ]; then \
		cp $(LIBCNCL) $(libdir); \
		(cd $(libdir); $(RANLIB) $(LIBCNCL)); \
	fi

install-lib_g:
	-if [ -f $(LIBCNCLG) ]; then \
		cp $(LIBCNCLG) $(libdir); \
		(cd $(libdir); $(RANLIB) $(LIBCNCLG)); \
	fi

install-lib_p:
	-if [ -f $(LIBCNCLP) ]; then \
		cp $(LIBCNCLP) $(libdir); \
		(cd $(libdir); $(RANLIB) $(LIBCNCLP)); \
	fi

# Common stuff
include $(TOPDIR)/make.subdirs
