mirror of
https://github.com/Stichting-MINIX-Research-Foundation/pkgsrc-ng.git
synced 2025-09-10 04:50:03 -04:00
71 lines
1.8 KiB
Plaintext
71 lines
1.8 KiB
Plaintext
$NetBSD: patch-Makefile,v 1.2 2016/07/03 10:44:49 jaapb Exp $
|
|
|
|
Make native code compilation optional and integrate with findlib
|
|
--- Makefile.orig 2011-11-22 15:56:49.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,7 @@ depend:
|
|
$(OCAMLDEP) *.ml *.mli > .depend
|
|
|
|
install::
|
|
- if test -f dllcamldbm.$(SO); then cp dllcamldbm.$(SO) $(STUBLIBDIR)/; fi
|
|
- cp libcamldbm.$(A) $(LIBDIR)/
|
|
- cd $(LIBDIR) && ranlib libcamldbm.$(A)
|
|
- cp dbm.cma dbm.cmxa dbm.cmi dbm.mli $(LIBDIR)/
|
|
- cp dbm.$(A) $(LIBDIR)/
|
|
- cd $(LIBDIR) && ranlib dbm.$(A)
|
|
- if test -f dbm.cmxs; then cp dbm.cmxs $(LIBDIR)/; fi
|
|
+ ocamlfind install dbm $(FILES)
|
|
|
|
clean::
|
|
rm -f *.cm* *.$(O) *.$(A) *.$(SO)
|
|
@@ -77,12 +78,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
|