On 03/04/2023 00:00, Ihor Radchenko wrote:
Max Nikulin writes:
Ihor, do added makefile rules follow best practices used by other Emacs
packages in respect to dependencies?
I know no other Emacs packages that manage dependencies using make.
org-ql uses a helper shell script. org-roam and projectile use eldev
that is procedural, not declarative build system. I have not figured out
which way magit handles dependencies. I have no more ideas what projects
may involve unit tests and dependencies.
Actually Org uses make just as interface, not as a declarative build
system that is able to minimize work by updating only necessary targets.
Build rules are effectively procedural: complete rebuild on every
invocation.
I do not like the idea of network queries on every make.
Any better suggestions?
Do not run install dependencies for regular targets like test or
compile. At least do not do it unless it is explicitly requested by
command line argument or a variable in local.mk
+pkgdir = $(shell pwd)/pkg-deps
Make has CURDIR variable, but I am unsure if it is safe to use it in
this context.
Actually, we need pkgdir := $(shell pwd)/pkg-deps.
CURDIR is wrong because default.mk will trigger evaluation in every make
sub-process as well.
default.mk is included from top level Makefile only. By the way, it is
better to explicitly express that path is relative to top project
directory by defining e.g. top_builddir (or abs_top_builddir) at first and
pkgdir = $(top_builddir)/pkg-deps
Today I noticed the following trick in (likely stale)
https://github.com/org-roam/org-roam/blob/main/default.mk
TOP := $(dir $(lastword $(MAKEFILE_LIST)))
I have not realized if it is safe enough.