OCAMLDEP(1)
π OCAMLDEP(1) π
okay bestie, welcome to the OCAMLDEP(1) page, straight outta the General Commands Manual β¨ this is your girl's guide to the dependency generator for OCaml, and yes we're gonna make make behave. sit down, grab a boba π§
πΈ NAME πΈ
ocamldep β the Dependency generator for OCaml. that's it, that's the whole vibe. she scans your code and tells make what depends on what π«Ά
β¨ SYNOPSIS β¨
ocamldep [ options ] filename ...
π¦ DESCRIPTION π¦
so the ocamldep(1) command scans a whole set of OCaml source files (that's your .ml and .mli files, mwah) looking for references to external compilation units, and then it spits out dependency lines in a format that the make(1) utility can actually eat for breakfast. π
and why do we care, you ask? because this is literally what ensures make compiles your source files in the correct order, and recompiles the files that need it when a source file gets modified. no cap. π₯
the typical usage is giving:
ocamldep options *.mli *.ml > .depend
where .depend is the file that should contain the dependencies. iconic behavior honestly π
and here's the tea: dependencies are generated both for compiling with the bytecode compiler ocamlc(1) and with the native-code compiler ocamlopt(1). equal opportunity dependency generation, we love to see it. π
π OPTIONS π
the following command-line options are recognized by ocamldep(1). yes, there are a lot. we're going through all of them. hydration check, then let's go π§
-absnameβ show absolute filenames in error messages. no more mystery relative paths bestie.-no-absnameβ do not try to show absolute filenames in error messages. this is the default, btw.-allβ generate dependencies on all required files, rather than assuming implicit dependencies. give me everything, thank you.-allow-approxβ allow falling back on a lexer-based approximation when parsing fails. it's giving "plan B but make it β¨workβ¨".-as-mapβ for the following files, do not include delayed dependencies for module aliases. this option assumes that they are compiled using options-no-alias-deps -w -49, and that those files or their interface are passed with the-mapoption when computing dependencies for other files. note also that for dependencies to be correct in the implementation of a map file, its interface should not coerce any of the aliases it contains. okay that was a lot, but every word matters, periodt.-debug-mapβ dump the delayed dependency map for each map file. detective mode activated π-I directoryβ add the given directory to the list of directories searched for source files. if a source filefoo.mlmentions an external compilation unitBar, a dependency on that unit's interfacebar.cmiis generated only if the source forbaris found in the current directory or in one of the directories specified with-I. otherwise,Baris assumed to be a module from the standard library, and no dependencies are generated. for programs that span multiple directories, it is recommended to passocamldep(1)the same-Ioptions that are passed to the compiler. (yes, the compiler. match her energy π)-nocwdβ do not add the current working directory to the list of include directories.-impl fileβ processfileas a.mlfile. treat it like the implementation file it is.-intf fileβ processfileas a.mlifile. interface girlies rise π-keywords version+listβ set keywords according to theversion+listspecification.-map fileβ read and propagate the delayed dependencies for module aliases infile, so that the following files will depend on the exported aliased modules if they use them.-ml-synonym .extβ consider the given extension (with leading dot) to be a synonym for.ml.-mli-synonym .extβ consider the given extension (with leading dot) to be a synonym for.mli.-modulesβ output raw dependencies of the formfilename: Module1 Module2 ... ModuleNwhereModule1, ...,ModuleNare the names of the compilation units referenced within the filefilename, but these names are not resolved to source file names. such raw dependencies cannot be used bymake(1), but can be post-processed by other tools such asOmake(1). so like, raw and unfiltered, iykyk.-nativeβ generate dependencies for a pure native-code program (no bytecode version). when an implementation file (.mlfile) has no explicit interface file (.mlifile),ocamldep(1)generates dependencies on the bytecode compiled file (.cmofile) to reflect interface changes. this can cause unnecessary bytecode recompilations for programs that are compiled to native-code only. the flag-nativecauses dependencies on native compiled files (.cmx) to be generated instead of on.cmofiles. (this flag makes no difference if all source files have explicit.mliinterface files.) slay, no wasted recompiles π-one-lineβ output one line per file, regardless of the length. short king energy.-open moduleβ assume that modulemoduleis opened before parsing each of the following files.-pp commandβ causeocamldep(1)to call the given command as a preprocessor for each source file.-ppx commandβ pipe abstract syntax tree through preprocessorcommand.-sharedβ generate dependencies for native plugin files (.cmxs) in addition to native compiled files (.cmx).-slashβ (Windows) use forward slash/instead of backslash\in file paths. under Unix, this option does nothing. (yes, literally nothing, she's just vibing there πΈ)-no-slashβ (Windows) preserve any backslash\in file paths. under Unix, this option does nothing. same deal, unbothered, unphased.-sortβ sort files according to their dependencies. putting things in order is so main character.-versionβ print version string and exit.-vnumβ print short version number and exit.-args fileβ read additional newline separated command line arguments fromfile.-args0 fileβ read additional NUL separated command line arguments fromfile. (NUL separated, not newline. do not mix these up bestie π)-helpor--helpβ display a short usage summary and exit. when in doubt, ask for help. always valid π
π SEE ALSO π
ocamlc(1),ocamlopt(1).- The OCaml user's manual, chapter "Dependency generator".
and that's the whole page, bestie π«Ά go forth and let make know exactly what's up. this was OCAMLDEP(1) from the General Commands Manual β the footer of the page just says OCAMLDEP(1) right back at ya, so consider this your cute little sign-off. mwah πβ¨
π¦ where this page comes from
- alpine 3.23: ocaml5-doc 5.4.0-r0 Β· LGPL-2.1-or-later WITH OCaml-LGPL-linking-exception
- alpine 3.24: ocaml5-doc 5.4.1-r0 Β· LGPL-2.1-or-later WITH OCaml-LGPL-linking-exception
- arch rolling: ocaml 5.5.0-1 Β· LGPL2.1 AND custom: QPL-1.0
- fedora 44: ocaml-docs 5.4.0-2.fc44 Β· LGPL-2.1-or-later WITH OCaml-LGPL-linking-exception
- nixos 26.05: ocaml 5.4.1
- nixpkgs unstable: ocaml 5.5.1
- nixpkgs unstable: ocaml-solo5 1.3.5
- ubuntu resolute: ocaml 5.4.0-3ubuntu1 Β· LGPL-2.1-OCaml
- ubuntu stonking: ocaml 5.4.1-1ubuntu1 Β· LGPL-2.1-OCaml
- Copyright 1996 Institut National de Recherche en Informatique et
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms