# # 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=@prefix@ exec_prefix=@exec_prefix@ BINDIR=@bindir@ # where to install the man page MANDIR=@mandir@ # other variables set by ./configure OCAMLC = @OCAMLC@ OCAMLOPT = @OCAMLOPT@ OCAMLDEP = @OCAMLDEP@ OCAMLLEX = @OCAMLLEX@ OCAMLYACC= @OCAMLYACC@ OCAMLLIB = @OCAMLLIB@ OCAMLBEST= @OCAMLBEST@ OCAMLVERSION = @OCAMLVERSION@ OCAMLWEB = @OCAMLWEB@ OCAMLWIN32 = @OCAMLWIN32@ EXE = @EXE@ INCLUDES = BFLAGS = -g $(INCLUDES) OFLAGS = $(INCLUDES) # main target ############# NAME = libnn all: $(OCAMLBEST) # bytecode and native-code compilation ###################################### #MLI = Corpus.mli \ # Env.mli \ # Pattern.mli CMI = $(MLI:.mli=.cmi) ML= Corpus.ml \ Env.ml \ NN.ml \ Pattern.ml CMO = $(ML:.ml=.cmo) CMX = $(CMO:.cmo=.cmx) GENERATED = version.ml byte: $(NAME).byte opt: $(NAME).opt $(NAME).byte: $(CMI) $(CMO) $(OCAMLC) $(BFLAGS) -o $@ $^ $(NAME).opt: $(CMI) $(CMX) $(OCAMLOPT) $(OFLAGS) -o $@ $^ VERSION=0.1 version.ml: Makefile echo "let version = \""$(VERSION)"\"" > version.ml echo "let date = \""`date`"\"" >> version.ml # installation ############## install-indep: mkdir -p $(BINDIR) mkdir -p $(MANDIR)/man1 cp -f $(NAME).1 $(MANDIR)/man1 install: install-indep cp -f $(NAME).$(OCAMLBEST) $(BINDIR)/$(NAME)$(EXE) install-byte: install-indep cp -f $(NAME).byte $(BINDIR)/$(NAME)$(EXE) install-opt: install-indep cp -f $(NAME).opt $(BINDIR)/$(NAME)$(EXE) # documentation ############### # Will be done later #doc: # 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 $< # 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) rm -f $(NAME).byte $(NAME).opt 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