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=2.4 required=5.0 tests=AWL,DNS_FROM_RFC_POST, SPF_NEUTRAL autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail1-relais-roc.national.inria.fr (mail1-relais-roc.national.inria.fr [192.134.164.82]) by yquem.inria.fr (Postfix) with ESMTP id A0DE2BB84 for ; Fri, 12 Dec 2008 22:38:08 +0100 (CET) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AjYCAP9oQknRVciqkGdsb2JhbACTEz4BAQEBCQkMBxEDr26LbwEDAQOCeoIt X-IronPort-AV: E=Sophos;i="4.36,213,1228086000"; d="scan'208";a="21200016" Received: from wf-out-1314.google.com ([209.85.200.170]) by mail1-smtp-roc.national.inria.fr with ESMTP; 12 Dec 2008 22:38:07 +0100 Received: by wf-out-1314.google.com with SMTP id 24so1420803wfg.15 for ; Fri, 12 Dec 2008 13:38:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:sender :to:subject:cc:in-reply-to:mime-version:content-type :content-transfer-encoding:content-disposition:references :x-google-sender-auth; bh=QURYeURa0k/CervmPluCm10xqermZ+QsJ8gvYbLUPZE=; b=SdG2jCcsLMSV/NoprlRjfvUu49REuTmHBoz0QSlOtNmMYZ84UETnD/cw4nfJGUouEc pDVCy/17D8spMOOyp4+erWAtUrea8Qo2Yyg987MoyJ6noKYjbkNONcSPqTsbOi8kkInK vTKm9qKuNtCgqqz+spLfHs3vM8XrslYvVvY80= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:sender:to:subject:cc:in-reply-to:mime-version :content-type:content-transfer-encoding:content-disposition :references:x-google-sender-auth; b=Vctb35pKUSj2vorcqe3cxVucQvOzq6weQAXuY9NQ+7TplIP6FVwU6MdI5ingrO9oHP T1R78XSvNsKpEJiEi2ZrDYT7ymOGjZmTQzI7LTMoarWrd+vGmmgrDaIULur2kLlLOy+/ 4M1x5oQFTqaF6d5M2J1lbVN9hOwJNOsTZbFYk= Received: by 10.142.153.7 with SMTP id a7mr1519369wfe.294.1229117887100; Fri, 12 Dec 2008 13:38:07 -0800 (PST) Received: by 10.142.13.3 with HTTP; Fri, 12 Dec 2008 13:38:07 -0800 (PST) Message-ID: Date: Fri, 12 Dec 2008 22:38:07 +0100 From: "=?UTF-8?Q?Mikkel_Fahn=C3=B8e_J=C3=B8rgensen?=" Sender: mikkelfj@gmail.com To: "Anastasia Gornostaeva" Subject: Re: [Caml-list] ocamlbuild: add source files on the fly Cc: caml-list@yquem.inria.fr In-Reply-To: <20081211184358.GA84210@ermine.home> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <20081211184358.GA84210@ermine.home> X-Google-Sender-Auth: 13e5d713a19b64e1 X-Spam: no; 0.00; mikkel:01 rgensen:01 mikkel:01 makefile:01 dependencies:01 ocamlyacc:01 parser:01 caml-list:01 dependency:01 lex:01 native:03 usual:06 depend:07 instance:10 example:10 2008/12/11 Anastasia Gornostaeva : > Hello. > > How can I add additional source files for a program on fly? For instance, in > usual Makefile I can do: > > SOURCES = file1.ml file2.ml file3.ml > SOURCES += $(USER_SELECTED_PLUBINS) > SOURCES += file4.ml ocamlbuild scans dependencies automatically, so if the other files are needed by the main program, you only have to build that single file. For example, ocamlbuild file4.native will depend of file4.ml and if the file has a statement like open File3 open File2 etc. then these are included in the build. This also works for ocamlyacc and lex parser files. If you build libraries, ocamlbuild has a .mllib file you can add files to. If you also need C files, you need something more. Here I developed ocamlbuild-ctools, where you can add c files to a .cprog file and a .clib file. Ocamlbuild also has some C support, but it is more limited and has no dependency scanning. Regards, Mikkel