From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: * X-Spam-Status: No, score=1.0 required=5.0 tests=AWL,SPF_NEUTRAL, UPPERCASE_25_50 autolearn=disabled version=3.1.3 Received: from discorde.inria.fr (discorde.inria.fr [192.93.2.38]) by yquem.inria.fr (Postfix) with ESMTP id 17A7BBC69 for ; Wed, 28 Mar 2007 10:28:50 +0200 (CEST) Received: from ug-out-1314.google.com (ug-out-1314.google.com [66.249.92.173]) by discorde.inria.fr (8.13.6/8.13.6) with ESMTP id l2S8SYLL005923 for ; Wed, 28 Mar 2007 10:28:49 +0200 Received: by ug-out-1314.google.com with SMTP id k3so160732ugf for ; Wed, 28 Mar 2007 01:28:49 -0700 (PDT) DKIM-Signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:mime-version:content-transfer-encoding:message-id:content-type:to:from:subject:date:x-mailer; b=heziRtKe0XWesSIYw3f/EsuI3jkegI1Nz23CHyuTF7BApU7Pyd42p7JpLN3C3I/GW7wj7qAOJfwaSZbpMyzOYNcW17FrQXA+TNAu6jbMLYoNficuIIULwwA4JHS3FuHc7MS5aJ+K9PqQMyjqU15nOWMZgVBvXdtHkN0ZCJS8tDM= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:mime-version:content-transfer-encoding:message-id:content-type:to:from:subject:date:x-mailer; b=i8+pxXD/x11LfKp7LFnpehntanU4nBJc8g42PUIOS/0yJk4Y7PWk6ZStES8PAFHPXgjrUA3Ak1GLFwkkUsjSbwA3O8pH6sLnLN9uI8XnoggMkhMCnS6FNUImg22o90Zm2crntMBDN1+EW1mI4Ylgq8CbtVXMgm57b3g38SVxqoc= Received: by 10.67.88.17 with SMTP id q17mr251133ugl.1175070529636; Wed, 28 Mar 2007 01:28:49 -0700 (PDT) Received: from ?192.168.1.34? ( [88.7.141.133]) by mx.google.com with ESMTP id i39sm586885ugd.2007.03.28.01.28.48; Wed, 28 Mar 2007 01:28:48 -0700 (PDT) Mime-Version: 1.0 (Apple Message framework v752.3) Content-Transfer-Encoding: 7bit Message-Id: <755EDEB6-46CF-4212-8D37-2F83E62550E2@gmail.com> Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed To: Caml List From: Joel Reymont Subject: Can this OMakefile be simplified? Date: Wed, 28 Mar 2007 09:28:46 +0100 X-Mailer: Apple Mail (2.752.3) X-j-chkmail-Score: MSGID : 460A2732.000 on discorde : j-chkmail score : XXX : 5/20 1 0.000 -> 3 X-Miltered: at discorde with ID 460A2732.000 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; bindings:01 ocaml:01 bindings:01 pointers:01 cmo:01 cmx:01 cmifiles:01 cmi:01 lib:01 cmxa:01 lib:01 stubs:01 ocamlfind:01 ocamlcflags:01 ocaml:01 I found this OMakefile in the sqlite3 bindings for OCaml. I'm trying to package my translator as a set of C bindings and I wonder if this Omakefile can be made simpler. Any suggestions? Pointers to simpler Omakefiles for other C bindings? Thanks in advance, Joel ########################################### SubstVersion(output, input) = # should use fsubst, but it doesn't seem to be # working properly in 0.9.2. $(output) : $(input) sed "s%@VERSION@%$(VERSION)%g" < $< > $@ ########################################### OCamlLibraryExt(name, files, cfiles) = OFILES = $(addsuffix $(EXT_OBJ), $(cfiles)) CMOFILES = $(addsuffix .cmo, $(files)) CMXFILES = $(addsuffix .cmx, $(files)) CMIFILES = $(addsuffix .cmi, $(files)) CLIB = $(file $(name)$(EXT_LIB)) BYTELIB = $(file $(name).cma) NATIVELIB = $(file $(name).cmxa) STUBLIB = lib$(name)_stubs # Create C library to contain all the object files... StaticCLibrary($(STUBLIB), $(cfiles)) # Link commands # TODO: Doesn't work with ddls... $(BYTELIB): $(CMOFILES) $(STUBLIB)$(EXT_LIB) $(OCAMLFIND) $(OCAMLLINK) $(OCAMLFLAGS) $(OCAMLCFLAGS) \ $(OCAML_LIB_FLAGS) -a -custom -cclib -l$(name)_stubs \ -o $@ $(OCamlLinkSort $(CMOFILES)) $(NATIVELIB) $(CLIB): $(CMXFILES) $(STUBLIB)$(EXT_LIB) $(OCAMLFIND) $(OCAMLOPTLINK) $(OCAMLFLAGS) $(OCAMLOPTFLAGS) \ $(OCAML_LIB_FLAGS) -a -cclib -l$(name)_stubs -o \ $(NATIVELIB) $(OCamlLinkSort $(CMXFILES)) # Add to targets if $(NATIVE_ENABLED) library: $(NATIVELIB) if $(BYTE_ENABLED) library: $(BYTELIB) # Program with tag for executables OCamlProgramExt(tag, name, sources) = OCamlProgram($(name), $(sources)) if $(NATIVE_ENABLED) $(tag) : $(name).opt if $(BYTE_ENABLED) $(tag) : $(name).run ############################### .PHONY : library examples install dist VERSION = $(nth 0, $(rev $(split -, $(dir .)))) OCAMLFLAGS = -w A OCAMLPPFLAGS = -pp camlp4r OCAMLDEPFLAGS = -pp camlp4r BYTE_ENABLED = true NATIVE_ENABLED = true OCAMLLIBDIR = $(shell ocamlfind printconf stdlib) CFLAGS = -Wall -Werror -I $(OCAMLLIBDIR) PKG = $(basename $(absname $(dir .))) # Targets in subdirectories... .SUBDIRS: lib examples # Targets: .DEFAULT: library examples # Distribution: dist : .DEFAULT tar -C $(dir ..) -c -j -f $(dir ..)/$(PKG).tar.bz2 \ $(addprefix $(PKG)/, $(shell bzr inventory --kind file)) -- http://wagerlabs.com/