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.8 required=5.0 tests=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 E0C51BC37 for ; Tue, 18 Aug 2009 04:00:37 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AoABALOoiUrRVdK2kGdsb2JhbACaQz8BAQEBCQkMBxMDqWOBI49ZAQMCBIQVBYFN X-IronPort-AV: E=Sophos;i="4.43,399,1246831200"; d="scan'208";a="34512301" Received: from mail-yx0-f182.google.com ([209.85.210.182]) by mail1-smtp-roc.national.inria.fr with ESMTP; 18 Aug 2009 04:00:31 +0200 Received: by yxe12 with SMTP id 12so4089250yxe.1 for ; Mon, 17 Aug 2009 19:00:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from :user-agent:mime-version:to:subject:content-type :content-transfer-encoding; bh=l2yMJiaYaJV8ODttg4jkSZ0JG3U/osYV79xa9wgDCLA=; b=LseYe+bcb5ONs8ML3PVkIgrAhQMVPfK1rGity0NKZZ3AEbgdfveN22KzAHBCdrFTa1 ItvcPomJcH1mjlH93MDCfxMSdUCi4kim+16J/q8ibvLF9dj3SHLp38RMLS71KmKLm7hu 7ofYml5ep3sfEGRfUzsZVrLSVyr3c4SZhZTHU= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:subject :content-type:content-transfer-encoding; b=LaS81RpbwHbs3ldoOlJvti15Nbc5kzunv1BWylYawOhI3M+IZgHx97UE7KCIZ7DwTk zWdaMyPEKIKEcNcls5rKsfjOlCEXaFZXIaFJlSoT/b8IggVO9JFb3rMVTqvJKK1gzsZI zVGUheB25EE8y/Wab3epE8JiUqaNtJEMT9KyE= Received: by 10.90.216.7 with SMTP id o7mr3325236agg.45.1250560831058; Mon, 17 Aug 2009 19:00:31 -0700 (PDT) Received: from ?192.168.1.100? ([72.44.99.175]) by mx.google.com with ESMTPS id 39sm9587303agd.46.2009.08.17.19.00.29 (version=TLSv1/SSLv3 cipher=RC4-MD5); Mon, 17 Aug 2009 19:00:30 -0700 (PDT) Message-ID: <4A8A0B3C.10504@gmail.com> Date: Mon, 17 Aug 2009 22:00:28 -0400 From: Edgar Friendly User-Agent: Thunderbird 2.0.0.22 (X11/20090608) MIME-Version: 1.0 To: caml-list@yquem.inria.fr Subject: Conditional compilation Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam: no; 0.00; compilation:01 autoconf:01 command-line:01 autoconf:01 compilation:01 ocaml:01 camlp:01 command-line:01 -let:01 -pp:01 ocamlc:01 camlp:01 -pp:01 -let:01 cmo':01 I'm working on a project that has significant build infrastructure using autoconf, make and ocamlbuild. I want to have a reasonably simple trigger, such as a command-line argument to autoconf. The result of activating this trigger would be to drastically reduce what gets compiled -- many files wouldn't need to be compiled, and many sections of files should be commented out. The project already uses optcomp for some conditional compilation based on ocaml version. I've learned that optcomp creates a new camlp4 command-line flag, [-let], which accepts a "var=value" pair and sets that for use in [#if var = value] triggers. I've also dug into ocamlbuild and found a way to set this flag within the [-pp] argument to ocamlc. I've hit some hurdles, and wonder how to overcome them: 1) optcomp is sometimes used as a standalone camlp4 executable (-pp 'build/optcomp/optcomp_o.byte') - in this mode, it seems to accept only the name of a file as input, and doesn't take the [-let] argument. What is the difference between this and "-pp 'camlp4oof build/optcomp/pa_optcomp.cmo'"? 2) I'm using the identifier "AAA" for my trigger, and I can use ocamlbuild's tags system to set "-let AAA=true" when the tag "AAA" is set - is there any way to do "-let AAA=false" when tag "AAA" is unset? Optcomp gives a compilation error on bound identifiers, so I have to set it in both cases. Is there a better way to do this? The path I'm following is looking very byzantine compared to C's [-DFOO] + [#ifdef FOO]. E