summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Furr <mfurr@debian.org>2005-05-04 02:28:31 +0000
committerStéphane Glondu <glondu@debian.org>2023-09-02 08:15:41 +0200
commita2cd338361077bcc6fdc581059a16a4348283abe (patch)
tree762d9b4b3321ae4be41e336127f7549680ad811d
parentbeb1aee2874895c4b466642e5c5d10b3f022f63a (diff)
Fix Makefile to detect ocamlopt
Signed-off-by: Mike Furr <mfurr@debian.org> Signed-off-by: Stephane Glondu <steph@glondu.net> Gbp-Pq: Name 0001-Fix-Makefile-to-detect-ocamlopt.patch
-rw-r--r--Makefile29
1 files changed, 26 insertions, 3 deletions
diff --git a/Makefile b/Makefile
index 4827101..f79b054 100644
--- a/Makefile
+++ b/Makefile
@@ -20,6 +20,10 @@
include Makefile.config
+ifeq (YES, $(shell if [ -x /usr/bin/ocamlopt ]; then echo YES; fi))
+HASOCAMLOPT := yes
+endif
+
OCAMLC := ocamlc
OCAMLOPT := ocamlopt
OCAMLMKLIB := ocamlmklib
@@ -71,7 +75,11 @@ WRAPPERS := \
wrappers/pl_Template.cmo \
wrappers/pl_WWW_Mechanize.cmo
+ifdef HASOCAMLOPT
all: perl4caml.cma perl4caml.cmxa META all-examples html
+else
+all: perl4caml.cma META all-examples html
+endif
perl4caml.cma: perl.cmo perl_c.o $(WRAPPERS)
$(OCAMLMKLIB) -o perl4caml $(LIBPERL) $^
@@ -79,12 +87,20 @@ perl4caml.cma: perl.cmo perl_c.o $(WRAPPERS)
perl4caml.cmxa: perl.cmx perl_c.o $(WRAPPERS:.cmo=.cmx)
$(OCAMLMKLIB) -o perl4caml $(LIBPERL) $^
+ifdef HASOCAMLOPT
all-examples: examples/test.bc examples/loadpage.bc examples/google.bc \
examples/test.opt examples/loadpage.opt examples/google.opt \
examples/parsedate.bc examples/parsedate.opt
+else
+all-examples: examples/test.bc examples/loadpage.bc examples/google.bc \
+ examples/parsedate.bc
+endif
-TEST_PROGRAMS := $(patsubst %.ml,%.bc,$(wildcard test/*.ml)) \
- $(patsubst %.ml,%.opt,$(wildcard test/*.ml))
+TEST_PROGRAMS := $(patsubst %.ml,%.bc,$(wildcard test/*.ml))
+
+ifdef HASOCAMLOPT
+TEST_PROGRAMS += $(patsubst %.ml,%.opt,$(wildcard test/*.ml))
+endif
test: $(TEST_PROGRAMS) run-tests
@@ -161,10 +177,17 @@ install:
rm -rf $(DESTDIR)$(OCAMLLIBDIR)/perl
install -c -m 0755 -d $(DESTDIR)$(OCAMLLIBDIR)/perl
install -c -m 0755 -d $(DESTDIR)$(OCAMLLIBDIR)/stublibs
+ifdef HASOCAMLOPT
install -c -m 0644 perl.cmi perl.mli perl4caml.cma perl4caml.cmxa \
perl4caml.a libperl4caml.a META \
$(WRAPPERS:.cmo=.ml) $(WRAPPERS:.cmo=.cmi) \
$(DESTDIR)$(OCAMLLIBDIR)/perl
+else
+ install -c -m 0644 perl.cmi perl.mli perl4caml.cma \
+ META \
+ $(WRAPPERS:.cmo=.ml) $(WRAPPERS:.cmo=.cmi) \
+ $(DESTDIR)$(OCAMLLIBDIR)/perl
+endif
install -c -m 0644 dllperl4caml.so $(DESTDIR)$(OCAMLLIBDIR)/stublibs
# Distribution.
@@ -220,4 +243,4 @@ html/index.html: $(wildcard *.ml) $(wildcard *.mli) $(wildcard wrappers/*.ml)
mkdir html
-$(OCAMLDOC) $(OCAMLDOCFLAGS) -d html $^
-.PHONY: depend dist check-manifest html dpkg test run-tests \ No newline at end of file
+.PHONY: depend dist check-manifest html dpkg test run-tests