#*** Copyright 2002-2004 The Acute Team
#
#  Allen-Williams, Mair
#  Bishop, Steven
#  Fairbairn, Matthew
#  Habouzit, Pierre [*]
#  Leifer, James [*]
#  Sewell, Peter
#  Sjberg, Vilhelm
#  Steinruecken, Christian
#  Vafeiadis, Viktor
#  Wansbrough, Keith
#  Zappa Nardelli, Francesco [*]
#  Institut National de Recherche en Informatique et en Automatique (INRIA)
#
#  Contributions of authors marked [*] are copyright INRIA.
#
#All rights reserved.
#
#This file is distributed under the terms of the GNU Lesser General
#Public License, with the special exception on linking described in
#file NEW-LICENSE.
#
#***

ifndef FCAMLCP
%:
	@echo ""
	@echo "Please use the parent Makefile, rather than"
	@echo "invoking this one directly (FCAMLCP not defined)"
	@echo ""
	@exit 1
endif


# (not cma anymore, because it looks for -lagraphics at runtime, which doesn't exist)
all: agraphics.cmo agraphics.cmi apervasives.cmo apervasives.cmi apervasives_small.cmo atcp.cmo apervasives_small.cmi

clean:
	rm -f .depend *.cmo *.cmi *.cma

%.cma: %.cmo
	$(FMKLIB) -o $(@:.cma=) $^

%.cmo: %.ml
	$(FCAMLCP) -c $(COMPFLAGS) $(COMPFLAGS_EXTRA) $<

%.cmi: %.mli
	$(FCAMLCP) -c $(COMPFLAGS) $(COMPFLAGS_EXTRA) $<

%.cmo %.cmi: %.ml %.mli
	$(FCAMLCP) -c $(COMPFLAGS) $(COMPFLAGS_EXTRA) $*.mli
	$(FCAMLCP) -c $(COMPFLAGS) $(COMPFLAGS_EXTRA) $*.ml



.PHONY: depend
depend: .depend

.depend: $(wildcard *.ml) $(wildcard *.mli)
	$(FCDEP) $^ >$@-tmp
	mv $@-tmp $@


# we don't build try to include .depend (thereby forcing it to be built) when cleaning up
ifdef MAKECMDGOALS
ifneq ($(MAKECMDGOALS),clean)
ifneq ($(MAKECMDGOALS),tcp-clean)
ifneq ($(MAKECMDGOALS),localclean)
-include .depend
endif
endif
endif
else
-include .depend
endif
