# # 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@ INCLUDES = BFLAGS = -g $(INCLUDES) camomile.cma OFLAGS = $(INCLUDES) camomile.cmxa # main target ############# PROG = escape all: $(OCAMLBEST) # bytecode and native-code compilation ###################################### CMO = escape.cmo CMX = $(CMO:.cmo=.cmx) OBJ = get_enc.o GENERATED = byte: $(PROG).byte opt: $(PROG).opt $(PROG).byte: $(OBJ) $(CMO) $(OCAMLC) $(BFLAGS) -o $@ $^ $(PROG).opt: $(OBJ) $(CMX) $(OCAMLOPT) $(OFLAGS) -o $@ $^ # installation ############## install: mkdir -p $(BINDIR) cp -f $(PROG).$(OCAMLBEST) $(BINDIR)/$(PROG) mkdir -p $(MANDIR)/man1 cp -f $(PROG).1 $(MANDIR)/man1 # generic rules ############### .SUFFIXES: .mli .ml .cmi .cmo .cmx .mll .mly .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 $< .c.o: $(OCAMLC) -c $< # 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/" # myself 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 $(PROG).byte $(PROG).opt rm -f *.aux *.log $(PROG).tex $(PROG).dvi $(PROG).ps # depend ######## .depend depend:: $(GENERATED) rm -f .depend $(OCAMLDEP) $(INCLUDES) *.ml *.mli > .depend include .depend