summaryrefslogtreecommitdiff
path: root/testsuite/tests/lib-dynlink-bytecode/Makefile
blob: a510325bced0f4a206d0328a431c7f5e96331fef (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
BASEDIR=../..

default: compile run

compile:
	@for file in stub*.c; do \
	  $(OCAMLC) -c $$file; \
	  $(OCAMLMKLIB) -o `echo $$file | sed -e 's/stub/plug/' | sed -e 's/\.c//'` `basename $$file c`o; \
	done
	@for file in plug*.ml; do \
	  $(OCAMLC) -c $$file; \
	  $(OCAMLMKLIB) -o `basename $$file .ml` `basename $$file ml`cmo; \
	done
	@$(OCAMLC) -c main.ml
	@$(OCAMLC) -o main dynlink.cma main.cmo
	@$(OCAMLC) -o static -linkall plug1.cma plug2.cma -use-runtime $(PREFIX)/bin/ocamlrun
	@$(OCAMLC) -o custom -custom -linkall plug2.cma plug1.cma -I .

run:
	@printf " ... testing 'main'"
	@export LD_LIBRARY_PATH=`pwd` && ./main plug1.cma plug2.cma > main.result
	@$(DIFF) main.reference main.result > /dev/null || (echo " => failed" && exit 1)
	@echo " => passed"

	@printf " ... testing 'static'"
	@export LD_LIBRARY_PATH=`pwd` && ./static > static.result
	@$(DIFF) static.reference static.result > /dev/null || (echo " => failed" && exit 1)
	@echo " => passed"

	@printf " ... testing 'custom'"
	@export LD_LIBRARY_PATH=`pwd` && ./custom > custom.result
	@$(DIFF) custom.reference custom.result > /dev/null || (echo " => failed" && exit 1)
	@echo " => passed"
	
promote: defaultpromote

clean: defaultclean
	@rm -f ./main ./static ./custom *.result

include $(BASEDIR)/makefiles/Makefile.common