-
Notifications
You must be signed in to change notification settings - Fork 7
/
Makefile.stdlib
106 lines (83 loc) · 3.58 KB
/
Makefile.stdlib
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
#**************************************************************************
#* *
#* OCaml *
#* *
#* Xavier Leroy, projet Cristal, INRIA Rocquencourt *
#* *
#* Copyright 1999 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. *
#* *
#**************************************************************************
COMPFLAGS=-strict-sequence -absname -w +a-4-9-41-42-44-45-48 \
-g -warn-error A -bin-annot -nostdlib \
-safe-string -strict-formats
# Set -opaque for faster compilation
OPAQUE=-opaque
COMPILER=../../miniml/interp/interp.opt $(OPAQUE)
DEPEND=../../miniml/interp/depend.sh $(OPAQUE) -native
# Object file prefix
P=stdlib__
OBJS=camlinternalFormatBasics.cmx stdlib.cmx $(OTHERS)
OTHERS=$(P)seq.cmx $(P)char.cmx $(P)uchar.cmx $(P)sys.cmx $(P)list.cmx \
$(P)bytes.cmx $(P)string.cmx \
$(P)sort.cmx $(P)marshal.cmx $(P)obj.cmx $(P)float.cmx $(P)array.cmx \
$(P)int32.cmx $(P)int64.cmx $(P)nativeint.cmx \
$(P)lexing.cmx $(P)parsing.cmx \
$(P)set.cmx $(P)map.cmx $(P)stack.cmx $(P)queue.cmx \
camlinternalLazy.cmx $(P)lazy.cmx $(P)stream.cmx \
$(P)buffer.cmx camlinternalFormat.cmx $(P)printf.cmx \
$(P)arg.cmx $(P)printexc.cmx $(P)gc.cmx \
$(P)digest.cmx $(P)random.cmx $(P)hashtbl.cmx $(P)weak.cmx \
$(P)format.cmx $(P)scanf.cmx $(P)callback.cmx \
camlinternalOO.cmx $(P)oo.cmx camlinternalMod.cmx \
$(P)genlex.cmx $(P)ephemeron.cmx \
$(P)filename.cmx $(P)complex.cmx \
$(P)arrayLabels.cmx $(P)listLabels.cmx $(P)bytesLabels.cmx \
$(P)stringLabels.cmx $(P)moreLabels.cmx $(P)stdLabels.cmx \
$(P)spacetime.cmx $(P)bigarray.cmx
PREFIXED_OBJS=$(filter stdlib__%.cmx,$(OBJS))
all: stdlib.cmxa std_exit.cmx
stdlib.cmxa: $(OBJS)
$(COMPILER) -a -o $@ $^
.SUFFIXES: .mli .ml .cmi .cmx
stdlib.cmi: stdlib.pp.mli
$(COMPILER) $(COMPFLAGS) $(shell ./Compflags $@) -o $@ -c $<
stdlib.cmx: stdlib.pp.ml
$(COMPILER) $(COMPFLAGS) $(shell ./Compflags $@) -o $@ -c $<
%.cmi: %.mli
$(COMPILER) $(COMPFLAGS) $(shell ./Compflags $@) -c $<
stdlib__%.cmi: %.mli
$(COMPILER) $(COMPFLAGS) $(shell ./Compflags $@) -o $@ -c $<
%.cmx: %.ml
$(COMPILER) $(COMPFLAGS) $(shell ./Compflags $@) -c $<
stdlib__%.cmx: %.ml
$(COMPILER) $(COMPFLAGS) $(shell ./Compflags $@) -o $@ -c $<
# Dependencies on Stdlib (not tracked by ocamldep)
$(OTHERS:.cmx=.cmi) std_exit.cmi: stdlib.cmi
$(OBJS) std_exit.cmx: stdlib.cmi
ifeq "$(OPAQUE)" ""
CMIX=cmx
$(OTHERS) std_exit.cmx: stdlib.cmx
else
CMIX=cmi
endif
clean::
rm -f *.cm* *.o *.a
rm -f *~
include .depend
EMPTY :=
SPACE := $(EMPTY) $(EMPTY)
.PHONY: depend
depend:
$(DEPEND) $(filter-out stdlib.%,$(wildcard *.mli *.ml)) \
> .depend.tmp
echo "stdlib.cmi : camlinternalFormatBasics.cmi" >> .depend.tmp
echo "stdlib.cmx : camlinternalFormatBasics.$(CMIX)" >> .depend.tmp
sed -Ee \
's#(^| )(${subst ${SPACE},|,${PREFIXED_OBJS:stdlib__%.cmx=%}})[.]#\1stdlib__\2.#g' \
.depend.tmp > .depend
rm -f .depend.tmp