[Omake] Multiple targets with OMake.

Yves Amalric yves.amalric at cea.fr
Mon Jan 29 08:33:38 PST 2007


Hello all,
while managing ocaml modules with omake i need to create
multiple targets e.g. one for the very 'main' program and the
other for some 'test' program.

The 1st solution i chose explcitly described the 2nd target
construction (see the $(TEST_PROGRAM) target) giving something like
the OMakefile below.

At the same time i commented the 'natural like' 2 last lines of
this OMakefile, because of a failure to create the 'test'
target.

Any proposal to get all this clearer, lighter & more efficient ?

Yves Amalric

=======================================================================
Yves Amalric
Res.Eng.
Institut de Technico-Economie des Systemes Energetiques
CEA-SACLAY
DEN/DANS/Itésé
F91191 Gif/Yvette cedex
========================================================================

*****************************************************************************
########################################################################
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this file, to deal in the File without
# restriction, including without limitation the rights to use,
# copy, modify, merge, publish, distribute, sublicense, and/or
# sell copies of the File, and to permit persons to whom the
# File is furnished to do so, subject to the following condition:
#
# THE FILE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
# OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT.
# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
FOR ANY CLAIM,
# DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
CONTRACT, TORT OR
# OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
FILE OR
# THE USE OR OTHER DEALINGS IN THE FILE.

########################################################################
# The standard OMakefile.
# You will usually need to modify this file for your project.

# Delete this line once you have configured this file
# eprintln($(CWD)/OMakefile is not configured)

########################################################################
# Subdirectories.
# You may want to include some subdirectories in this project.
# If so, define the subdirectory targets and uncomment this
section.
#

# .SUBDIRS:


########################################################################
# OCaml configuration.
# Delete this section if you are not building OCaml files.
#

################################################
# Configuration.  You may want to modify any of these
configuration
# variables.
#
OCAMLC = ocamlc
OCAMLOPT = ocamlopt
CAMLP4 = camlp4
OCAMLLEX = ocamllex
OCAMLYACC = menhir --infer --explain --error-recovery  --trace
OCAMLDEP = ocamldep
OCAMLMKTOP = ocamlmktop -I +camlp4
OCAMLLINK = ocamlc
OCAMLOPTLINK = ocamlopt

#
# Include path
#
# OCAMLINCLUDES +=

#
# Compile native or byte code?
#
MENHIR_ENABLED = true
USE_OCAMLFIND = true
BYTE_ENABLED = true
NATIVE_ENABLED = true

#
# Various options
#
OCAMLFLAGS    +=
OCAMLCFLAGS   += -dtypes
OCAMLOPTFLAGS += -p -dtypes
OCAML_LINK_FLAGS +=
MENHIR_FLAGS = --infer --explain --error-recovery  --trace
# OCAML_BYTE_LINK_FLAGS +=
# OCAML_NATIVE_LINK_FLAGS +=

################################################
# Build an OCaml program
#

FILES = timestamp cgi debug util  base mytables  formsyn
formlex primitives session xhtml testeur
MAIN = main
CMO_FILES = timestamp.cmo cgi.cmo debug.cmo util.cmo base.cmo
mytables.cmo formsyn.cmo formlex.cmo primitives.cmo
session.cmo xhtml.cmo testeur.cmo
MAIN_CMO = main.cmo
MAIN_PROGRAM = thesis_cgi
TEST_PROGRAM = testeur.byte
OCAML_LIBS +=
# OCAML_CLIBS +=
OCAML_OTHER_LIBS =
OCAML_LIB_FLAGS += -pp "camlp4o " -I +camlp4
OCAMLPACKS = unix str cgi mysql
OCAMLOPTIONS_ = -package unix -package str -package mysql
-package cgi
OCamlProgram($(MAIN_PROGRAM), $(FILES) $(MAIN))
.DEFAULT: $(MAIN_PROGRAM).run $(MAIN_PROGRAM).opt
# cible supplémentaire pour menhir
.PHONY: clean all install generate_files
# Pour contourner la stupidité d'ocamldep avec les fichiers
générés
generate_files:
	touch lisp_parser.ml lisp_parser.mli lisp_lexer.ml
.SCANNER: scan-ocaml%: generate_files
lisp_lexer.cmo: lisp_parser.ml
# Faire un scanner de .mly avec menhir
.SCANNER: %.ml %.mli: %.mly
	menhir --depend $<
clean:
	$(RM) -vf .omak* *.cm* *.run *.opt *~ *.o *.omc *.annot
calculs_top: $(CMO_FILES) $(MAIN_CMO)
	$(OCAMLFIND) $(OCAMLMKTOP) $(OCAMLOPTIONS_) -linkpkg
$(OCAML_LIBS)  $(CMO_FILES) $(MAIN_CMO) -o $@
$(TEST_PROGRAM): $(CMO_FILES)
		$(OCAMLFIND) $(OCAMLLINK) $(OCAMLOPTIONS_)  -linkpkg
$(OCAML_LIBS)  $(CMO_FILES)  -o $@
#		$(TEST_PROGRAM) -thexpr '?LETREC factorielle (n) = IF n = 0
THEN 1 ELSE n * factorielle(n - 1) IN factorielle(5)'
#test: $(TEST_PROGRAM)
#	./scriptest


*****************************************************************************


Envoyez vos cartes de voeux depuis www.laposte.net
Elles seront ensuite distribuées par le facteur : pratique et
malin !



Envoyez vos cartes de voeux depuis www.laposte.net
Elles seront ensuite distribuées par le facteur : pratique et malin !

-------------- next part --------------
A non-text attachment was scrubbed...
Name: yves.amalric.vcf
Type: text/x-vcard
Size: 388 bytes
Desc: not available
Url : http://lists.metaprl.org/pipermail/omake/attachments/20070129/2e7af5e9/yves.amalric-0001.vcf


More information about the Omake mailing list