blob: 750e1f77632eda6147dc0bc3610eb895512dc998 (
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
64
65
66
67
68
69
70
71
72
73
74
75
|
$NetBSD: patch-Makefile,v 1.3 2022/05/04 08:56:02 jaapb Exp $
Make native code compilation optional and use INSTALL_* macros
--- Makefile.orig 2021-10-09 14:48:02.000000000 +0000
+++ Makefile
@@ -11,7 +11,7 @@
# #
#########################################################################
-include Makefile.config
+-include Makefile.config
OCAMLC=ocamlc
OCAMLOPT=ocamlopt
@@ -21,11 +21,18 @@ OCAMLRUN=ocamlrun
O=o
A=a
SO=so
-LIBDIR=`ocamlc -where`
-STUBLIBDIR=$(LIBDIR)/stublibs
+HAS_OCAMLOPT?= $(shell if which ocamlopt >/dev/null; then echo yes; else echo no; fi)
-all: libcamldbm.$(A) dbm.cma dbm.cmxa dbm.cmxs
+TARGETS := libcamldbm.$(A) dbm.cma
+FILES := META dllcamldbm.$(SO) libcamldbm.$(A) dbm.cma dbm.cmi dbm.mli
+
+ifeq ($(HAS_OCAMLOPT),yes)
+ TARGETS += dbm.cmxa dbm.cmxs
+ FILES += dbm.cmxa dbm.cmxs dbm.cmx dbm.$(A)
+endif
+
+all: $(TARGETS)
dbm.cma: dbm.cmo
$(OCAMLMKLIB) -o dbm -oc camldbm -linkall dbm.cmo $(DBM_LINK)
@@ -57,13 +64,13 @@ depend:
$(OCAMLDEP) *.ml *.mli > .depend
install::
- if test -f dllcamldbm.$(SO); then mkdir $(STUBLIBDIR) || echo Ok; cp dllcamldbm.$(SO) $(STUBLIBDIR)/; fi
- cp libcamldbm.$(A) $(LIBDIR)/
+ if test -f dllcamldbm.$(SO); then $(BSD_INSTALL_LIB_DIR) $(STUBLIBDIR) || echo Ok; $(BSD_INSTALL_LIB) dllcamldbm.$(SO) $(STUBLIBDIR)/; fi
+ $(BSD_INSTALL_LIB) libcamldbm.$(A) $(LIBDIR)/
cd $(LIBDIR) && ranlib libcamldbm.$(A)
- cp dbm.cmx dbm.cma dbm.cmxa dbm.cmi dbm.mli $(LIBDIR)/
- cp dbm.$(A) $(LIBDIR)/
+ $(BSD_INSTALL_DATA) dbm.cmx dbm.cma dbm.cmxa dbm.cmi dbm.mli $(LIBDIR)/
+ $(BSD_INSTALL_DATA) dbm.$(A) $(LIBDIR)/
cd $(LIBDIR) && ranlib dbm.$(A)
- if test -f dbm.cmxs; then cp dbm.cmxs $(LIBDIR)/; fi
+ if test -f dbm.cmxs; then $(BSD_INSTALL_DATA) dbm.cmxs $(LIBDIR)/; fi
clean::
rm -f *.cm* *.$(O) *.$(A) *.$(SO)
@@ -77,12 +84,16 @@ testdbm.opt: dbm.cmxa testdbm.ml
clean::
rm -f testdbm.byte testdbm.opt testdatabase.*
-test: testdbm.byte testdbm.opt
+test:: testdbm.byte
rm -f testdatabase.*
ocamlrun -I . ./testdbm.byte
rm -f testdatabase.*
+
+ifeq ($(HAS_OCAMLOPT),yes)
+test:: testdbm.opt
+ rm -f testdatabase.*
./testdbm.opt
rm -f testdatabase.*
-
+endif
include .depend
|