From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Max Nikulin Newsgroups: gmane.emacs.bugs Subject: bug#62762: circular dependencies in elisp files and make Date: Sat, 13 May 2023 17:25:06 +0700 Message-ID: <63ccd7e3-f622-eef3-0ce4-4e7da4b92bb6@gmail.com> References: <17b74a48-94e1-9106-cc79-d31972313910@gutov.dev> <1c5d0ff0-5bae-1123-d2f7-64d9013fbc0f@gmail.com> <6070e598-7dee-1b7a-7f97-26a90618cb7a@gmail.com> <64a61548-e343-992f-d193-d8ff4fe0623b@gmail.com> <831qjvjmw5.fsf@gnu.org> <48f15926-d002-877b-1d01-3a607fe42b76@gmail.com> <83v8h7hxlj.fsf@gnu.org> <38c89611-a929-1869-e70d-983bd7edad14@gmail.com> <83jzxnhv2o.fsf@gnu.org> <59ccf87f-effb-2168-2c17-34d950060b1b@gmail.com> <83354aixqy.fsf@gnu.org> <3ce7d18d-8190-a379-f503-5b0fef1dcb88@gmail.com> <831qjuisa4.fsf@gnu.org> <83y1lu505p.fsf@gnu.org> <9d8db5af-1917-1d0a-0360-ac122e137a53@gmail.com> <83ttwhbn7b.fsf@gnu.org> <9aa7edb6-c6c4-39ad-4302-371e5e58b4f6@gmail.com> <83sfc1bkt3.fsf@gnu.org> <83zg68afn9.fsf@gnu.org> <16f3f59c-ce2c-2b0d-fe56-8a85b79a1b3f@gmail.com> <83y1lsaaay.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="34308"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.10.0 Cc: yantar92@posteo.net, 62762@debbugs.gnu.org, bzg@gnu.org, dmitry@gutov.dev, monnier@iro.umontreal.ca, acm@muc.de To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat May 13 12:26:14 2023 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pxmS5-0008iR-2F for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 13 May 2023 12:26:13 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pxmRv-0007FL-Uw; Sat, 13 May 2023 06:26:03 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pxmRu-0007Dy-M8 for bug-gnu-emacs@gnu.org; Sat, 13 May 2023 06:26:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pxmRu-0007lp-Bn for bug-gnu-emacs@gnu.org; Sat, 13 May 2023 06:26:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pxmRu-0004kz-55 for bug-gnu-emacs@gnu.org; Sat, 13 May 2023 06:26:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Max Nikulin Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 13 May 2023 10:26:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 62762 X-GNU-PR-Package: emacs Original-Received: via spool by 62762-submit@debbugs.gnu.org id=B62762.168397352117906 (code B ref 62762); Sat, 13 May 2023 10:26:02 +0000 Original-Received: (at 62762) by debbugs.gnu.org; 13 May 2023 10:25:21 +0000 Original-Received: from localhost ([127.0.0.1]:36041 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pxmRE-0004ej-L4 for submit@debbugs.gnu.org; Sat, 13 May 2023 06:25:21 -0400 Original-Received: from mail-lj1-f176.google.com ([209.85.208.176]:44059) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pxmR9-0004eP-RD for 62762@debbugs.gnu.org; Sat, 13 May 2023 06:25:19 -0400 Original-Received: by mail-lj1-f176.google.com with SMTP id 38308e7fff4ca-2ac826a1572so112422361fa.0 for <62762@debbugs.gnu.org>; Sat, 13 May 2023 03:25:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1683973510; x=1686565510; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :sender:from:to:cc:subject:date:message-id:reply-to; bh=xU2tog0EHd6VOX3BDyc/hTQGekH4bv9CPfU6tErCZJQ=; b=Ig9wxF1kueXtRM1l+KcjBHNy3L9Y0wsGmYfR/2GRsP9whvUaPGwEv3d6xbch/wpuFq fVfoVfpSh0flU9VlYlmfFREP/0P4YAJAwfW2VgbHr5vJibNi2Lmhk1gybwbwBKYjS1YG 1YIQR+tGb37oXvdsth5zN9/0ic6zEmNexPFE/5Js2R8MVIDLJn+vDC99WYpdGJ8c2cI0 +1Jlqq6KAhotrXJqEDnIqU6c9biryX+JDdnsClc34/BFkl9UmZXkLnGR7wXH2D3mvCF5 LyhtOwHDbZRn27XCKzrXvGXartPQf/EF8sqJRvrqIDFMbuymh8Vcyb1DQDAepCstMSeJ QUkw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683973510; x=1686565510; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :sender:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=xU2tog0EHd6VOX3BDyc/hTQGekH4bv9CPfU6tErCZJQ=; b=bxxvXHUBmeJgSc9Xqp3C5gZsybksx7ZQT7DeKHDRvpVl+16ApbLeovDZ7QdLPZiRYf zVamFuz95MOtu3N0TzCBhlafLXStM6Qrlyx4nI+PrPkgspQQs9OIO4k/I7uUxDDQTBun Tlb686fGZQbzxQX9+hXKhN5dQKLL1TcZSn6/MHk7JlsvAfxkHui4Kn53/kU8TL30HXxV zgGuhpB/nvuWLu3xLkJRcL3N6IMZw2v8zMNNuZIPpW2Uf2YaBUBXmJ7zRz51M3Sj/qII I7nQAFRyA6T3+vEShx29e9fDZUDoZfQtXO4frj4SzenWF6t86WBoTmP1Mi0tWcpTihp4 nkqQ== X-Gm-Message-State: AC+VfDxipfXpuAPDaugE4J7s6CLPmrKfGXW4wLTZhGsgQ/dYws4gc+v+ 4OXx1kX1qdjMPwBLx2aeSZw= X-Google-Smtp-Source: ACHHUZ5mtUhTKBBdtmr0oCqXPLSA0QPzECXR6unMlS7FBBIm8xBkjSpGxhFafpttsmEH2SCaNYvx3g== X-Received: by 2002:a2e:9605:0:b0:295:9be0:212b with SMTP id v5-20020a2e9605000000b002959be0212bmr5728817ljh.8.1683973509415; Sat, 13 May 2023 03:25:09 -0700 (PDT) Original-Received: from [192.168.0.101] (nat-0-0.nsk.sibset.net. [5.44.169.188]) by smtp.googlemail.com with ESMTPSA id n15-20020a2e86cf000000b002ac833114besm1221898ljj.47.2023.05.13.03.25.08 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 13 May 2023 03:25:08 -0700 (PDT) Content-Language: en-US In-Reply-To: <83y1lsaaay.fsf@gnu.org> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:261676 Archived-At: On 13/05/2023 15:46, Eli Zaretskii wrote: >> Date: Sat, 13 May 2023 14:34:06 +0700 From: Max Nikulin >> >> 1. A script reads dependency files (if they exist) created during >> previous build and removes stale .elc files. > > This will break if the updated files have different dependencies. You > need to recreate the dependencies each build. Let's consider a.el that contains (require 'd) or it autoloads some macro from d.el. If a.el changed then a.elc is removed on this stage, so updated a.elc will be created on the next stage. Dependency on d.elc is known from previous build, so if d.el is changed then both a.elc and d.elc are removed. If new (require 'd-new) is added to a.el then it is not a problem as well. a.elc is removed due to changed a.el. d-new.elc is either up to date or it is removed due to changes in its dependencies or in d-new.el. So no stale files should survive stage 1. The only issue with obsolete dependencies is that compilation order may be not optimal. > Also, it is not clear what is the plan for the macros. If one of the > macros used during byte compilation changes in incompatible ways, > trying to byte-compile using Emacs which preloaded the previous > (outdated) definition of the macro will fail. I hope, it is addressed above. > So some changes need > also to generate a new Emacs binary, not just byte-compile in the > right order. I expect that dependencies of the script removing stale files are minimized. If changes in the breaks this script then it is time for "make clean". If emacs binary depends on .elc files then some file may be touched to let "make" know that the executable needs rebuild. >> 2. Normal "make" pass that takes into account dependency between files >> for ordering of compile commands. Dependency files are created or >> updated as a side-effect of compilation. >> >> Likely it is reasonable to split stage 2 into steps similar to current >> targets like main-first and mark most of files as dependent on a target >> that (throw its dependencies) compiles files required for byte compilation. > > What is the plan for the various autoloads files? They depend on all > the files, and many (all?) files depend on them. My plan is that autoloads/loaddefs are order-only dependencies for .elc files. However autoloads/loaddefs files depends on all files necessary to generate them.