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
|
#**************************************************************************
#* *
#* OCaml *
#* *
#* Xavier Clerc, SED, INRIA Rocquencourt *
#* *
#* Copyright 2010 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. *
#* *
#**************************************************************************
BASEDIR=../..
CC=$(NATIVECC) -I $(CTOPDIR)/byterun
COMPFLAGS=-I $(OTOPDIR)/otherlibs/unix
LD_PATH=$(TOPDIR)/otherlibs/unix
# This test relies on the upstream behaviour of -custom
export OCAML_CUSTOM_EMBED=n
.PHONY: default
default:
@case " $(OTHERLIBRARIES) " in \
*' unix '*) $(SET_LD_PATH) $(MAKE) run-byte; \
$(SET_LD_PATH) $(MAKE) run-opt;; \
*) $(MAKE) skip;; \
esac
.PHONY: common
common:
@$(CC) -c callbackprim.c
.PHONY: skip
skip:
@for c in bytecode native; do \
echo " ... testing '$$c': => skipped" ; \
done
.PHONY: run-byte
run-byte: common
@printf " ... testing 'bytecode':"
@$(OCAMLC) $(COMPFLAGS) -c tcallback.ml
@$(OCAMLC) $(COMPFLAGS) -o ./program$(EXE) -custom unix.cma \
callbackprim.$(O) tcallback.cmo
@./program$(EXE) >bytecode.result
@$(DIFF) reference bytecode.result \
&& echo " => passed" || echo " => failed"
.PHONY: run-opt
run-opt: common
@if $(BYTECODE_ONLY); then : ; else \
printf " ... testing 'native':"; \
$(OCAMLOPT) $(COMPFLAGS) -c tcallback.ml; \
$(OCAMLOPT) $(COMPFLAGS) -o ./program$(EXE) unix.cmxa \
callbackprim.$(O) tcallback.cmx; \
./program$(EXE) >native.result; \
$(DIFF) reference native.result \
&& echo " => passed" || echo " => failed"; \
fi
.PHONY: promote
promote: defaultpromote
.PHONY: clean
clean: defaultclean
@rm -f *.result ./program$(EXE)
include $(BASEDIR)/makefiles/Makefile.common
|