#:ts=8
#
# $Id: Makefile,v 0.27 1995/01/20 15:13:21 cncl-adm Exp cncl-adm $
#
# Makefile CNCL bin
#
TOPDIR	= ..

include $(TOPDIR)/make.conf


PROGS = CNgenclass CNarray CNarray2 CNhier

# Comment if you con't want to build the fuzzy rule compiler
FUZZYDIR= fuzzy
# Comment if you don't want to build the SDL to C++ compiler
# (not yet ready!)
#SDLDIR	= sdl

SUBDIRS	= $(FUZZYDIR) $(SDLDIR)


all:	$(PROGS) subdirs

subdirs:
	for d in $(SUBDIRS); do \
	  (cd $$d && echo $$d && $(MAKE) all) || exit; \
	done

CNgenclass:	CNgenclass.pl
	./findperl >CNgenclass
	tail +2 CNgenclass.pl | \
	    sed -e 's:<INCDIR>:$(includedir):g' >>CNgenclass
	chmod +x CNgenclass

CNarray:	CNarray.pl
	./findperl >CNarray;
	tail +2 CNarray.pl | \
	    sed -e 's:<INCDIR>:$(includedir):g' >>CNarray; \
	chmod +x CNarray

CNarray2:	CNarray2.pl
	./findperl >CNarray2;
	tail +2 CNarray2.pl | \
	    sed -e 's:<INCDIR>:$(includedir):g' >>CNarray2; \
	chmod +x CNarray2

CNhier:		CNhier.pl
	./findperl >CNhier;
	tail +2 CNhier.pl | \
	    sed -e 's:<INCDIR>:$(includedir):g' >>CNhier; \
	chmod +x CNhier

lib:
	(cd ..; make lib)

veryclean::
	rm -f $(PROGS)

templates:: $(PROGS)

clean veryclean templates depend::
	for d in $(SUBDIRS); do (cd $$d; echo $$d; $(MAKE) $@); done
	for d in $(SUBDIRS); do (cd $$d/test; echo $$d/test; $(MAKE) $@); done

sub-rcs-ci::
	for d in $(SUBDIRS); do (cd $$d; echo $$d; $(MAKE) $@); done

install:
	for d in $(SUBDIRS); do (cd $$d; echo $$d; $(MAKE) install); done
	cp $(PROGS) $(bindir)

tests:
	for d in $(SUBDIRS); do \
	  (cd $$d/test && echo $$d/test && $(MAKE) all) || exit; \
	done

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