MAJ terminée. Nous sommes passés en version 14.6.2 . Pour consulter les "releases notes" associées c'est ici :

Commit 404de40c authored by POTTIER Francois's avatar POTTIER Francois
Browse files

Remove demos/obsolete.

parent bc873567
Pipeline #114165 passed with stages
in 25 seconds
# This auxiliary Makefile is meant to be included by a client Makefile in
# addition to Makefile.shared. It is optional. It implements the common case
# where every .mly file in the current directory is to be viewed as a
# mono-module grammar specification.
$(foreach module,$(wildcard *.mly),$(eval $(call menhir_monomodule,$(patsubst %.mly,%,$(module)),)))
# This is the old version of calc-two/Makefile, based on Makefile.shared.
# It has been superseded by the calc-two/Makefile, based on ocamlbuild.
# Find Menhir.
ifndef MENHIR
MENHIR := $(shell ../
# Add --table on the next line to use Menhir's table-based back-end.
PGFLAGS := --infer
GENERATED := tokens.mli algebraic.mli reverse.mli
MODULES := algebraic reverse lexer calc
OCAMLDEPWRAPPER := ../ocamldep.wrapper
include ../Makefile.shared
$(eval $(call menhir_monomodule,tokens,--only-tokens))
$(eval $(call menhir_multimodule,algebraic,tokens.mly algebraic.mly common.mly,--external-tokens Tokens))
$(eval $(call menhir_multimodule,reverse,tokens.mly reverse.mly common.mly,--external-tokens Tokens))
# This Makefile is shared between all demos. It is our suggestion
# of a canonical Makefile for projects that use Objective Caml,
# ocamllex, and menhir. It requires a recent version of GNU make
# (older versions do not correctly implement $(eval)).
# ----------------------------------------------------------------
# This Makefile is meant to be included within a host Makefile
# that defines the following variables:
# GENERATED : a list of the source (.ml and .mli) files
# that should be generated by invoking ocamllex
# or menhir
# MODULES : a list of the modules (without extension)
# that should be linked into the executable
# program. Order is significant.
# EXECUTABLE : the base name of the executables that should
# be produced. Suffixes $(BSUFFIX) and $(OSUFFIX)
# will be added to distinguish the bytecode and
# native code versions.
# ----------------------------------------------------------------
# The host Makefile can also override the following settings:
# Menhir.
ifndef MENHIR
MENHIR := menhir
# Parser generation flags.
ifndef PGFLAGS
PGFLAGS := --infer -v
# Include directives for compilation and for linking.
ifndef INCLUDE
# Bytecode compilation flags.
ifndef BFLAGS
# Native code compilation flags.
ifndef OFLAGS
# Menhir-suggested compilation flags.
SUGG_FLAGS := $(shell $(MENHIR) $(PGFLAGS) --suggest-comp-flags 2>/dev/null)
# Bytecode link-time flags.
# Menhir-suggested bytecode link-time flags.
SUGG_BLNKFLAGS := $(shell $(MENHIR) $(PGFLAGS) --suggest-link-flags-byte 2>/dev/null)
# Native code link-time flags.
# Menhir-suggested native code link-time flags.
SUGG_OLNKFLAGS := $(shell $(MENHIR) $(PGFLAGS) --suggest-link-flags-opt 2>/dev/null)
# Suffix appended to the name of the bytecode executable.
ifndef BSUFFIX
BSUFFIX := .byte
# Suffix appended to the name of the native code executable.
ifndef OSUFFIX
# Access paths.
ifndef OCAML
OCAML := ocaml
ifndef OCAMLC
OCAMLC := $(shell if ocamlfind ocamlc -v >/dev/null 2>&1 ; \
then echo ocamlfind ocamlc ; \
elif ocamlc.opt -v >/dev/null 2>&1 ; \
then echo ocamlc.opt ; \
else echo ocamlc ; fi)
OCAMLOPT := $(shell if ocamlfind ocamlopt -v >/dev/null 2>&1 ; \
then echo ocamlfind ocamlopt ; \
elif ocamlopt.opt -v >/dev/null 2>&1 ; \
then echo ocamlopt.opt ; \
else echo ocamlopt ; fi)
OCAMLDEP := $(shell if ocamlfind ocamldep -version >/dev/null 2>&1 ; \
then echo ocamlfind ocamldep ; \
elif ocamldep.opt -version >/dev/null 2>&1 ; \
then echo ocamldep.opt ; \
else echo ocamldep ; fi)
OCAMLDEPWRAPPER:= ./ocamldep.wrapper
OCAMLLEX := ocamllex
# A list of targets that do not require dependency analysis.
# This variable should be set by the host before including
# this Makefile.
COLD += clean
# ----------------------------------------------------------------
# Do not destroy the generated source files.
# ----------------------------------------------------------------
# Linking.
# ----------------------------------------------------------------
# Compiling.
# We make the .ml and .mli files generated by ocamllex and menhir
# unwritable, so as to prevent them from being edited by mistake.
%.cmi: %.mli %.mli.d
%.cmx %.o:
@if [ -f $@ ] ; then /bin/chmod +w $@ ; fi
@/bin/chmod -w $@
# ----------------------------------------------------------------
# Computing dependencies.
# We associate a tiny Makefile, whose name ends in .d, with every
# source file; it contains dependency information only. For an .ml or
# .mli file, we create an .ml.d or .mli.d file by invoking ocamldep.
# For an .mll file, we create an .ml.d file by invoking ocamllex first
# (this is implicit), then ocamldep.
# When it finds a reference to module M, ocamldep checks whether the
# files and m.mli exist before deciding which dependency to
# report. If and m.mli are generated from m.mll or m.mly, then
# there is a potential problem: because ocamldep is invoked before
# these files are created, it cannot see them. The standard solution
# until now was to invoke ocamllex and ocamlyacc first to create all
# generated files, and run ocamldep next. This approach does not work
# with menhir when the --infer switch is on: menhir cannot be invoked
# first because it needs type information found in .cmi (or .cmo or
# .cmx) files. Our solution is to wrap ocamldep in a script that
# creates fake generated files and m.mli to let ocamldep know that
# these files are supposed to exist. This is somewhat tricky, but appears
# to work.
%.mli.d: %.mli
# All .d files are included within the present Makefile, so it they
# do not exist, they are created first, and the dependencies that
# they contain are then taken into account.
# A .SECONDARY directive is used to ensure that the auxiliary
# Makefiles are never removed. Otherwise, make could create
# one, remove one, create one, remove one, ... (We have observed
# this.)
ifeq ($(findstring $(MAKECMDGOALS),$(COLD)),)
ifneq ($(strip $(wildcard *.mli)),)
.SECONDARY: $(patsubst %.mli,%.mli.d,$(wildcard *.mli))
-include $(patsubst %.mli,%.mli.d,$(wildcard *.mli))
ifneq ($(strip $(wildcard *.ml)),)
.SECONDARY: $(patsubst,,$(wildcard *.ml))
-include $(patsubst,,$(wildcard *.ml))
ifneq ($(strip $(wildcard *.mll)),)
.SECONDARY: $(patsubst %.mll,,$(wildcard *.mll))
-include $(patsubst %.mll,,$(wildcard *.mll))
# ----------------------------------------------------------------
# Support for menhir projects.
# The macro menhir_multimodule defines support for multi-module grammar
# specifications, that is, for producing parsers out of multiple
# source files. The parameter $(1) is the name of the parser that
# should be produced; the parameter $(2) is the list of .mly source
# files; the parameter $(3) contains extra options to be passed to
# menhir.
# The dependency file is named $(1).d and created by invoking menhir
# --depend.
define menhir_multimodule
$(1).ml $(1).mli: $(2) $(1).d
@if [ -f $(1).ml ] ; then /bin/chmod +w $(1).ml ; fi
@if [ -f $(1).mli ] ; then /bin/chmod +w $(1).mli ; fi
$(MENHIR) --ocamlc "$(OCAMLC)" $(PGFLAGS) --base $(1) $(3) $(2)
@/bin/chmod -w $(1).ml $(1).mli
$(1).d: $(2)
@if [ -f $(1).ml ] ; then /bin/chmod +w $(1).ml ; fi
@if [ -f $(1).mli ] ; then /bin/chmod +w $(1).mli ; fi
$(MENHIR) --ocamldep "$(OCAMLDEP)" --depend --base $(1) $(3) $(2) > $$@
ifeq ($$(findstring $$(MAKECMDGOALS),$$(COLD)),)
.SECONDARY: $(1).d
-include $(1).d
# The macro menhir_monomodule defines support for a mono-module grammar
# specification. The parameter $(1) is the name of the parser that
# should be produced; the source file is $(1).mly. The parameter $(2)
# contains extra options to be passed to menhir.
define menhir_monomodule
$(eval $(call menhir_multimodule,$(1),$(1).mly,$(2)))
# Neither of the two macros above is invoked by default, as it is not
# known here which is appropriate. It is up to the client to invoke
# these macros with suitable parameters. The auxiliary
# implements the common case where every .mly file is a mono-module
# grammar.
# ----------------------------------------------------------------
.PHONY: clean
/bin/rm -f *.cmi *.cmx *.cmo *.o *~ .*~ *.automaton *.conflicts *.annot
/bin/rm -f *.d
#!/usr/bin/env ocaml
(* ocamldep.wrapper <filename> ... <filename> - <ocamldep command>
runs the <ocamldep command> in an environment where all of the
<filenames> listed appear to exist. The files are created, if
required, before the command is run, and destroyed afterwards. *)
(* An earlier version of this script acquired a lock, so as to prevent
multiple instances of this script from interfering with one another.
However, this did not prevent interference between this script and
some other process (e.g., the ocaml compiler) which creates files.
So, the lock has been removed. My suggestion is to never use this
script in a concurrent setting. If you wish to use parallel make,
then you might be able to use a two-level Makefile approach: first,
compute all dependencies in a sequential manner; then, construct all
targets in a parallel manner. *)
#load "unix.cma"
open Printf
(* Parse the command line. The arguments that precede "-" are understood
as file names and stored in the list [xs]. The arguments that follow
"-" are understood as a command and stored in [command]. *)
let xs =
ref []
let command =
ref ""
let verbose =
ref false
let rec loop accumulating i =
if i = Array.length Sys.argv then
else if accumulating then
(* [accumulating] is [true] as long as we have not found the "-" marker *)
match Sys.argv.(i) with
| "-v" ->
verbose := true;
loop true (i+1)
| "-" ->
(* We have found the marker. The next parameter should be the name of
the raw [ocamldep] command. Copy it to the command (unquoted --
apparently some shells do not permit quoting a command name). *)
let i = i + 1 in
assert (i < Array.length Sys.argv);
command := Sys.argv.(i);
(* Stop accumulating file names. Copy the remaining arguments into
the command. *)
loop false (i+1)
| _ ->
(* Continue accumulating file names in [xs]. *)
xs := Sys.argv.(i) :: !xs;
loop true (i+1)
else begin
(* After we have found the "-" marker, the remaining arguments are
copied (quoted) into the command. *)
command := sprintf "%s %s" !command (Filename.quote Sys.argv.(i));
loop false (i+1)
let () =
loop true 1
(* Create the required files if they don't exist, run the command,
then destroy any files that we have created. *)
let rec loop = function
| [] ->
if !verbose then
fprintf stderr "ocamldep.wrapper: running %s\n" !command;
Sys.command !command
| x :: xs ->
if Sys.file_exists x then
loop xs
else begin
if !verbose then
fprintf stderr "ocamldep.wrapper: creating fake %s\n" x;
let c = open_out x in
close_out c;
let exitcode = loop xs in
if Sys.file_exists x then begin
if !verbose then
fprintf stderr "ocamldep.wrapper: removing fake %s..." x;
Sys.remove x;
if !verbose then
fprintf stderr " ok\n"
with Sys_error _ ->
if !verbose then
fprintf stderr " failed\n"
let () =
exit (loop !xs)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment