Commits

james woodyatt committed 73db730 Merge

Merge latest changes from default branch.

  • Participants
  • Parent commits 0144af9, 0c901e3
  • Branches sideline

Comments (0)

Files changed (8)

     PKG.REQUIRES=oni.cf
     install: $(PKG.install-target)
     remove: $(PKG.remove-target)
+    documents: $(PKG.documents-target)
     
     clean:
         rm -rf $(AUXROOT)
 public.ROOT= $(dir .)
 
 ### Emphemeral targets
-.PHONY: clean test install remove
+.PHONY: clean test documents install remove
 
 ### Include OMakefile from top directory
 .SUBDIRS: .
         ARCHIVES=$(unit.package-archives)
         REQUIRES=unix
     PKG=$(PKG.add-subpackage $(sub))
+    PKG=$(component.package-search $(PKG))
     PKG.FILES+=$(unit.package-files $(component))
     export PKG
 
 + (Cf_uri): Need function for converting an absolute path to a relative path
     for a given base path.
 
++ (Cf_uri): Should support the IPv6 address literal syntax for the host part.
+
 + (Unimplemented): Support for I18N and locales.  Need timezones especially.
     The rest we can probably defer to the nice people working on Camomile.
 

iom/Makefile

-# FILE     Makefile
-#
-# Copyright (c) 2003-2006, James H. Woodyatt
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-#   Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-#
-#   Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in
-#   the documentation and/or other materials provided with the
-#   distribution.
-#
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-# COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
-# INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
-# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
-# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
-# OF THE POSSIBILITY OF SUCH DAMAGE. 
-
-REQUIRE = cf nx
-PREDICATES =
-
-###############################################################################
-
-.PHONY: default opt test test.opt clean install uninstall depend doc
-
-default::
-
-#OCAMLFINDOPT = -pp camlp4o -package "$(REQUIRE)" -predicates "$(PREDICATES)"
-#OCAMLDEP = ocamldep -pp camlp4o
-
-OCAMLFINDOPT = -package "$(REQUIRE)" -predicates "$(PREDICATES)"
-
-OCAMLC       = ocamlfind ocamlc $(OCAMLFINDOPT)
-OCAMLOPT     = ocamlfind ocamlopt $(OCAMLFINDOPT)
-OCAMLMKLIB   = ocamlmklib
-OCAMLMKTOP   = ocamlfind ocamlmktop $(OCAMLFINDOPT)
-OCAMLDEP     = ocamldep
-OCAMLLEX     = ocamllex
-OCAMLYACC    = ocamlyacc
-OCAMLDOC     = ocamlfind ocamldoc -v $(OCAMLFINDOPT)
-
-DEBUG_OPT    = -g
-WARN_ERROR   = -passopt -w -passopt Ae # -warn-error A
-PRINCIPLE    = -principal
-UNSAFE       = -unsafe -noassert
-
-ALL_OCAML_OPT = $(WARN_ERROR) $(PRINCIPLE)
-
-CC_OPT  = -ccopt -fPIC -ccopt -O2 -ccopt -Wall -ccopt -Wno-unused-variable
-CMI_OPT = $(ALL_OCAML_OPT) $(DEBUG_OPT)
-CMO_OPT = $(ALL_OCAML_OPT) $(DEBUG_OPT)
-CMX_OPT = $(ALL_OCAML_OPT) $(UNSAFE) -inline 9
-
-.SUFFIXES: .ml .mli .mll .mly .cmo .cmi .cma .cmx .cmxa
-
-%.ml : %.mll
-	$(OCAMLLEX) $<
-
-%.ml %.mli : %.mly
-	$(OCAMLYACC) -b$* $<
-
-%.cmi : %.mli
-	$(OCAMLC) $(CMI_OPT) -o $@ -c $<
-
-%.cmi %.cmo : %.ml
-	$(OCAMLC) $(CMO_OPT) -o $@ -c $<
-
-%.cmi %.cmx %.o : %.ml
-	$(OCAMLOPT) $(CMX_OPT) -o $@ -c $<
-
-%.o : %.c
-	$(OCAMLC) $(CC_OPT) -o $@ -c $<
-
-clean::
-	rm -f *.cmi *.cmo *.cma
-	rm -f *.cmx *.cmxa *.o *.a dll*.so
-
-###############################################################################
-
-default:: iom.cma
-
-opt:: iom.cmxa
-
-IOM_LEXYACC_MODULES =
-
-IOM_YACC_MODULES = $(IOM_LEXYACC_MODULES:%=iom_yacc_%)
-IOM_LEX_MODULES = $(IOM_LEXYACC_MODULES:%=iom_lex_%)
-
-#clean::
-#	rm -rf $(IOM_LEX_ML_FILES)
-#	rm -rf $(IOM_YACC_ML_FILES)
-#	rm -rf $(IOM_YACC_MLI_FILES)
-
-iom_lex_%.cmo : iom_yacc_%.cmi iom_lex_%.cmi
-iom_lex_%.cmx : iom_yacc_%.cmi iom_lex_%.cmi
-
-#manual dependencies
-
-#iom_yacc_foo.cmi: iom_foo_bar.cmi
-#iom_lex_foo.cmi: iom_foo_bar.cmi
-
-IOM_LEX_ML_FILES = $(IOM_LEX_MODULES:%=%.ml)
-IOM_YACC_ML_FILES = $(IOM_YACC_MODULES:%=%.ml)
-IOM_YACC_MLI_FILES = $(IOM_YACC_MODULES:%=%.mli)
-
-IOM_MODULES = \
-    gadget stream layer octet_stream reactor pipe socket sock_stream \
-	tcp4_socket tcp6_socket
-
-IOM_PRIMITIVES = 
-
-IOM_ML_FILES = $(IOM_MODULES:%=iom_%.ml)
-IOM_MLI_FILES = $(IOM_MODULES:%=iom_%.mli)
-IOM_CMI_FILES = $(IOM_MODULES:%=iom_%.cmi)
-IOM_CMO_FILES = $(IOM_MODULES:%=iom_%.cmo)
-IOM_CMX_FILES = $(IOM_MODULES:%=iom_%.cmx)
-IOM_O_FILES = $(IOM_MODULES:%=iom_%.o)
-
-IOM_P_C_FILES = $(IOM_PRIMITIVES:%=iom_%_p.c)
-IOM_P_H_FILES = $(IOM_PRIMITIVES:%=iom_%_p.h)
-IOM_P_O_FILES = $(IOM_PRIMITIVES:%=iom_%_p.o)
-
-#IOM_P_LIB_FILES = libiom.a dlliom.so
-IOM_P_LIB_FILES =
-
-#$(IOM_P_LIB_FILES) : $(IOM_P_O_FILES)
-#	$(OCAMLMKLIB) -o iom $(IOM_P_O_FILES)
-#
-#iom.cma : $(IOM_CMI_FILES) $(IOM_CMO_FILES)
-#	$(OCAMLMKLIB) -o iom $(IOM_CMO_FILES) -liom
-#
-#iom.cmxa iom.a : \
-# $(IOM_P_LIB_FILES) $(IOM_CMI_FILES) $(IOM_CMX_FILES) $(IOM_O_FILES)
-#	$(OCAMLMKLIB) -o iom $(IOM_CMX_FILES) -liom
-
-iom.cma : $(IOM_CMI_FILES) $(IOM_CMO_FILES)
-	$(OCAMLC) -a -o $@ $(CMA_OPT) $(IOM_CMO_FILES)
-
-iom.cmxa iom.a : $(IOM_CMI_FILES) $(IOM_CMX_FILES)
-	$(OCAMLOPT) -a -o $@ $(CMXA_OPT) $(IOM_CMX_FILES)
-
-install:: $(IOM_P_LIB_FILES) iom.cma
-	{ test ! -f iom.cmxa || extra="iom.cmxa iom.a"; }; \
-	ocamlfind install iom \
-	  $(IOM_MLI_FILES) $(IOM_CMI_FILES) $(IOM_P_H_FILES) \
-	  iom.cma $(IOM_P_LIB_FILES) META $$extra
-
-uninstall::
-	ocamlfind remove iom
-
-###############################################################################
-
-TEST_MODULES = iom # relay
-
-TEST_PROGRAMS = $(TEST_MODULES:%=t.%)
-TEST_OPT_PROGRAMS = $(TEST_MODULES:%=t-opt.%)
-
-TEST_ML_FILES = $(TEST_MODULES:%=t/t_%.ml)
-
-TEST_LINKOPT = -cclib -L. -linkpkg
-TEST_LIBS = iom
-
-default:: $(TEST_PROGRAMS)
-
-opt:: $(TEST_OPT_PROGRAMS)
-
-t.% : t/t_%.ml $(TEST_LIBS:%=%.cma)
-	$(OCAMLC) -o $@ $(CMO_OPT) $(TEST_LINKOPT) $(TEST_LIBS:%=%.cma) $<
-
-t-opt.% : t/t_%.ml $(TEST_LIBS:%=%.cmxa)
-	$(OCAMLOPT) -o $@ $(CMX_OPT) $(TEST_LINKOPT) $(TEST_LIBS:%=%.cmxa) $<
-
-test:: $(TEST_PROGRAMS)
-	@for i in $(TEST_PROGRAMS); do echo; echo $$i; ./$$i; done
-
-test.opt:: $(TEST_OPT_PROGRAMS)
-	@for i in $(TEST_OPT_PROGRAMS); do echo; echo $$i; ./$$i; done
-
-clean::
-	rm -f t/*.cmi t/*.cmo
-	rm -f t/*.cmx t/*.o
-	rm -f t.* t-opt.*
-
-###############################################################################
-
-default:: ocamltop
-
-ocamltop: $(TEST_LIBS:%=%.cma)
-	$(OCAMLMKTOP) -o $@ $(CMO_OPT) $(TEST_LINKOPT) $(TEST_LIBS:%=%.cma)
-
-clean::
-	rm -f ocamltop
-
-###############################################################################
-
-DOC_SOURCES = $(IOM_MLI_FILES) $(IOM_ML_FILES)
-
-DOC_INCLUDE_CF = `ocamlfind query cf`
-DOC_INCLUDE_NX = `ocamlfind query nx`
-DOC_ARGS = $(DOC_INCLUDE_CF) $(DOC_INCLUDE_NX) $(DOC_SOURCES)
-
-doc::
-	@mkdir -p doc
-	$(OCAMLDOC) -v -d doc -html -colorize-code -m A $(DOC_SOURCES)
-
-###############################################################################
-
-DEPEND_FILE=.depend
-
-$(DEPEND_FILE) ::
-	#$(OCAMLC) -c -ccopt -MM $(IOM_P_C_FILES) > .depend
-	$(OCAMLDEP) $(IOM_MLI_FILES) $(IOM_ML_FILES) $(TEST_ML_FILES) > .depend
-
-depend:: $(DEPEND_FILE)
-
-include $(DEPEND_FILE)
-
-# End of file [ Makefile ]
         REQUIRES=oni.nx
         ARCHIVES=$(unit.package-archives)
     PKG=$(PKG.add-subpackage $(sub))
+    PKG=$(M.iom.package-search $(PKG))
     PKG.FILES+=$(unit.package-files $(M.iom))
     export PKG
 
         REQUIRES=unix oni.cf
         ARCHIVES=$(unit.package-archives)
     PKG=$(PKG.add-subpackage $(sub))
+    PKG=$(M.nx.package-search $(PKG))
     PKG.FILES+=$(unit.package-files $(M.nx))
     export PKG
 

project/lang/OCaml.om

         ocamldep=$(SelectDriver ocamldep)
         ocamlc=$(SelectDriver ocamlc)
         ocamlopt=$(SelectDriver ocamlopt)
+        ocamldoc=$(SelectDriver ocamldoc)
 
 ### The Objective Caml native/byte-code compilers
 OCaml_compiler.=
         private.libs=$(name).cmxa
         return $(mklib-composer-rule $(name), $(libs), $(cmxfiles), $(dst))
 
+### The OCaml document generator
+OCAMLDOC.=
+    extends $(OCaml_compiler)
+    
+    ### Driver
+    DRIVER()=
+        return $(cmd-driver ocamldoc)
+    
+    ### The verbose flag
+    verbose-flag()=
+        return $(if $(VERBOSE), -v, $(EMPTY))
+    
+    ### Composer options
+    protected.composer-options(src, index)=
+        private.opts=-html -colorize-code -short-functors
+        private.opts+=$(verbose-flag) $(include-search)
+        return $(opts) -d $(dirname $(index)) $(src)
+    
+    ### Generate HTML documents
+    html-documents(srcfiles, dst)=
+        private.index=$(file $(dst)/index.html)
+        private.mlifiles=$(filter %.mli, $(srcfiles))
+        composer-rule($(mlifiles), $(index))
+        return $(index)
+
 ### Component for staging OCaml language compositions
 OCaml_component.=
     class OCaml_component
             cmxa(config)=
                 return $(file $(STAGE.DIR)/$(config)/$(name).cmxa)
         return $r
+    
+    ### Add component to document search path for package
+    package-search(p)=
+        p.DOCSEARCH+=$(this.STAGE.DIR)
+        return $p
 
 ### Class of objects that refer to an OCaml library in a component
 OCaml_library_referral.=
         this.STAGE=$(stage.push $(this.NAME).package)
         this.VERSION=$(src.VERSION)
         this.FILES[]=
+        this.DOCSEARCH[]=
         return $(this)
     
     ### Install target
         $(target):
             -ocamlfind remove $(this.NAME)
         return $(target)
+    
+    ### Documents target
+    documents-target()=
+        private.target=$(addprefix documents-, $(this.NAME))
+        private.dstage=$(this.STAGE.push docs)
+        OCAMLDOC.DEPEND+=$(dstage.DIR)
+        OCAMLDOC.SEARCH+=$(this.DOCSEARCH)
+        return $(OCAMLDOC.html-documents $(this.FILES), $(dstage.DIR))
 
 # End $File$