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.2 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 mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by yquem.inria.fr (Postfix) with ESMTP id 27883BB84 for ; Mon, 26 Jan 2009 23:58:32 +0100 (CET) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: An4BANDOfUnRVdsVimdsb2JhbACTQD8BAQEKCQwHDwWnWY0vAQMBA4VIgyM X-IronPort-AV: E=Sophos;i="4.37,327,1231110000"; d="scan'208";a="22058323" Received: from mail-ew0-f21.google.com ([209.85.219.21]) by mail3-smtp-sop.national.inria.fr with ESMTP; 26 Jan 2009 23:58:31 +0100 Received: by ewy14 with SMTP id 14so1453565ewy.9 for ; Mon, 26 Jan 2009 14:58:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:received:in-reply-to :references:date:x-google-sender-auth:message-id:subject:from:to:cc :content-type:content-transfer-encoding; bh=Kr4/Uz8wbV84K/7vPK2QufKsf9atcUFxqq//OAxUbf4=; b=NPgqq1rusMHI8N+FuKRzGIrF6NJsDYfCumA2OLDF4K5pfLUVm67jukr3AkaF6L3NX9 DL/rzBNHCdG2it3MZL//C5JQgKGvrhP8Uh15bQhBb5HeJt5LZh1O3O81yo+nyxOslxtv i1j30P6fsbPxabV/RB741EONwfPBiktfAE2JE= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; b=Iksarqo2BvyXzH/d8lgjlASJTZLWouAjpEyn2/0doR7YNNtKbAHa1Sor4EccPguQpl IKCZquHaqTDn0ctel9OMJ32fmBtYCtbPNzOns7JRRrm/t/hTUfSaIWejsUzw3LWwcP2m R1vE1QoQf67lGVc75wH1QKsYroQc2bRecAgSU= MIME-Version: 1.0 Sender: mikkelfj@gmail.com Received: by 10.210.92.11 with SMTP id p11mr4547298ebb.2.1233010711216; Mon, 26 Jan 2009 14:58:31 -0800 (PST) In-Reply-To: <1233005104.20843.25.camel@Blefuscu> References: <1233005104.20843.25.camel@Blefuscu> Date: Mon, 26 Jan 2009 23:58:31 +0100 X-Google-Sender-Auth: eacd8cdd491dbfb4 Message-ID: Subject: Re: [Caml-list] Conditional compilation wrt OCaml version? From: =?UTF-8?Q?Mikkel_Fahn=C3=B8e_J=C3=B8rgensen?= To: David Rajchenbach-Teller Cc: OCaml Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam: no; 0.00; compilation:01 ocaml:01 mikkel:01 rgensen:01 mikkel:01 compilation:01 ocaml:01 camlp:01 cpp:01 autoconf:01 hackery:01 syntax:01 mingw:01 caml-list:01 variant:02 > Working on Batteries, we're faced with a few places where we'd like to > perform conditional compilation depending on the version of OCaml being > used. We could probably do this with Camlp4, cpp, Autoconf hackery, etc. > -- but first, we need to decide on which of these options we'll adopt. > > Any suggestion? If you are interested in using ocamlbuild you can have a look at ocamlbuild-ctools: http://dvide.com/labs/ocamlbuild-ctools/ I added extensions to ocamlbuild using a syntax like normalfile.o [mytag,myothertag,~notthistag] conditionalfile.o ... this is done in a .cprog file that lists all files to include, but that same could be done with other similar files e.g. .mllib Also, I added multi-variant builds so the same build can handle multiple build targets based on tags - for example debug and release builds. Multivariant builds work by adding tags in the filename: myfile.variant_release,mingw.o Most of this could be integrated into ocamlbuild, but ocamlbuild is not very actively maintained as I understand. Mikkel