summaryrefslogtreecommitdiff
path: root/stdlib/StdlibModules
blob: 4d3351c3a3309e9e1fed04316314f178da66e1db (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# -*- Makefile -*-

#**************************************************************************
#*                                                                        *
#*                                 OCaml                                  *
#*                                                                        *
#*            Xavier Leroy, projet Cristal, INRIA Rocquencourt            *
#*                                                                        *
#*   Copyright 2002 Institut National de Recherche en Informatique et     *
#*     en Automatique.                                                    *
#*                                                                        *
#*   All rights reserved.  This file is distributed under the terms of    *
#*   the GNU Lesser General Public License version 2.1, with the          *
#*   special exception on linking described in the file LICENSE.          *
#*                                                                        *
#**************************************************************************

# This file must be self-contained.

# This file lists all standard library modules. It is used by:
# 1. stdlib/Makefile when building stdlib.cma
# 2. Makefile to expunge the toplevels
# 3. api_docgen/Makefile.docfiles to compute all documentation files which need
#    need to be generated for the stdlib

# Three variables are exported:
# $(STDLIB_MODULE_BASENAMES) - basenames, in dependency order, of the modules in
#    the stdlib
# $(STDLIB_PREFIXED_MODULES) - just the namespaced modules of
#    $(STDLIB_MODULE_BASENAMES), i.e. without camlinternal* and stdlib. Used in
#    stdlib/Makefile to munge the dependencies.
# $(STDLIB_MODULES) - full list, in prefixed form as appropriate.

# Basenames of the source files for the standard library (i.e. unprefixed and
# with lowercase first letters). These must be listed in dependency order.
STDLIB_MODULE_BASENAMES=\
  camlinternalFormatBasics camlinternalAtomic \
  stdlib pervasives seq option either result bool char uchar \
  sys list int bytes string unit marshal obj array float int32 int64 nativeint \
  lexing parsing set map stack queue camlinternalLazy lazy stream buffer \
  camlinternalFormat printf arg atomic \
  printexc fun gc digest random hashtbl weak \
  format scanf callback camlinternalOO oo camlinternalMod genlex ephemeron \
  filename complex arrayLabels listLabels bytesLabels stringLabels moreLabels \
  stdLabels bigarray

STDLIB_PREFIXED_MODULES=\
  $(filter-out stdlib camlinternal%, $(STDLIB_MODULE_BASENAMES))

define add_stdlib_prefix_first
$(shell echo $1 | cut -c1 | tr '[:lower:]' '[:upper:]')
endef

# add stdlib__ as prefix to a module except for internal modules
# and the stdlib module itself
define add_stdlib_prefix
  $(or $(filter-out $(STDLIB_PREFIXED_MODULES), $1), \
    stdlib__$(call add_stdlib_prefix_first,$1)$(shell echo $1 | cut -c2-))
endef

STDLIB_MODULES:=\
  $(foreach module, $(STDLIB_MODULE_BASENAMES), \
    $(call add_stdlib_prefix,$(module)))