File: ocamlinit.mk

package info (click to toggle)
ocaml 4.05.0-11
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 27,060 kB
  • sloc: ml: 199,255; ansic: 44,187; sh: 5,611; makefile: 4,958; lisp: 4,223; asm: 4,220; awk: 306; perl: 87; fortran: 21; cs: 9; sed: 9
file content (86 lines) | stat: -rw-r--r-- 2,772 bytes parent folder | download
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
#
# Description: Useful Makefile rules for OCaml related packages
#
# Copyright © 2009 Stéphane Glondu <steph@glondu.net>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301 USA.
#

_ocaml_share_path ?= /usr/share/ocaml

ifndef _ocaml_share_ocamlinit
_ocaml_share_ocamlinit = 1

include $(CURDIR)/debian/ocamlvars.mk
include $(_ocaml_share_path)/ocamlvars.mk
-include $(CURDIR)/config/Makefile

# list of .in files contained (non-recursively) in debian/ that requires
# pre-build filling.
# debian/rules writers might need to add stuff to this list:
#  e.g.: OCAML_IN_FILES += debian/patches/foo	# (no .in extension)
OCAML_IN_FILES ?= $(filter-out debian/control,$(patsubst %.in,%,$(wildcard debian/*.in)))

OCAMLINIT_SED := \
  -e 's%@OCamlABI@%$(OCAML_ABI)%g' \
  -e 's%@OCamlStdlibDir@%$(OCAML_STDLIB_DIR)%g' \
  -e 's%@OCamlDllDir@%$(OCAML_DLL_DIR)%g'

# When using these prefixs in *.install.in they must appear in the same order
# as below, with STD: going last since it's processed by gen_modules.pl

ifeq ($(OCAML_HAVE_OCAMLOPT),yes)
  OCAMLINIT_SED += -e 's/^OPT: //' -e '/^BYTE: /d'
else
  OCAMLINIT_SED += -e '/^OPT: /d' -e 's/^BYTE: //'
endif

# Upstream Makefile is mildly buggy, sets NATDYNLINK for sparc64 with no opt
# support. This double-if should stay correct in all future situations.
ifeq ($(OCAML_HAVE_OCAMLOPT) $(NATDYNLINK),yes true)
  OCAMLINIT_SED += -e 's/^DYN: //'
else
  OCAMLINIT_SED += -e '/^DYN: /d'
  OCAMLINIT_SED += -e '/\.cmxs$$/d'
endif

ifeq ($(PROFILING),true)
  OCAMLINIT_SED += -e 's/^PROFILING: //'
else
  OCAMLINIT_SED += -e '/^PROFILING: /d'
endif

otherlib = \
OCAMLINIT_SED += $(if $(filter $(1),$(OTHERLIBRARIES)),\
  -e 's/^OTH: \(.*\b$(1)\.\w\w*$$$$\)/\1/',\
  -e '/^OTH: .*\b$(1)\.\w\w*$$$$/d')
# careful, no whitespace after the comma
$(eval $(call otherlib,raw_spacetime_lib))

ocamlinit: ocamlinit-stamp
ocamlinit-stamp: config/Makefile
	for t in $(OCAML_IN_FILES); do \
	  sed $(OCAMLINIT_SED) $$t.in > $$t; \
	done
	sed -i 's@\./@@' debian/ocaml-nox.lintian-overrides
	touch $@

ocamlinit-clean:
	rm -f ocamlinit-stamp $(OCAML_IN_FILES)

.PHONY: ocamlinit ocamlinit-clean

endif