From 9a42c48a1d274bda76b2d8684e013be43099ef85 Mon Sep 17 00:00:00 2001 From: Stefano Zacchiroli Date: Tue, 11 Mar 2003 11:33:56 +0000 Subject: [PATCH] use autotools also for ocaml part (again?) --- helm/DEVEL/gdome_xslt/Makefile.am | 4 +- helm/DEVEL/gdome_xslt/configure.ac | 11 +- .../gdome_xslt/ocaml/gdome_xslt/Makefile.am | 158 +++++++++++------- helm/DEVEL/gdome_xslt/ocaml/test/Makefile.am | 14 +- 4 files changed, 110 insertions(+), 77 deletions(-) diff --git a/helm/DEVEL/gdome_xslt/Makefile.am b/helm/DEVEL/gdome_xslt/Makefile.am index 5cfa88f49..c9d6afc97 100644 --- a/helm/DEVEL/gdome_xslt/Makefile.am +++ b/helm/DEVEL/gdome_xslt/Makefile.am @@ -2,8 +2,8 @@ DISTDIR = @PACKAGE@-@VERSION@ EXTRA_DIST = BUGS LICENSE aclocal.m4 debian/ -SUBDIRS = C C++ test_files -# SUBDIRS = C C++ ocaml test_files +## SUBDIRS = C C++ test_files +SUBDIRS = C C++ ocaml test_files bin_SCRIPTS = gdome_xslt_cpp_smart-config diff --git a/helm/DEVEL/gdome_xslt/configure.ac b/helm/DEVEL/gdome_xslt/configure.ac index aafc4d193..651875dd8 100644 --- a/helm/DEVEL/gdome_xslt/configure.ac +++ b/helm/DEVEL/gdome_xslt/configure.ac @@ -193,12 +193,11 @@ AC_CONFIG_FILES([ C++/gdome_xslt/Makefile C++/test/Makefile C++/Makefile - gdome_xslt_cpp_smart-config + ocaml/Makefile + ocaml/gdome_xslt/Makefile + ocaml/gdome_xslt/META + ocaml/test/Makefile + gdome_xslt_cpp_smart-config test_files/Makefile]) AC_CONFIG_COMMANDS([default],[[chmod +x gdome_xslt_cpp_smart-config]],[[]]) AC_OUTPUT -# ocaml/Makefile -# ocaml/gdome_xslt/Makefile -# ocaml/gdome_xslt/META -# ocaml/test/Makefile - diff --git a/helm/DEVEL/gdome_xslt/ocaml/gdome_xslt/Makefile.am b/helm/DEVEL/gdome_xslt/ocaml/gdome_xslt/Makefile.am index a5adeb590..7a4c5037f 100644 --- a/helm/DEVEL/gdome_xslt/ocaml/gdome_xslt/Makefile.am +++ b/helm/DEVEL/gdome_xslt/ocaml/gdome_xslt/Makefile.am @@ -1,79 +1,113 @@ -PKGNAME = gdome2-xslt + ARCHIVE = mlgdome2-xslt -REQUIRES = gdome2 +PKGNAME = gdome2-xslt +OCAMLINSTALLDIR = $(DESTDIR)$(OCAMLSTDLIBDIR)/$(PKGNAME) +STUBSDIR = $(DESTDIR)$(OCAMLSTUBDIR) +OCAMLFLAGS = -I +gdome2 +OCAMLC = @OCAMLC@ ${OCAMLFLAGS} +OCAMLOPT = @OCAMLOPT@ ${OCAMLFLAGS} +OCAMLDEP = @OCAMLDEP@ +OCAML_CFLAGS = @OCAML_CFLAGS@ OCAMLFIND = @OCAMLFIND@ -OCAMLC = $(OCAMLFIND) @OCAMLC@ -package "$(REQUIRES)" -OCAMLOPT = $(OCAMLFIND) @OCAMLOPT@ -package "$(REQUIRES)" -OCAMLDEP = $(OCAMLFIND) @OCAMLDEP@ -package "$(REQUIRES)" -OCAMLMKLIB = @OCAMLMKLIB@ +OCAMLMKLIB = ocamlmklib DLL = dll$(ARCHIVE).so -OCAMLSTDLIBDIR = $(DESTDIR)/@OCAMLSTDLIBDIR@ -OCAMLSTUBDIR = $(DESTDIR)/@OCAMLSTUBDIR@ -OCAMLINSTALLDIR = $(OCAMLSTDLIBDIR)/$(PKGNAME) -MODULES = i_gdome_xslt gdome_xslt -INIT = gdome_xslt_init -CMI_S = $(MODULES:%=%.cmi) -CMO_S = $(MODULES:%=%.cmo) -CMX_S = $(MODULES:%=%.cmx) -O_S = ml_gdome_xslt.o $(top_builddir)/C/gdome_xslt/gdome_xslt.o -SHARED_LIBS = -lxslt -lgdome -lglib -lxml2 -lmlgdome -BYTE_STUFF = $(ARCHIVE).cma $(INIT).cmo -NATIVE_STUFF = $(ARCHIVE).cmxa $(ARCHIVE).a $(INIT).cmx -BYTE_INSTALL_STUFF = \ - i_gdome_xslt.cmi gdome_xslt.cmi gdome_xslt.mli $(ARCHIVE).cma \ - $(INIT).cmi $(INIT).cmo $(INIT).mli $(DLL) META -NATIVE_INSTALL_STUFF = $(ARCHIVE).a $(ARCHIVE).cmxa $(INIT).cmx $(INIT).o + +CLEANFILES = \ + $(ARCHIVE).cma $(ARCHIVE).cmxa $(ARCHIVE).a lib$(ARCHIVE).a $(DLL) \ + *.cmo *.cmx *.cmi EXTRA_DIST = \ - META.in gdome_xslt.ml gdome_xslt.mli \ - gdome_xslt_init.ml gdome_xslt_init.mli i_gdome_xslt.ml \ - ml_gdome_xslt.c ml_gdome_xslt.h ocaml-io.h .depend + META.in .depend \ + gdome_xslt.ml gdome_xslt.mli gdome_xslt_init.ml gdome_xslt_init.mli \ + i_gdome_xslt.ml \ + ocaml-io.h if HAVE_OCAMLOPT_COND -noinst_DATA = $(BYTE_STUFF) $(NATIVE_STUFF) +noinst_DATA = $(ARCHIVE).cma $(DLL) $(ARCHIVE).cmxa $(ARCHIVE).a gdome_xslt_init.cmo gdome_xslt_init.cmx else -noinst_DATA = $(BYTE_STUFF) +noinst_DATA = $(ARCHIVE).cma $(DLL) gdome_xslt_init.cmo endif -noinst_LTLIBRARIES = libmlgdome2_xslt.la -libmlgdome2_xslt_la_SOURCES = ml_gdome_xslt.c +noinst_LTLIBRARIES = libmlgdome2-xslt.la + +C_SRC = ml_gdome_xslt.c +libmlgdome2_xslt_la_SOURCES = $(C_SRC) + +O_S = $(C_SRC:%.c=%.o) +LO_S = $(O_S:%.o=%.lo) $(top_builddir)/C/gdome_xslt/gdome_xslt.lo +CMA_DEPS = i_gdome_xslt.cmo gdome_xslt.cmo +CMXA_DEPS = $(CMA_DEPS:%.cmo=%.cmx) +SHARED_LIBS = -lxslt -lgdome -lglib -lxml2 -lmlgdome + +$(ARCHIVE).cma: $(CMA_DEPS) + $(OCAMLMKLIB) -o $(ARCHIVE) -L@OCAMLSTUBDIR@ $(CMA_DEPS) $(SHARED_LIBS) + +$(ARCHIVE).cmxa: $(CMXA_DEPS) + $(OCAMLMKLIB) -o $(ARCHIVE) -L@OCAMLSTUBDIR@ $(CMXA_DEPS) $(SHARED_LIBS) +$(DLL) $(ARCHIVE).a: $(LO_S) + # use .lo for ocamlmklib + for f in $(LO_S); do \ + cp $$f $$f.o; \ + done + $(OCAMLMKLIB) -o $(ARCHIVE) -L@OCAMLSTUBDIR@ $(LO_S:%=%.o) $(SHARED_LIBS) + for f in $(LO_S:%=%.o); do \ + rm $$f; \ + done + +INCLUDES = $(GDOME_CFLAGS) $(MLGDOME_CFLAGS) -I/usr/include/caml -I$(top_srcdir)/C/gdome_xslt + +BYTECODE_STUFF = $(ARCHIVE).cma $(DLL) gdome_xslt.cmi gdome_xslt.mli gdome_xslt_init.cmi gdome_xslt_init.mli gdome_xslt_init.cmo +NATIVECODE_STUFF = $(ARCHIVE).cmxa $(ARCHIVE).a gdome_xslt_init.cmx if HAVE_OCAMLOPT_COND -install-data-local: $(BYTE_INSTALL_STUFF) $(NATIVE_INSTALL_STUFF) +install-data-local: $(BYTECODE_STUFF) $(NATIVECODE_STUFF) else -install-data-local: $(BYTE_INSTALL_STUFF) +install-data-local: $(BYTECODE_STUFF) endif - $(mkinstalldirs) $(OCAMLSTDLIBDIR) $(OCAMLSTUBDIR) + $(mkinstalldirs) $(OCAMLINSTALLDIR) $(STUBSDIR) chmod -x $(DLL) - $(OCAMLFIND) install -destdir $(OCAMLSTDLIBDIR) $(PKGNAME) $^ - ln -fs $(DLL) $(OCAMLSTUBDIR)/lib$(ARCHIVE).so - -CLEANFILES = \ - $(ARCHIVE).{cma,cmxa,a} $(CMI_S) $(CMO_S) $(CMX_S) ml_gdome_xslt.o \ - $(DLL) $(INIT).cm[iox] libmlgdome2-xslt.a - -INCLUDES = \ - $(GDOME_CFLAGS) $(MLGDOME_CFLAGS) \ - -I/usr/include/caml -I$(top_srcdir)/C/gdome_xslt - -$(ARCHIVE).cma $(DLL): $(CMO_S) - $(OCAMLMKLIB) -o $(ARCHIVE) -L@OCAMLSTUBDIR@ $(CMO_S) $(O_S) $(SHARED_LIBS) -$(ARCHIVE).cmxa $(ARCHIVE).a: $(CMX_S) - $(OCAMLMKLIB) -o $(ARCHIVE) -L@OCAMLSTUBDIR@ $(CMX_S) $(O_S) $(SHARED_LIBS) - -%.cmi: %.mli - $(OCAMLC) -c $< -%.cmo: %.ml %.cmi - $(OCAMLC) -c $< -%.cmx: %.ml %.cmi - $(OCAMLOPT) -c $< - -i_gdome_xslt.cmo: i_gdome_xslt.ml - $(OCAMLC) -c $< -i_gdome_xslt.cmx: i_gdome_xslt.ml - $(OCAMLOPT) -c $< - -depend: *.ml *.mli - $(OCAMLDEP) *.ml *.mli >.depend + for i in $^; do \ + if [ "$$i" != "$(DLL)" ]; then \ + $(INSTALL_DATA) $$i $(OCAMLINSTALLDIR)/$$i; \ + fi \ + done + if [ "x$(OCAMLFIND)" != "x" ]; then \ + mv $(OCAMLINSTALLDIR) $(OCAMLINSTALLDIR).saved; \ + $(OCAMLFIND) install -destdir $(DESTDIR)$(OCAMLSTDLIBDIR)/ $(PKGNAME) META $(DLL); \ + $(INSTALL_DATA) $(OCAMLINSTALLDIR).saved/* $(OCAMLINSTALLDIR)/; \ + rm -rf $(OCAMLINSTALLDIR).saved/; \ + else \ + $(INSTALL_DATA) $(DLL) $(STUBSDIR); \ + fi + ln -fs $(DLL) $(STUBSDIR)/lib$(ARCHIVE).so + +uninstall-local: + if [ "x$(OCAMLFIND)" != "x" ]; then \ + $(OCAMLFIND) remove -destdir $(DESTDIR)$(OCAMLSTDLIBDIR)/ $(PKGNAME); \ + else \ + rm -rf $(OCAMLINSTALLDIR); \ + rm $(STUBSDIR)/$(DLL); \ + fi + rm $(STUBSDIR)/lib$(ARCHIVE).so + +#### OCaml only stuff from now on + +DEPOBJS = *.ml *.mli + +depend: + $(OCAMLDEP) $(DEPOBJS) > .depend + +%.cmi : $(srcdir)/%.mli + if test ! -e $(@:%.cmi=%.mli) -a "x$(srcdir)" != "x." ; then $(LN_S) $< . ; fi + $(OCAMLC) -c $(@:%.cmi=%.mli) + +%.cmo : $(srcdir)/%.ml + if test ! -e $(@:%.cmo=%.ml) -a "x$(srcdir)" != "x." ; then $(LN_S) $< . ; fi + $(OCAMLC) -c $(@:%.cmo=%.ml) + +%.cmx %.o : $(srcdir)/%.ml + if test ! -e $(@:%.cmx=%.ml) -a "x$(srcdir)" != "x." ; then $(LN_S) $< . ; fi + $(OCAMLOPT) -c $(@:%.cmx=%.ml) + include .depend diff --git a/helm/DEVEL/gdome_xslt/ocaml/test/Makefile.am b/helm/DEVEL/gdome_xslt/ocaml/test/Makefile.am index 44f2658cb..58be30f90 100644 --- a/helm/DEVEL/gdome_xslt/ocaml/test/Makefile.am +++ b/helm/DEVEL/gdome_xslt/ocaml/test/Makefile.am @@ -2,11 +2,11 @@ REQUIRES = gdome2 OCAMLFIND = @OCAMLFIND@ OCAMLC = $(OCAMLFIND) @OCAMLC@ -package "$(REQUIRES)" OCAMLOPT = $(OCAMLFIND) @OCAMLOPT@ -package "$(REQUIRES)" -CMA = ../gdome_xslt/mlgdome2-xslt.cma -CMXA = ../gdome_xslt/mlgdome2-xslt.cmxa -INIT_CMO = ../gdome_xslt/gdome_xslt_init.cmo -INIT_CMX = ../gdome_xslt/gdome_xslt_init.cmx -INCLUDES = -I ../gdome_xslt/ +CMA = $(top_builddir)/ocaml/gdome_xslt/mlgdome2-xslt.cma +CMXA = $(top_builddir)/ocaml/gdome_xslt/mlgdome2-xslt.cmxa +INIT_CMO = $(top_builddir)/ocaml/gdome_xslt/gdome_xslt_init.cmo +INIT_CMX = $(top_builddir)/ocaml/gdome_xslt/gdome_xslt_init.cmx +OCAMLC_FLAGS = -I $(top_builddir)/ocaml/gdome_xslt/ EXTRA_DIST = test.ml CLEANFILES = test{,.o,.opt} test.cm[iox] @@ -18,7 +18,7 @@ noinst_DATA = test endif test: test.ml $(CMA) $(INIT_CMO) - $(OCAMLC) -o $@ -linkpkg $(INCLUDES) $(CMA) $(INIT_CMO) $< + $(OCAMLC) -o $@ -linkpkg $(OCAMLC_FLAGS) $(CMA) $(INIT_CMO) $< test.opt: test.ml $(CMXA) $(INIT_CMX) - $(OCAMLOPT) -o $@ -linkpkg $(INCLUDES) $(CMXA) $(INIT_CMX) $< + $(OCAMLOPT) -o $@ -linkpkg $(OCAMLC_FLAGS) $(CMXA) $(INIT_CMX) $< -- 2.39.2