From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by c5ff346549e7 (Postfix) with ESMTPS id 6C80A5D5 for ; Sun, 13 Jan 2019 14:22:59 +0000 (UTC) X-IronPort-AV: E=Sophos;i="5.56,474,1539640800"; d="scan'208,217";a="363829114" Received: from sympa.inria.fr ([193.51.193.213]) by mail2-relais-roc.national.inria.fr with ESMTP; 13 Jan 2019 15:22:58 +0100 Received: by sympa.inria.fr (Postfix, from userid 20132) id 448CA7FFA1; Sun, 13 Jan 2019 15:22:58 +0100 (CET) Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by sympa.inria.fr (Postfix) with ESMTPS id 241CF7FEFC for ; Sun, 13 Jan 2019 15:22:52 +0100 (CET) Authentication-Results: mail2-smtp-roc.national.inria.fr; spf=None smtp.pra=robert.muller2@gmail.com; spf=Pass smtp.mailfrom=robert.muller2@gmail.com; spf=None smtp.helo=postmaster@mail-lj1-f176.google.com IronPort-PHdr: =?us-ascii?q?9a23=3Ahm682hTmrdfBv+66DfWCsp0hYNpsv+yvbD5Q0YIu?= =?us-ascii?q?jvd0So/mwa6ybRSN2/xhgRfzUJnB7Loc0qyK6/CmATRIyK3CmUhKSIZLWR4BhJ?= =?us-ascii?q?detC0bK+nBN3fGKuX3ZTcxBsVIWQwt1Xi6NU9IBJS2PAWK8TW94jEIBxrwKxd+?= =?us-ascii?q?KPjrFY7OlcS30P2594HObwlSizexfbB/IA+qoQnNq8IbnZZsJqEtxxXTv3BGYf?= =?us-ascii?q?5WxWRmJVKSmxbz+MK994N9/ipTpvws6ddOXb31cKokQ7NYCi8mM30u683wqRbD?= =?us-ascii?q?VwqP6WACXWgQjxFFHhLK7BD+Xpf2ryv6qu9w0zSUMMHqUbw5Xymp4rx1QxH0li?= =?us-ascii?q?gIKz858HnWisNuiqJbvAmhrAF7z4LNfY2ZKOZycqbbcNgHR2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CjY0HIton40+Jn1lEtDntSjtmjKwCuZMxbOODZ0wtKnb2iqpfpsv+zP9zK?= =?us-ascii?q?AkymIebI5POGmh3PAt8gHSA8vNkRzcmf/1K+IT2ynC8GrFxm2L7hlV?= X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: =?us-ascii?q?A0BTAAANSTtchrDQVdFZChwBAQEEAQEHB?= =?us-ascii?q?AEBgVQEAQELAQGBVAWBD4ECJ4QBgR2CXpAKgg2YEIFnDSOESQKCKRoHAQQzBg0?= =?us-ascii?q?BAwEBAgEBAQEBEwEBAQgLCwgpIwxCAQwBgWopAYJmAQEBAQIBIwQZARsdAQMBC?= =?us-ascii?q?wYFCw0qAgIhAQERAQUBHAYTgyIBgWgBAw0ID6FePIsbfBYFAReCeAWELQoZJw1?= =?us-ascii?q?egR0aAgYSjC2CFoNuNYJXRwKBKQ1YglyCVwKBKwGOT4EAkFYzBgECgVhWhG6HN?= =?us-ascii?q?4M1GIIxj06PBoETikQPIYE7gXgzGiNQMW2BTgmCEhqBCQEIgROBL4QghlEkMAG?= =?us-ascii?q?CTIgRAQE?= X-IPAS-Result: =?us-ascii?q?A0BTAAANSTtchrDQVdFZChwBAQEEAQEHBAEBgVQEAQELAQG?= =?us-ascii?q?BVAWBD4ECJ4QBgR2CXpAKgg2YEIFnDSOESQKCKRoHAQQzBg0BAwEBAgEBAQEBE?= =?us-ascii?q?wEBAQgLCwgpIwxCAQwBgWopAYJmAQEBAQIBIwQZARsdAQMBCwYFCw0qAgIhAQE?= =?us-ascii?q?RAQUBHAYTgyIBgWgBAw0ID6FePIsbfBYFAReCeAWELQoZJw1egR0aAgYSjC2CF?= =?us-ascii?q?oNuNYJXRwKBKQ1YglyCVwKBKwGOT4EAkFYzBgECgVhWhG6HN4M1GIIxj06PBoE?= =?us-ascii?q?TikQPIYE7gXgzGiNQMW2BTgmCEhqBCQEIgROBL4QghlEkMAGCTIgRAQE?= X-IronPort-AV: E=Sophos;i="5.56,474,1539640800"; d="scan'208,217";a="363829107" Received: from mail-lj1-f176.google.com ([209.85.208.176]) by mail2-smtp-roc.national.inria.fr with ESMTP/TLS/AES128-GCM-SHA256; 13 Jan 2019 15:22:51 +0100 Received: by mail-lj1-f176.google.com with SMTP id u89-v6so16795443lje.1 for ; Sun, 13 Jan 2019 06:22:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=XT7cF0RE0zW4yC2dAeodOLXOAgSm53OGPc1T9qkFjos=; b=hu2wD1rF+SZhNDqP2gKtDWsCqICTbqW9+rF+KHoyFzCZlz4T75n3cGS6cYI13bHTqx kW3LKEZja8aB6PXMtPGZ7MzFkpyauiRR1iMaz7UlfxzPwiK6oAzghyrcYmLoQeP8Lzdk HC0vb33431smulSPJhwr5UeKUeeIWspleN6Ufm2ysf3wnsQ+p6mhe8xKVcrmVBd9+KWM HWuh9t3gDNhognhrn5Vebo/JF5tcZW/G5dvZOpTE7lMZzvICT73YbSOByWoNGkly3/8y 4wzicLSd5aFWxCClN5cnymSYVV1jV21XZvkGtF6nsDJEPUYLWBHUalb8wMxkvNtw4g2b hlbQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=XT7cF0RE0zW4yC2dAeodOLXOAgSm53OGPc1T9qkFjos=; b=BS/XLb0fEOywbC5um2iOzGclSGojX92e+sqwUx8hDapTrL/+wPrXFLXcTVd3dRKucz Zbw7WJGwRzm8JnRKEamXYiuqCcGgNvRFvFtrGWcnGlpR9wYMiDZ7ILYFermnFZs6Vg3B /tlhmFBjcr4I7KmGxPWyfZXOtomhb+DGlL6k28CNk6jYCO1NFKryAfCCcsoVUxM1K7aD 1rSw4SeW4iQqiuwZaPyoSTeuB/cEinIR5g8dti3rC6ns5WXXjJ0VD3BZdKOsfWJvLsMa 9YA/nAbsma1D9nz8qrcAAFAmEhDtGJsSg3X3bg6YatlStHop2zfWtfKk4Tu3cPwuiwx+ lmPA== X-Gm-Message-State: AJcUukfcef+W5sb3XJH5x0rek8Kx+thKzYcns44G5WEDHl2p9Iqr72yS wQXR16cmBJ5wbpH8fbpEgdKARlwXBiIxU8OWd5ZFZA== X-Google-Smtp-Source: ALg8bN6nd7Jr/0V48uk0qTyVxjQmrboqocgsNMLRAvK4LVedZRAIdLg81gI8oRmV3HtptvWQhaQi9KCGo23PnmZLqUU= X-Received: by 2002:a2e:b1ca:: with SMTP id e10-v6mr13720503lja.16.1547389370341; Sun, 13 Jan 2019 06:22:50 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Robert Muller Date: Sun, 13 Jan 2019 09:22:38 -0500 Message-ID: To: =?UTF-8?Q?Nicol=C3=A1s_Ojeda_B=C3=A4r?= Cc: Ocaml Mailing List Content-Type: multipart/alternative; boundary="000000000000bfa05d057f57a970" Subject: Re: [Caml-list] make -> dune: recommended structure Reply-To: Robert Muller X-Loop: caml-list@inria.fr X-Sequence: 17296 Errors-to: caml-list-owner@inria.fr Precedence: list Precedence: bulk Sender: caml-list-request@inria.fr X-no-archive: yes List-Id: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: --000000000000bfa05d057f57a970 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable This is fantastic, thank you. I could be wrong but I think my setup is common enough that it would probably be helpful to have some variation of your answer as an example in the dune documentation and possibly in the quick-start guide. I suppose I could submit a PR to https://github.com/ocaml/dune/tree/master/example. Thanks again, Bob On Sun, Jan 13, 2019 at 9:07 AM Nicol=C3=A1s Ojeda B=C3=A4r < nicolas.ojeda.bar@lexifi.com> wrote: > Dear Bob, > > Your present directory structure is just fine. A single `dune` file at > `src/dune` with the contents > > (executable > (name compile) > (public_name translate)) > > should be enough. Here I am assuming that all modules in `src/` are part > of the compiler. If this is not the case you need to specify the modules > you want to include as follows: > > (executable > (name compile) > (public_name translate) > (modules compile ast symbol ...)) > > Note: if you have a file `parser.mly` in your project that needs to be > processed with `ocamlyacc` then you need to declare this in its own stanz= a: > > (ocamlyacc parser) > > Similarly an `ocamllex` file `lexer.mll` needs to be declared with > > (ocamllex lexer) > > Finally, you need to make sure there is a `.opam` file at the root of > your project. This file can be be empty if you do not actually use `opam` > but the name `foo` is used by `dune` to identify the "package" your > executable belongs to. Once these files are in place, you can build your > project with > > dune build > > Best wishes, > Nicol=C3=A1s > > On Sun, 13 Jan 2019 at 14:31, Robert Muller > wrote: > >> Greetings. I have a toy compiler made up of ~20 modules: >> >> ast.mli ast.ml symbol.mli symbol.ml ... >> >> and a top-level in compile.ml. These sources are compiled and linked >> using a Makefile which invokes ocamlc. I'll call the resulting compiler >> "translate". >> >> At present I have *all* of these files resident in a single src/ >> directory. I'm considering converting the build to dune for the semester. >> What would the recommended directory structure be and what would the dune >> file(s?) and stanzas look like? I assume this is in the middle of dune's >> wheelhouse but I wasn't able to find anything on it in the examples or >> documents. I assume/hope I don't have to put the modules in a library. >> Thank you, >> Bob Muller >> > --=20 Caml-list mailing list. Subscription management and archives: https://sympa.inria.fr/sympa/arc/caml-list https://inbox.ocaml.org/caml-list Forum: https://discuss.ocaml.org/ Bug reports: http://caml.inria.fr/bin/caml-bugs= --000000000000bfa05d057f57a970 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
This is fantastic, thank you. I could be = wrong but I think my setup is common enough that it would probably be helpf= ul to have some variation of your answer as an example in the dune document= ation and possibly in the quick-start guide. I suppose I could submit a PR = to=C2=A0https://github.com/ocaml/dune/tree/master/example.
Thanks again,
Bob


On Sun, Jan 13, 2019 at 9:07 AM Nicol=C3= =A1s Ojeda B=C3=A4r <nicolas.ojeda.bar@lexifi.com> wrote:
Dear Bob,

Your present directory structure is just fine. A single `= dune` file at `src/dune` with the contents

=C2=A0 =C2=A0 (executable
=C2=A0 =C2=A0 =C2=A0(name compile)
=C2=A0 =C2=A0 =C2=A0(public_name translate))

should be enough. Here I am assuming that all modules in `src/` are pa= rt of the compiler. If this is not the case you need to specify the modules= you want to include as follows:

=C2=A0 =C2=A0 (executable
=C2=A0 =C2=A0 =C2=A0(name compile)
=C2=A0 =C2=A0 =C2=A0(public_name translate)
=C2=A0 =C2=A0 =C2=A0(modules compile ast symbol ...))

Note: if you have a file `parser.mly` in your project that needs to be= processed with `ocamlyacc` then you need to declare this in its own stanza= :

=C2=A0 =C2=A0 (ocamlyacc parser)

Similarly an `ocamllex` file `lexer.mll` needs to be declared with

=C2=A0 =C2=A0 (ocamllex lexer)

Finally, you need to make sure there is a `<foo>.opam` file at t= he root of your project. This file can be be empty if you do not actually u= se `opam` but the name `foo` is used by `dune` to identify the "packag= e" your executable belongs to. Once these files are in place, you can build your project with

=C2=A0 =C2=A0 dune build

Best wishes,
Nicol=C3=A1s

On Sun, 13 Jan 2019 at 14:31, Robert Muller <robert.muller2@gmail.co= m> wrote:
Greetings. I have a toy compiler made up of ~20 modules:

ast.mli ast.ml symbol.= mli symbol.ml ...=C2=A0

and a top-level in com= pile.ml. These sources are compiled and linked using a Makefile which i= nvokes ocamlc. I'll call the resulting compiler "translate".<= /div>

At present I have *all* of these files resident in a single src/ direc= tory. I'm considering converting the build to dune for the semester. Wh= at would the recommended directory structure be and what would the dune fil= e(s?) and stanzas look like? I assume this is in the middle of dune's wheelhouse but I wasn't able to fi= nd anything on it in the examples or documents. I assume/hope I don't h= ave to put the modules in a library.
Thank you,
Bob Muller=C2=A0
--000000000000bfa05d057f57a970--