swh:1:snp:2d869aa00591d2ac8ec8e7abacdda563d413189d
Raw File
Tip revision: fe278be10cb6e008f9a58b85192e3d5ccd4bbf3f authored by Roberto Di Cosmo on 15 November 2011, 16:22 UTC
Significant reorganization of the code:
Tip revision: fe278be
Makefile
NAME = parmap
OBJS = bytearray $(NAME)
INTF = $(foreach obj, $(OBJS),$(obj).cmi) setcore.cmi
C_OBJS = bytearray_stubs.o setcore.o
OBJECTS  = $(foreach obj, $(OBJS),$(obj).cmo)
XOBJECTS = $(foreach obj, $(OBJS),$(obj).cmx)
LIBS = $(NAME).cma $(NAME).cmxa $(NAME).cmxs
OCAMLC   = ocamlfind ocamlc -annot
OCAMLOPT = ocamlfind ocamlopt -annot
OCAMLMKLIB = ocamlmklib
OCAMLDEP = ocamldep

ARCHIVE  = $(NAME).cma
XARCHIVE = $(NAME).cmxa
SARCHIVE = $(NAME).cmxs

REQUIRES = extlib unix bigarray 

all: $(ARCHIVE) $(XARCHIVE) $(SARCHIVE)

.PHONY: install
install: $(LIBS) META
	ocamlfind remove $(NAME)
	ocamlfind install $(NAME) META $(INTF) $(LIBS) *.a *.mli $(C_OBJS) *.so

.PHONY: uninstall
uninstall:
	ocamlfind remove $(NAME)

$(ARCHIVE): $(INTF) $(OBJECTS) $(C_OBJS) 
	$(OCAMLMKLIB) -o $(NAME) $(OBJECTS) $(C_OBJS)

$(XARCHIVE): $(INTF) $(XOBJECTS) $(C_OBJS)
	$(OCAMLMKLIB) -o $(NAME) $(XOBJECTS) $(C_OBJS)

$(SARCHIVE): $(INTF) $(XOBJECTS) $(C_OBJS)
	$(OCAMLOPT) -shared -o $(SARCHIVE) $(C_OBJS) $(XOBJECTS)

bytearray_stubs.o: bytearray_stubs.c
	ocamlc -c bytearray_stubs.c

setcore.o: setcore.c
	ocamlc -c -cc "gcc -D_GNU_SOURCE -o setcore.o -fPIC" setcore.c

.SUFFIXES: .cmo .cmi .cmx .ml .mli

.ml.cmo:
	$(OCAMLC) -package "$(REQUIRES)" -c $<
.mli.cmi:
	$(OCAMLC) -package "$(REQUIRES)" -c $<
.ml.cmx:
	$(OCAMLOPT) -package "$(REQUIRES)" -c $<

depend: *.ml *.mli
	$(OCAMLDEP) *.ml *.mli >.depend

include .depend

.PHONY: clean
clean:
	rm -f *.cmi *.cmo *.cmx *.cma *.cmxa *.cmxs *.a *.o *.so *.annot
back to top