caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* otags and OMakefile
@ 2006-08-10 16:13 Sam Steingold
  2006-08-11  5:56 ` [Caml-list] " Nathaniel Gray
  2006-08-11 13:53 ` Hendrik Tews
  0 siblings, 2 replies; 4+ messages in thread
From: Sam Steingold @ 2006-08-10 16:13 UTC (permalink / raw)
  To: caml-list

what is the correct entry for TAGS in OMakefile?

I have this in the top-level OMakefile:
------------------------------------------------------------------
TAGS:
	otags -r $(SRC_DIRS)
------------------------------------------------------------------
(where SRC_DIRS are also the dependencies of .SUBDIRS).
this is deficient for 2 reasons:

1. somehow otags tries to read non-ml files (despite "otags -h" claiming 
that suffixes are [.mli; .ml]) and fails on especially large ones:
------------------------------------------------------------------
otags: Unix error
   Syscall: stat
   Arg:     ./run/scan/top-20060612.log
   Error:   Value too large for defined data type
------------------------------------------------------------------

2. otags does not respect the pre-processors used for some files, 
resulting in many errors:
------------------------------------------------------------------
File "", line 15, characters 0-4:
Parse error: [implem] expected after [str_item_semi] (in [implem])
Uncaught exception: Stream.Error("[implem] expected after 
[str_item_semi] (in [implem])")
File "", line 12, characters 0-4:
Parse error: [implem] expected after [str_item_semi] (in [implem])
Uncaught exception: Stream.Error("[implem] expected after 
[str_item_semi] (in [implem])")
File "", line 12, characters 0-4:
Parse error: [implem] expected after [str_item_semi] (in [implem])
Uncaught exception: Stream.Error("[implem] expected after 
[str_item_semi] (in [implem])")
File "", line 10, characters 0-4:
Parse error: [implem] expected after [str_item_semi] (in [implem])
Uncaught exception: Stream.Error("[implem] expected after 
[str_item_semi] (in [implem])")
File "", line 11, characters 39-43:
Parse error: [implem] expected after [str_item_semi] (in [implem])
Uncaught exception: Stream.Error("[implem] expected after 
[str_item_semi] (in [implem])")
------------------------------------------------------------------
despite this, a valid TAGS file is created.
the preprocessing is specified in OMakeroot:
------------------------------------------------------------------
# Preprocess OCaml-files with a given OCaml-preprocessor
OCamlMakePPDeps(pps, names) =
   pp_cmos = $(addsuffix .cmo, $(pps))
   deps =
   foreach(pp_cmo, $(pp_cmos))
     deps += $(OCamlAddLibDir $(pp_cmos))
     export deps
   pp_cmd = camlp4o $(PREFIXED_OCAMLINCLUDES) $(pp_cmos)
   OCAMLPPFLAGS = -pp "$(pp_cmd)"
   OCAMLDEPFLAGS = $(OCAMLPPFLAGS)
   foreach(name, $(names))
     tgts = $(addsuffixes .cmi .cmo .cmx .o, $(name))
     scan_deps = scan-ocaml-$(name).ml scan-ocaml-$(name).mli
     Capture_deps(__ENV, \
       OCAMLPPFLAGS OCAMLDEPFLAGS, $(tgts), $(deps), $(scan_deps))
     tgts = $(addsuffix .auto.mli, $(name))
     Capture_deps(__ENV, \
       OCAMLPPFLAGS OCAMLDEPFLAGS, $(tgts), $(deps), $(scan_deps))
     export __ENV
   export __ENV
------------------------------------------------------------------
and in OMakefile:
------------------------------------------------------------------
OCamlMakePPDeps(pa_sexp_conv, foo bar baz)
------------------------------------------------------------------

so, how do I make ocaml TAGS?


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Caml-list] otags and OMakefile
  2006-08-10 16:13 otags and OMakefile Sam Steingold
@ 2006-08-11  5:56 ` Nathaniel Gray
  2006-08-11 13:53 ` Hendrik Tews
  1 sibling, 0 replies; 4+ messages in thread
From: Nathaniel Gray @ 2006-08-11  5:56 UTC (permalink / raw)
  To: Sam Steingold; +Cc: caml-list

On 8/10/06, Sam Steingold <sds@gnu.org> wrote:
> what is the correct entry for TAGS in OMakefile?

Well, OMake doesn't have any special support for otags, so the first
question is, can you build the tags file outside of OMake?

> I have this in the top-level OMakefile:
> ------------------------------------------------------------------
> TAGS:
>         otags -r $(SRC_DIRS)
> ------------------------------------------------------------------
> (where SRC_DIRS are also the dependencies of .SUBDIRS).
> this is deficient for 2 reasons:
>
> 1. somehow otags tries to read non-ml files (despite "otags -h" claiming
> that suffixes are [.mli; .ml]) and fails on especially large ones:
> ------------------------------------------------------------------
> otags: Unix error
>    Syscall: stat
>    Arg:     ./run/scan/top-20060612.log
>    Error:   Value too large for defined data type
> ------------------------------------------------------------------

The otags author(s) will have to answer that one.

> 2. otags does not respect the pre-processors used for some files,
> resulting in many errors:

Does otags get called with -pp flags?

> despite this, a valid TAGS file is created.

But surely it is incomplete.

> the preprocessing is specified in OMakeroot:
> ------------------------------------------------------------------
> # Preprocess OCaml-files with a given OCaml-preprocessor
> OCamlMakePPDeps(pps, names) =
>    pp_cmos = $(addsuffix .cmo, $(pps))
>    deps =
>    foreach(pp_cmo, $(pp_cmos))
>      deps += $(OCamlAddLibDir $(pp_cmos))
>      export deps
>    pp_cmd = camlp4o $(PREFIXED_OCAMLINCLUDES) $(pp_cmos)
>    OCAMLPPFLAGS = -pp "$(pp_cmd)"
>    OCAMLDEPFLAGS = $(OCAMLPPFLAGS)
>    foreach(name, $(names))
>      tgts = $(addsuffixes .cmi .cmo .cmx .o, $(name))
>      scan_deps = scan-ocaml-$(name).ml scan-ocaml-$(name).mli
>      Capture_deps(__ENV, \
>        OCAMLPPFLAGS OCAMLDEPFLAGS, $(tgts), $(deps), $(scan_deps))
>      tgts = $(addsuffix .auto.mli, $(name))
>      Capture_deps(__ENV, \
>        OCAMLPPFLAGS OCAMLDEPFLAGS, $(tgts), $(deps), $(scan_deps))
>      export __ENV
>    export __ENV
> ------------------------------------------------------------------
> and in OMakefile:
> ------------------------------------------------------------------
> OCamlMakePPDeps(pa_sexp_conv, foo bar baz)
> ------------------------------------------------------------------

I'm not enough of an OMake guru to comment on this, so I'll just say
again that you should make sure you know how to get the result you
want outside of OMake before you worry about how to do it inside of
OMake.

Cheers,
-n8

-- 
>>>-- Nathaniel Gray -- Caltech Computer Science ------>
>>>-- Mojave Project -- http://mojave.cs.caltech.edu -->


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Caml-list] otags and OMakefile
  2006-08-10 16:13 otags and OMakefile Sam Steingold
  2006-08-11  5:56 ` [Caml-list] " Nathaniel Gray
@ 2006-08-11 13:53 ` Hendrik Tews
  2006-08-16 15:51   ` Sam Steingold
  1 sibling, 1 reply; 4+ messages in thread
From: Hendrik Tews @ 2006-08-11 13:53 UTC (permalink / raw)
  To: Sam Steingold; +Cc: caml-list

Sam Steingold <sds@gnu.org> writes:

   what is the correct entry for TAGS in OMakefile?
   
   I have this in the top-level OMakefile:
   ------------------------------------------------------------------
   TAGS:
   	otags -r $(SRC_DIRS)
   ------------------------------------------------------------------

This only works in simple cases (and, apparently, your case is
not simple).

   1. somehow otags tries to read non-ml files (despite "otags -h"

It does a Unix.stat on the files before filtering, which only
works for files smaller 1GB. 

Granted, this is a bug.

   2. otags does not respect the pre-processors used for some files,
   resulting in many errors:

You have to specify the preprocessors on the otags command line, like

   otags -pa pr_r.cmo revised.ml

You might have to add -libdir dir_of_camlp4_module.

   the preprocessing is specified in OMakeroot:

I have no idea about OMakefile, but I doubt it can work as you
expected. What you have to (or OMakefile would have) is the
following:
- collect the source files in equivalence sets according to the needed
  preprocessors 
- invoke otags on each such set separately with the right set of
  -pa options
- concat the results 

(With -v you can see the camlp4 calls that do the real job. )

Bye,

Hendrik Tews


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: otags and OMakefile
  2006-08-11 13:53 ` Hendrik Tews
@ 2006-08-16 15:51   ` Sam Steingold
  0 siblings, 0 replies; 4+ messages in thread
From: Sam Steingold @ 2006-08-16 15:51 UTC (permalink / raw)
  To: caml-list; +Cc: caml-list

Hendrik Tews wrote:
> Sam Steingold <sds@gnu.org> writes:
> 
>    1. somehow otags tries to read non-ml files (despite "otags -h"
> 
> It does a Unix.stat on the files before filtering, which only
> works for files smaller 1GB. 
> 
> Granted, this is a bug.

thank you.
another instance of the same bug:

otags: Fatal error
Fatal error: exception Failure("Invalid argument: foo (named pipe)")

Sam.


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2006-08-17  3:46 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-08-10 16:13 otags and OMakefile Sam Steingold
2006-08-11  5:56 ` [Caml-list] " Nathaniel Gray
2006-08-11 13:53 ` Hendrik Tews
2006-08-16 15:51   ` Sam Steingold

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).