File: Makefile

package info (click to toggle)
mlgmp 20021123-19
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 484 kB
  • ctags: 982
  • sloc: ansic: 3,257; ml: 2,686; makefile: 167
file content (123 lines) | stat: -rw-r--r-- 2,646 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
120
121
122
123
# Use GNU Make !
RANLIB= ranlib

OCAML_LIBDIR:= $(shell ocamlc -where)
GMP_INCLUDES=

GMP_LIBDIR=
PREFIX= $(OCAML_LIBDIR)
PKGDIR= $(PREFIX)/gmp/
STUBDIR= $(PREFIX)/stublibs/

#RLIBFLAGS= -cclib "-Wl,-rpath $(GMP_LIBDIR)" # Linux, FreeBSD
#RLIBFLAGS= -cclib "-Wl,-R $(GMP_LIBDIR)" # Solaris
# RLIBFLAGS= # MacOS X

LIBFLAGS= -cclib -L. -cclib -L$(GMP_LIBDIR) $(RLIBFLAGS) \
	-cclib -lmpfr -cclib -lgmp -cclib -L$(DESTDIR)

CC= gcc
CFLAGS_MISC= -Wall -Wno-unused -g -O2 -fPIC
#CFLAGS_MISC=
CFLAGS_INCLUDE= -I $(OCAML_LIBDIR) $(GMP_INCLUDES)
CFLAGS= $(CFLAGS_MISC) $(CFLAGS_INCLUDE)

OCAMLC= ocamlc -g
OCAMLOPT= ocamlopt
OCAMLMKLIB= ocamlmklib
OCAMLFLAGS=

CMODULES= mlgmp_z.c mlgmp_q.c mlgmp_f.c mlgmp_fr.c mlgmp_random.c mlgmp_misc.c
CMODULES_O= $(CMODULES:%.c=%.o)


PROGRAMS= test_creal test_creal.opt essai essai.opt toplevel\
	test_suite test_suite.opt

C_STATIC = libgmpstub.a
C_SHARED = dllgmpstub.so

HAS_OPT=
BYTE_LIBS=  gmp.cma gmp.cmi
BYTE_TESTS= test_suite

ifdef HAS_OPT
  OPT_LIBS= gmp.cmxa
  OPT_CMX= gmp.cmx
  OPT_TESTS= test_suite.opt
else
  OPT_LIBS=
  OPT_CMX=
  OPT_TESTS=
endif

LIBS = $(C_SHARED) $(BYTE_LIBS) $(OPT_LIBS)

all:	$(LIBS) tests

install: all
	install -d $(DESTDIR)$(PKGDIR)
	install -m 0644 -c $(BYTE_LIBS) $(OPT_LIBS) *.a gmp.mli $(DESTDIR)$(PKGDIR)
	install -d $(STUBDIR)
	install -m 0644 -c $(C_SHARED) $(STUBDIR)

tests:	$(LIBS) $(BYTE_TESTS) $(OPT_TESTS)
	./test_suite
	if [ -e ./test_suite.opt ]; then ./test_suite.opt; fi

%.i: %.c
	$(CC) $(CFLAGS) -E $*.c > $*.i

%.cmo: %.ml %.cmi
	$(OCAMLC) $(OCAMLFLAGS) -c $*.ml

%.cmx: %.ml %.cmi
	$(OCAMLOPT) $(OCAMLFLAGS) -c $*.ml

%.cmo: %.ml
	$(OCAMLC) $(OCAMLFLAGS) -c $*.ml

%.cmx: %.ml
	$(OCAMLOPT) $(OCAMLFLAGS) -c $*.ml

%.cmi: %.mli
	$(OCAMLC) $(OCAMLFLAGS) -c $*.mli

$(CMODULES_O): conversions.c config.h

dllgmpstub.so libgmpstub.a gmp.cma gmp.cmxa: gmp.cmo $(OPT_CMX) $(CMODULES_O)
	$(OCAMLMKLIB) $(OCAMLFLAGS) -o gmp -oc gmpstub  gmp.cmo \
	   $(OPT_CMX) $(CMODULES_O) -lgmp

pretty_gmp.cmo: pretty_gmp.cmi gmp.cmo

toplevel: gmp.cma creal.cmo pretty_gmp.cmo install_pp.cmo creal_pp.cmo install_creal_pp.cmo
	ocamlmktop -custom $+ -o $@

essai:	gmp.cma essai.cmo
	$(OCAMLC) -custom $+ -o $@

essai.opt: gmp.cmxa essai.cmx
	$(OCAMLOPT) $+ -o $@

test_creal: gmp.cma creal.cmo test_creal.cmo
	$(OCAMLC)  $+ -o $@

test_creal.opt:	gmp.cmxa creal.cmx test_creal.cmx
	$(OCAMLOPT) $+ -o $@

test_suite: gmp.cma test_suite.cmo
	$(OCAMLC) -custom $+ -o $@ -cclib -L.

test_suite.opt:	gmp.cmxa test_suite.cmx
	$(OCAMLOPT) $+ -o $@ -cclib -L.

clean:
	-rm -f *.o *.cm* $(PROGRAMS) *.a *.so

depend:
	ocamldep *.ml *.mli > depend

.PHONY: clean

-include depend