On Wed, 2 Jul 2025 at 20:11, Tim Murphy <tnmur...@gmail.com> wrote: > On Wed, 2 Jul 2025 at 22:40, Bahman Movaqar <bah...@bahmanm.com> wrote: > >> Somehow in the same vein is the work I did in bmakelib: >> https://github.com/bahmanm/bmakelib/blob/main/doc/logged.md >> > That library is impressive. >
Thanks. So much PROD-grade pain have been fed into it 😂 > I wondered if GNU make could benefit from a function that fetches the > current time - this might take away one reason to need to call out to perl. > > I selfishly used your idea to try implementing such a function in the > extramake loadable module library for make: > > https://github.com/tnmurphy/extramake/commit/6faed2c6b7a335d1acec3fffd97cdaba8f4cb6ed > That's a neat project! Have you tried packaging it in any way? I'd be interested to try it out in my projects if it's easy to integrate. Ideally, something like this (shameless plug 😅): https://hub.docker.com/repository/docker/bdockerimg/bmakelib/general > > > The function works like this: > $(time %Y-%m-%dT%H:%MZ) and $(time +) uses a default time format > (can't use 0 params unfortunately for $(time) doesn't work) > > It's just a thin wrapper on the GNU libc clock_gettime() and strftime() > functions. > > I don't know how easy it would be to implement this on non POSIX or > non-recent systems which is a bit of a problem for putting it into mainline > GNU Make. > You could use...Perl? 😁 > > With $(time) you could implement logging with something like $(info $(time > +) $(message)) at the top of the rule and if you wanted error levels you > could have some sort of callable $(call log_warn, "message") which would > then contain $(if $(LOG_WARN),$(info $(time+): $1)) so that setting > LOG_WARN:=1 would enable warning level logs. > > Anyhow this is not a fully formed idea but I just felt that we lack a way > to get the time/date and that might be useful for many things including > logging. > That is true 💯 There are other areas like dealing with directories (like extramake does), logging, fetching `include`ed Makefiles over the network (to keep your dependencies up-to-date), ... I feel the only plausible way to keep the mainline GNU Make sane, lean and focused is to implement a plugin/extension mechanism that is easy(ier?) to develop against for extension developers and easier to use for end users. Something like a higher-level interface in Python/Perl. Well, enough thinking out loud 😅 > > Cheers! :-) > > Tim >