From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from weis@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id TAA31536 for caml-red; Sat, 28 Oct 2000 19:05:35 +0200 (MET DST) Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id SAA10694 for ; Sat, 28 Oct 2000 18:55:10 +0200 (MET DST) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by concorde.inria.fr (8.11.1/8.10.0) with ESMTP id e9SGt8n09287; Sat, 28 Oct 2000 18:55:08 +0200 (MET DST) Received: (from weis@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id SAA31819; Sat, 28 Oct 2000 18:55:08 +0200 (MET DST) From: Pierre Weis Message-Id: <200010281655.SAA31819@pauillac.inria.fr> Subject: Re: Why does the order in the Makefile matter? In-Reply-To: from Mattias Waldau at "Oct 28, 100 10:01:13 am" To: mattias.waldau@abc.se (Mattias Waldau) Date: Sat, 28 Oct 2000 18:55:08 +0200 (MET DST) Cc: caml-list@inria.fr X-Mailer: ELM [version 2.4ME+ PL28 (25)] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: weis@pauillac.inria.fr > Two runs 'make all', the only difference in the order in the OBJS-line in > the Makefile. > > What is the needed order? Should I use the order of .depend? A Caml implementation file (a .ml file) is a list of definitions and expression evaluations. -- definitions can only refer to preceding definitions (due to the so-called ``static'' binding rule) and cannot refer to following definitions. -- top-level expressions may appear anywhere in implementation files and those expressions define the runtime computation. They must be evaluated in the exact order specified by the user in his source file (otherwise strange things may happen if ``exit 0;;'' is evaluated before ``main ();;''!). Hence, when the entire program is made of multiple implementation files, those files must be linked in any order that is compatible with the static binding rule: no definition can be linked if it refers to an identifier that is defined after the definition at hand. In addition, expressions to be computed must evidently appear in any order compatible with the desired runtime behaviour. Hope this helps, Pierre Weis INRIA, Projet Cristal, Pierre.Weis@inria.fr, http://cristal.inria.fr/~weis/