# Generated automatically from Makefile.in by configure.
#
# sample Makefile for Objective Caml
# Copyright (C) 2001 Jean-Christophe FILLIATRE
# 
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Library General Public
# License version 2, as published by the Free Software Foundation.
# 
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# 
# See the GNU Library General Public License version 2 for more details
# (enclosed in the file LGPL).

# where to install the binaries
prefix=/usr/local
exec_prefix=${prefix}
BINDIR=${exec_prefix}/bin

# where to install the man page
MANDIR=${prefix}/man

# other variables set by ./configure
OCAMLC   = ocamlc.opt
OCAMLOPT = ocamlopt.opt
OCAMLDEP = ocamldep
OCAMLLEX = ocamllex.opt
OCAMLYACC= ocamlyacc
OCAMLLIB = /usr/lib/ocaml
OCAMLBEST= opt
OCAMLVERSION = 3.04
OCAMLWEB = ocamlweb
OCAMLWIN32 = no
EXE = 

INCLUDES = 
BFLAGS = -g $(INCLUDES)
OFLAGS = -unsafe -inline 1000 $(INCLUDES)

# main target
#############

all: runme.byte server

# bytecode and native-code compilation
######################################

CMO = ptset.cmo connect.cmo board.cmo algo.cmo strategy.cmo  main.cmo
CMX = $(CMO:.cmo=.cmx)

GENERATED = 

runme.byte: $(CMO)
	$(OCAMLC) $(BFLAGS) -o $@ str.cma unix.cma $^

runme: $(CMX)
	$(OCAMLOPT) $(OFLAGS) -cclib -static -o $@ str.cmxa unix.cmxa $^
	strip ./runme
	cp -f runme ..

server: server.ml
	$(OCAMLC) $(BFLAGS) -o $@ unix.cma $^

### export for submission

EXPORTNAME=neanderthal

export: runme
	make clean
	cd ../export; rm -rf $(EXPORTNAME) || true
	cd ..; mkdir -p export/$(EXPORTNAME); \
	  cp -f README buildme runme export/$(EXPORTNAME); \
	  cp -rf source export/$(EXPORTNAME); \
	  cd export/$(EXPORTNAME)/source; rm -rf CVS 
	cd ../export; tar zcf $(EXPORTNAME).tar.gz $(EXPORTNAME); \
	  echo -n "Size: " > $(EXPORTNAME).txt; \
	  wc -c $(EXPORTNAME).tar.gz >> $(EXPORTNAME).txt; \
	  echo -n "MD5:  " >> $(EXPORTNAME).txt; \
	  md5sum $(EXPORTNAME).tar.gz >> $(EXPORTNAME).txt

# generic rules
###############

.SUFFIXES: .mli .ml .cmi .cmo .cmx .mll .mly .tex .dvi .ps .html

.mli.cmi:
	$(OCAMLC) -c $(BFLAGS) $<

.ml.cmo:
	$(OCAMLC) -c $(BFLAGS) $<

.ml.o:
	$(OCAMLOPT) -c $(OFLAGS) $<

.ml.cmx:
	$(OCAMLOPT) -c $(OFLAGS) $<

.mll.ml:
	$(OCAMLLEX) $<

.mly.ml:
	$(OCAMLYACC) -v $<

.mly.mli:
	$(OCAMLYACC) -v $<

.tex.dvi:
	latex $< && latex $<

.dvi.ps:
	dvips $< -o $@ 

.tex.html:
	hevea $<

# Emacs tags
############

tags:
	find . -name "*.ml*" | sort -r | xargs \
	etags "--regex=/let[ \t]+\([^ \t]+\)/\1/" \
	      "--regex=/let[ \t]+rec[ \t]+\([^ \t]+\)/\1/" \
	      "--regex=/and[ \t]+\([^ \t]+\)/\1/" \
	      "--regex=/type[ \t]+\([^ \t]+\)/\1/" \
              "--regex=/exception[ \t]+\([^ \t]+\)/\1/" \
	      "--regex=/val[ \t]+\([^ \t]+\)/\1/" \
	      "--regex=/module[ \t]+\([^ \t]+\)/\1/"

# Makefile is rebuilt whenever Makefile.in or configure.in is modified
######################################################################

Makefile: Makefile.in config.status
	./config.status

config.status: configure
	./config.status --recheck

configure: configure.in
	autoconf 

# clean
#######

clean::
	rm -f *.cm[iox] *.o *~
	rm -f $(GENERATED) parser.output
	rm -f $(NAME).byte $(NAME).opt
	rm -f *.aux *.log $(NAME).tex $(NAME).dvi $(NAME).ps
	rm -f runme.byte runme server

dist-clean distclean:: clean
	rm -f Makefile config.cache config.log config.status

# depend
########

.depend depend:: $(GENERATED)
	rm -f .depend
	$(OCAMLDEP) $(INCLUDES) *.ml *.mli > .depend

include .depend
