# # 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=@sbindir@ REQUIRES= unix str OCAMLFIND = @OCAMLFIND@ OCAMLC = $(OCAMLFIND) @OCAMLC@ -w p -g -linkpkg -package "$(REQUIRES)" OCAMLOPT = $(OCAMLFIND) @OCAMLOPT@ -w p -linkpkg -package "$(REQUIRES)" OCAMLDEP = @OCAMLDEP@ OCAMLLEX = @OCAMLLEX@ OCAMLYACC= @OCAMLYACC@ OCAMLLIB = @OCAMLLIB@ OCAMLBEST= @OCAMLBEST@ OCAMLVERSION = @OCAMLVERSION@ OCAMLWEB = @OCAMLWEB@ OCAMLWIN32 = @OCAMLWIN32@ EXE = @EXE@ INCLUDES = LIBS=-cclib -lcrypto -cclib -lbz2 CFLAGS= -Wall -I`$(OCAMLFIND) printconf stdlib` -g BFLAGS = -g $(INCLUDES) $(LIBS) OFLAGS = $(INCLUDES) $(LIBS) # main target ############# NAME=lvrouted all: $(OCAMLBEST) $(NAME).opt # bytecode and native-code compilation ###################################### SOURCES = Version.ml LowLevel.ml Common.ml Log.ml Route.ml MAC.ml PrioQueue.ml Tree.ml \ Iface.ml Neighbor.ml CMO = $(SOURCES:.ml=.cmo) CMX = $(SOURCES:.ml=.cmx) GENERATED = Version.ml byte: $(NAME).byte opt: $(NAME).opt $(NAME).byte: $(CMO) lowlevel_c.o $(OCAMLC) $(BFLAGS) -custom -o $@ $(CMO) lowlevel_c.o $(NAME).opt: $(CMX) lvrouted.cmx lowlevel_c.c $(CC) -O2 -Wall -I`$(OCAMLFIND) printconf stdlib` -g -c lowlevel_c.c $(OCAMLOPT) $(OFLAGS) -o $@ $(CMX) lvrouted.cmx lowlevel_c.o $(NAME).prof: $(SOURCES) lowlevel_c.c $(CC) -O2 -p -Wall -I`$(OCAMLFIND) printconf stdlib` -g -c lowlevel_c.c $(OCAMLOPT) $(OFLAGS) -o $@ -p $(SOURCES) lowlevel_c.o test.opt: test.ml $(CMX) lowlevel_c.o $(OCAMLOPT) $(OFLAGS) -o $@ $(CMX) test.ml lowlevel_c.o Version.ml: ../tools/version.sh # installation ############## install-indep: mkdir -p $(BINDIR) 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) # literate programming ###################### $(NAME).tex: $(SOURCES) $(OCAMLWEB) -o $@ $^ # generic rules ############### .SUFFIXES: .mli .ml .cmi .cmo .cmx .mll .mly .tex .dvi .ps .html .c.i: $(CC) -c $(CFLAGS) $< .ml.mli: $(OCAMLC) -i $< > $*.mli .mli.cmi: $(OCAMLC) -c $(BFLAGS) $< .ml.cmo: $(OCAMLC) -c $(BFLAGS) $< .ml.o: $(OCAMLOPT) -c $(OFLAGS) $< .ml.cmx: $(OCAMLOPT) -c $(OFLAGS) $< .ml.s: $(OCAMLOPT) -S -c $(OFLAGS) $< .mll.ml: $(OCAMLLEX) $< .mly.ml: $(OCAMLYACC) -v $< .mly.mli: $(OCAMLYACC) -v $< .tex.dvi: latex $< && latex $< .dvi.ps: dvips $< -o $@ .tex.html: hevea $< # clean ####### clean:: rm -f *.mli *.cm[iox] *.o *~ rm -f $(GENERATED) parser.output rm -f $(NAME).byte $(NAME).opt rm -f *.aux *.log $(NAME).tex $(NAME).dvi $(NAME).ps 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