1#************************************************************************** 2#* * 3#* OCaml * 4#* * 5#* Xavier Clerc, SED, INRIA Rocquencourt * 6#* * 7#* Copyright 2010 Institut National de Recherche en Informatique et * 8#* en Automatique. * 9#* * 10#* All rights reserved. This file is distributed under the terms of * 11#* the GNU Lesser General Public License version 2.1, with the * 12#* special exception on linking described in the file LICENSE. * 13#* * 14#************************************************************************** 15 16BASEDIR=../.. 17 18COMPFLAGS=-I $(OTOPDIR)/otherlibs/dynlink 19LD_PATH=.:$(TOPDIR)/otherlibs/dynlink 20 21.PHONY: default 22default: 23 @if ! $(SUPPORTS_SHARED_LIBRARIES); then \ 24 echo 'skipped (shared libraries not available)'; \ 25 else \ 26 $(SET_LD_PATH) $(MAKE) compile run; \ 27 fi 28 29.PHONY: compile 30compile: 31 @$(OCAMLC) -c registry.ml 32 @for file in stub*.c; do \ 33 $(OCAMLC) -ccopt -I -ccopt $(CTOPDIR)/byterun -c $$file; \ 34 $(OCAMLMKLIB) -o `echo $$file | sed -e 's/stub/plug/' -e 's/\.c//'` \ 35 `basename $$file c`$(O); \ 36 done 37 @for file in plug*.ml; do \ 38 $(OCAMLC) -c $$file; \ 39 $(OCAMLMKLIB) -o `basename $$file .ml` `basename $$file ml`cmo; \ 40 done 41 @$(OCAMLC) -c main.ml 42 @rm -f main static custom custom.exe 43 @$(OCAMLC) -o main dynlink.cma registry.cmo main.cmo 44 @$(OCAMLC) -o static -linkall registry.cmo plug1.cma plug2.cma \ 45 -use-runtime $(OTOPDIR)/byterun/ocamlrun$(USE_RUNTIME)$(EXE) 46 @$(OCAMLC) -o custom$(EXE) -custom -linkall registry.cmo plug2.cma \ 47 plug1.cma -I . 48 49.PHONY: run 50run: 51 @printf " ... testing 'main'" 52 @$(OCAMLRUN) ./main plug1.cma plug2.cma >main.result 53 @$(DIFF) main.reference main.result >/dev/null \ 54 && echo " => passed" || echo " => failed" 55 56 @printf " ... testing 'static'" 57 @$(OCAMLRUN) ./static >static.result 58 @$(DIFF) static.reference static.result >/dev/null \ 59 && echo " => passed" || echo " => failed" 60 61 @printf " ... testing 'custom'" 62 @./custom$(EXE) >custom.result 63 @$(DIFF) custom.reference custom.result >/dev/null \ 64 && echo " => passed" || echo " => failed" 65 66.PHONY: promote 67promote: defaultpromote 68 69.PHONY: clean 70clean: defaultclean 71 @rm -f main static custom custom.exe *.result marshal.data dllplug*.dll 72 73include $(BASEDIR)/makefiles/Makefile.common 74