Source

mutated_ocaml / testsuite / tests / lib-dynlink-native / Makefile

BASEDIR=../..


default:
	@if [ -z "$(BYTECODE_ONLY)" ]; then \
	  $(MAKE) all; \
	fi

all: compile run

PLUGINS=plugin.so plugin2.so sub/plugin.so sub/plugin3.so plugin4.so mypack.so packed1.so packed1_client.so pack_client.so plugin_ref.so plugin_high_arity.so plugin_ext.so plugin_simple.so bug.so plugin_thread.so plugin4_unix.so a.so b.so c.so

ADD_COMPFLAGS=-thread

compile: $(PLUGINS) main mylib.so

run:
	@printf " ... testing 'main'"
	@./main plugin.so plugin2.so plugin_thread.so > result
	@$(DIFF) reference result > /dev/null || (echo " => failed" && exit 1)
	@echo " => passed"

main: api.cmx main.cmx
	@$(OCAMLOPT) -thread -o main -linkall unix.cmxa threads.cmxa dynlink.cmxa api.cmx main.cmx $(PTHREAD_LINK)

main_ext: api.cmx main.cmx factorial.$(O)
	@$(OCAMLOPT) -o main_ext dynlink.cmxa api.cmx main.cmx factorial.$(O)

sub/plugin3.cmx: sub/api.cmi sub/api.cmx sub/plugin3.ml
	@(cd sub; mv api.cmx api.cmx.bak; $(OCAMLOPT) -c $(COMPFLAGS) plugin3.ml; mv api.cmx.bak api.cmx)

plugin2.cmx: api.cmx plugin.cmi plugin.cmx
	@(mv plugin.cmx plugin.cmx.bak; $(OCAMLOPT) -c $(COMPFLAGS) plugin2.ml; mv plugin.cmx.bak plugin.cmx)

sub/api.so: sub/api.cmi sub/api.ml
	@(cd sub; $(OCAMLOPT) -c $(COMPFLAGS) $(SHARED) api.ml)

sub/api.cmi: sub/api.mli
	@(cd sub; $(OCAMLOPT) -c $(COMPFLAGS) api.mli)

sub/api.cmx: sub/api.cmi sub/api.ml
	@(cd sub; $(OCAMLOPT) -c $(COMPFLAGS) api.ml)

plugin.cmx: api.cmx plugin.cmi
sub/plugin.cmx: api.cmx
plugin4.cmx: api.cmx
main.cmx: api.cmx
plugin_ext.cmx: api.cmx plugin_ext.ml
	@$(OCAMLOPT) -c $(COMPFLAGS) plugin_ext.ml

plugin_ext.so: factorial.$(O) plugin_ext.cmx
	@$(OCAMLOPT) $(COMPFLAGS) -shared -o plugin_ext.so factorial.$(O) plugin_ext.cmx

plugin4_unix.so: plugin4.cmx
	@$(OCAMLOPT) -shared -o plugin4_unix.so unix.cmxa plugin4.cmx

packed1_client.cmx: packed1.cmx

pack_client.cmx: mypack.cmx

packed1.cmx: api.cmx packed1.ml
	@$(OCAMLOPT) -c $(COMPFLAGS) -for-pack Mypack packed1.ml

mypack.cmx: packed1.cmx
	@$(OCAMLOPT) $(COMPFLAGS) -S -pack -o mypack.cmx packed1.cmx

mylib.cmxa: plugin.cmx plugin2.cmx
	@$(OCAMLOPT) $(COMPFLAGS) -a -o mylib.cmxa plugin.cmx plugin2.cmx

factorial.$(O): factorial.c
	@$(OCAMLOPT) -c -ccopt "$(SHAREDCCCOMPOPTS)" factorial.c

promote:
	@cp result reference

clean: defaultclean
	@rm -f result *.so *.o *.cm* main main_ext *.exe *.s *.asm *.obj
	@rm -f *.a *.lib
	@rm -f sub/*.so sub/*.o sub/*.cm* sub/*.s sub/*.asm sub/*.obj

include $(BASEDIR)/makefiles/Makefile.common
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.