File: ocaml.lib.mk

package info (click to toggle)
bsdowl 2.2.2-1.3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,448 kB
  • sloc: sh: 828; makefile: 383; ml: 267; lisp: 54
file content (119 lines) | stat: -rw-r--r-- 2,796 bytes parent folder | download | duplicates (3)
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
### ocaml.lib.mk -- Building OCaml libraries

# Author: Michael Grünewald
# Date: Tue Apr  5 12:31:04 CEST 2005

# BSD Owl Scripts (https://bitbucket.org/michipili/bsdowl)
# This file is part of BSD Owl Scripts
#
# Copyright © 2005–2014 Michael Grünewald
#
# This file must be used under the terms of the CeCILL-B.
# This source file is licensed as described in the file COPYING, which
# you should have received as part of this distribution. The terms
# are also available at
# http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.txt


### SYNOPSIS

# LIBRARY=	newton
# SRCS+=	newton.ml
#
# .include "ocaml.lib.mk"


### DESCRIPTION

# Build an ocaml library, compiling each of the module listed in SRCS
# and creating a library named as LIBRARY.
#
# It supports building bytecode and native libraries, ocamlfind,
# lexers and parsers generated by ocamllex and ocamlyacc and
# debugging, profiling as well.

# Variables:
#
#
#  LIBRARY
#   The name of the library
#
#
#  SRCS
#   Files to put in the library
#
#   It can list implementation files, lexer and parser definitions.
#
#
#  LIBOWN, LIBGRP, LIBMODE, LIBDIR, LIBNAME
#   Paramters of the library installation
#
#   See `bps.own.mk` for a closer description of these variables. If
#   the PACKAGE library is set, then LIBDIR will appropriately be
#   initialised to ${PREFIX}/lib/ocaml/site-lib${PACKAGEDIR}
#   instead of {PREFIX}/lib/ocaml.


### IMPLEMENTATION

.include "bps.init.mk"
.include "ocaml.init.mk"

# We do not support the LIB short name, because it clashes with a file
# installation group.
#
# .if defined(LIB)&&!empty(LIB)
# LIBRARY?= ${LIB}
# .endif

.if !defined(LIBRARY)||empty(LIBRARY)
.error The ocaml.lib.mk expects you to set the LIBRARY variable to a sensible value.
.endif

_OCAML_SRCS?=
_OCAML_CMA?=
_OCAML_CMXA?=
_OCAML_A?=

_OCAML_LIB:=${LIBRARY}

.for lib in ${_OCAML_LIB}
SRCS.${lib:T}?=${SRCS}
.if defined(_OCAML_COMPILE_NATIVE)
SRCS.${lib:T}.cmxa?=${SRCS.${lib:T}}
_OCAML_SRCS+=SRCS.${lib}.cmxa
_OCAML_CMXA+=${lib:T}.cmxa
_OCAML_A+=${lib:T}.a
.endif
.if defined(_OCAML_COMPILE_BYTE)
SRCS.${lib:T}.cma?=${SRCS.${lib:T}}
_OCAML_SRCS+=SRCS.${lib}.cma
_OCAML_CMA+=${lib:T}.cma
.endif
.endfor


.include "ocaml.main.mk"


.for lib in ${_OCAML_LIB}
.if defined(_OCAML_COMPILE_NATIVE)
LIB+= ${lib}.cmxa ${lib}.a
_OCAML_SRCS.${lib}.cmxa=${.ALLSRC}
${lib}.cmxa: ${SRCS.${lib}.cmxa:C/\.ml[ly]/.ml/:M*.ml:.ml=.cmx}
.endif
.if defined(_OCAML_COMPILE_BYTE)
LIB+= ${lib}.cma
_OCAML_SRCS.${lib:T}.cma=${.ALLSRC}
${lib}.cma: ${SRCS.${lib:T}.cma:C/\.ml[ly]/.ml/:M*.ml:.ml=.cmo}
.endif
.if !empty(SRCS.${lib:T}:C/\.ml[ly]/.ml/:M*.ml)
LIB+= ${SRCS.${lib:T}:C/\.ml[ly]/.ml/:M*.ml:.ml=.cmi}
.endif
.endfor

.include "bps.clean.mk"
.include "bps.files.mk"
.include "bps.usertarget.mk"

### End of file `ocaml.lib.mk'