# THIS SOURCE CODE IS SUPPLIED "AS IS" WITHOUT WARRANTY OF ANY KIND, AND
# ITS AUTHOR AND THE JOURNAL OF ARTIFICIAL INTELLIGENCE RESEARCH (JAIR)
# AND JAIR'S PUBLISHERS AND DISTRIBUTERS, DISCLAIM ANY AND ALL WARRANTIES,
# INCLUDING BUT NOT LIMITED TO ANY IMPLIED WARRANTIES OF MERCHANTABILITY
# AND FITNESS FOR A PARTICULAR PURPOSE, AND ANY WARRANTIES OR NON
# INFRINGEMENT.  THE USER ASSUMES ALL LIABILITY AND RESPONSIBILITY FOR
# USE OF THIS SOURCE CODE AND NEITHER THE AUTHOR NOR JAIR, NOR JAIR'S
# PUBLISHERS AND DISTRIBUTORS, WILL BE LIABLE FOR DAMAMAGES OF ANY KIND
# RESULTING FROM ITS USE.  Without limiting the generality of the
# foregoing, neither the author, nor JAIR, nor JAIR's publishers and
# distributors, warrant that the source code will be error-free, will
# operate without interruption, or will meet the needs of the user.
#*************************************************************************#
#*									 *#
#*		Makefile for the C4.5 induction system			 *#
#*									 *#
#*************************************************************************#


#	Set CFLAGS for your C compiler, e.g.
#
#	  * if you need to debug the programs (sorry about that!)
#	      CFLAGS = -g
#	    (You might also want to reactivate the lint commands that
#	    have been commented out below.)
#
#	  * if your C compiler supports higher optimization levels
#	      CFLAGS = -O3 etc


CFLAGS = -O4


#	Definitions of file sets

core.ln = \
	getnames.ln getdata.ln trees.ln getopt.ln header.ln

trees.ln = \
	postprocess.ln\
	besttree.ln build.ln info.ln discr.ln contin.ln subset.ln\
	prune.ln stats.ln st-thresh.ln classify.ln confmat.ln\
	sort.ln $(core.ln)

rules.ln = \
	rules.ln genlogs.ln genrules.ln makerules.ln prunerule.ln\
	siftrules.ln testrules.ln stats.ln confmat.ln sort.ln $(core.ln)

core = \
	getnames.o getdata.o trees.o getopt.o header.o

trees = \
	postprocess.o\
	besttree.o build.o info.o discr.o contin.o subset.o prune.o\
	stats.o st-thresh.o classify.o confmat.o sort.o $(core)

rules = \
	rules.o genlogs.o genrules.o makerules.o prunerule.o\
	siftrules.o testrules.o stats.o confmat.o sort.o $(core)


#  C4.5 decision tree generator

c4.5:	c4.5.o $(trees)
#	lint -x c4.5.ln $(trees.ln) -lm
	cc -o c4.5 c4.5.o $(trees) -lm

c4.5x:	c4.5.o $(trees)
#	lint -x c4.5.ln $(trees.ln) -lm
	cc -o c4.5x c4.5.o $(trees) -lm

#	(Sample only: for compiler that supports global optimization,
#	 e.g. DECstation 3100)

c4.5gt:
	cat	defns.i types.i\
		c4.5.c\
		postprocess.c\
		besttree.c build.c info.c discr.c contin.c subset.c\
		prune.c stats.c st-thresh.c confmat.c sort.c\
		getnames.c getdata.c classify.c trees.c header.c\
		| egrep -v 'defns.i|types.i|extern.i|buildex.i' >c4.5gt.c
	cc -O4 -o c4.5gt c4.5gt.c -lm
	rm c4.5gt.c


#  C4.5 production rule generator

c4.5rules: c4.5rules.o $(rules)
#	lint -x c4.5rules.ln $(rules.ln) -lm
	cc -o c4.5rules c4.5rules.o $(rules) -lm


#  C4.5 decision tree interpreter

consult: consult.o userint.o $(core)
#	lint -x consult.ln userint.ln $(core.ln) -lm
	cc -o consult consult.o userint.o $(core) -lm


#  C4.5 production rule interpreter

consultr: consultr.o rules.o userint.o $(core)
#	lint -x consultr.ln rules.ln userint.ln $(core.ln) -lm
	cc -o consultr consultr.o rules.o userint.o $(core) -lm


.c.o:
#	lint -c $<
	cc $(CFLAGS) -c $<




#  Make everything

all:
	make c4.5
	make c4.5rules
	make consult
	make consultr
	cc -o xval-prep xval-prep.c -lm
	cc -o average average.c -lm


$(trees): defns.i types.i extern.i
$(rules): defns.i types.i extern.i
