Skip to content

Instantly share code, notes, and snippets.

@apsheronets
Created January 30, 2023 19:39
Show Gist options
  • Save apsheronets/050d6a1fd7893c9b641b47a8382adc62 to your computer and use it in GitHub Desktop.
Save apsheronets/050d6a1fd7893c9b641b47a8382adc62 to your computer and use it in GitHub Desktop.
PACKAGES = lwt
FILES = one.ml two.ml
CAMLC = ocamlfind ocamlc -thread $(LIB)
CAMLOPT = ocamlfind ocamlopt -thread $(LIB)
CAMLDEP = ocamlfind ocamldep $(LIB)
LIB = -package $(PACKAGES)
all: executable.opt executable.byte
executable.opt: $(FILES:.ml=.cmx)
$(CAMLOPT) -linkpkg -o $@ $^
executable.byte: $(FILES:.ml=.cmo)
$(CAMLC) -linkpkg -o $@ $^
.SUFFIXES:
.SUFFIXES: .ml .mli .cmo .cmi .cmx
.ml.cmo:
$(CAMLC) -c $<
.mli.cmi:
$(CAMLC) -c $<
.ml.cmx:
$(CAMLOPT) -c $<
clean:
-rm -f *.cm[ioxa] *.cmx[as] *.o *.a *~
-rm -f .depend
-rm -f executable.opt executable.byte
depend: .depend
.depend: $(FILES)
$(CAMLDEP) $(FILES:.ml=.mli) $(FILES) > .depend
FORCE:
-include .depend
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment