Source

caml2geom / Makefile.am

Full commit
#  Copyright (c) 2011 Barry Schwartz
#
#  Permission is hereby granted, free of charge, to any person
#  obtaining a copy of this software and associated documentation
#  files (the "Software"), to deal in the Software without
#  restriction, including without limitation the rights to use,
#  copy, modify, merge, publish, distribute, sublicense, and/or sell
#  copies of the Software, and to permit persons to whom the
#  Software is furnished to do so, subject to the following
#  conditions:
#
#  The above copyright notice and this permission notice shall be
#  included in all copies or substantial portions of the Software.
#
#  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
#  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
#  OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
#  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
#  HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
#  WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
#  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
#  OTHER DEALINGS IN THE SOFTWARE.

#--------------------------------------------------------------------------

CAML2GEOM = caml2geom
CAML2GEOM_MODULENAME = Caml2geom
MLFIND = $(OCAMLFIND) $(OCAMLFINDFLAGS)
MLMKLIB = $(OCAMLMKLIB) $(OCAMLMKLIBFLAGS)
OCAMLC = $(OCAMLFIND) c $(OCAMLFINDFLAGS) -g
OCAMLOPT = $(OCAMLFIND) opt $(OCAMLFINDFLAGS) -g
CPPFLAGS += $(LIB2GEOM_CFLAGS)
LDFLAGS += $(LIB2GEOM_LIBS)

EXTRA_DIST = META $(CAML2GEOM).ml $(CAML2GEOM).mli $(CAML2GEOM)_stubs.c \
	test1.ml

#--------------------------------------------------------------------------

%.cmi: %.mli
	$(OCAMLC) -c $< -o $@

%.cmo: %.ml %.cmi
	$(OCAMLC) -c $< -o $@

%.cmx: %.ml %.cmi dll$(CAML2GEOM).so
	$(OCAMLOPT) -c $< -cclib dll$(CAML2GEOM).so -o $@

%_stubs.o: %_stubs.c
	$(OCAMLC) -cc "$(CXX)" -ccopt "$(CXXFLAGS)" -ccopt "$(CPPFLAGS)" -c $<

#--------------------------------------------------------------------------

all: $(addprefix $(CAML2GEOM)., cmi cma cmxa) dll$(CAML2GEOM).so

$(CAML2GEOM).cma: $(CAML2GEOM).cmo
	$(MLMKLIB) -o $(CAML2GEOM) $^ $(LDFLAGS)

$(CAML2GEOM).cmxa: $(CAML2GEOM).cmx
	$(MLMKLIB) -o $(CAML2GEOM) $^ $(LDFLAGS)

$(CAML2GEOM).a: $(CAML2GEOM).cmxa

dll$(CAML2GEOM).so lib$(CAML2GEOM).a: $(CAML2GEOM)_stubs.o
	$(MLMKLIB) -o $(CAML2GEOM) $< $(LDFLAGS)

test1: test1.ml $(CAML2GEOM).cmi $(CAML2GEOM).cma dll$(CAML2GEOM).so
	$(OCAMLC) -o $@ -dllib dll$(CAML2GEOM) $(CAML2GEOM).cma $<

install-data-local: all
	-$(MLFIND) remove $(CAML2GEOM)
	$(MLFIND) install $(CAML2GEOM) $(srcdir)/META \
		$(CAML2GEOM).cma $(CAML2GEOM).cmxa $(CAML2GEOM).cmi \
	    lib$(CAML2GEOM).a $(CAML2GEOM).a \
		$(srcdir)/$(CAML2GEOM).mli \
		$(srcdir)/$(CAML2GEOM).ml \
		$(srcdir)/$(CAML2GEOM)_stubs.c \
		-dll dll$(CAML2GEOM).so

uninstall-local:
	$(MLFIND) remove $(CAML2GEOM)

MOSTLYCLEANFILES = \
	$(CAML2GEOM).cmxa $(CAML2GEOM).cma \
	$(CAML2GEOM).cmx $(CAML2GEOM).cmo $(CAML2GEOM).cmi \
	$(CAML2GEOM).o $(CAML2GEOM).a \
    $(CAML2GEOM)_stubs.o lib$(CAML2GEOM).a dll$(CAML2GEOM).so \
	test1 ChangeLog

ChangeLog::
	hg log --style=changelog --only-branch=default "${top_srcdir}" > $@ 

#--------------------------------------------------------------------------