help-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Flag --no-builtin-rules etc. just for this makefile (no flag inherit


From: Kaz Kylheku (gmake)
Subject: Re: Flag --no-builtin-rules etc. just for this makefile (no flag inheritance)
Date: Mon, 20 Apr 2020 07:39:55 -0700
User-agent: Roundcube Webmail/0.9.2

On 2020-04-20 03:04, R. Diez wrote:
Hallo Paul:

I have been investigating Kaz Kylheku's suggestion about adding flags
to MAKEFLAGS inside the makefile.

I believe that adding --no-builtin-variables has no effect. It is
probably too late to do that inside the makefile.

That means that option '--no-builtin-rules' does not get automatically
enabled either.

It can be verified with a minimal Makefile that "make --print-data-base"
shows an absence of built-in rules if MAKEFLAGS += --no-builtin-rules is
present, and likewise that --no-builtin-variables causes the variables
to disappear.

However, environment variables do not disappear. If CC or whatever
is coming down as an environment variable, then of course it stays.

About this other business of calculating a variable inside a recipe
to be used by dependent recipe, the path of least resistance would
be to make it a shell variable.

   base-recipe:
     ...
     heavy-program --option > .base-recipe-var

   dependent-recipe: base-recipe
     VAR=$$(cat .base-recipe-var) ; command $$VAR; ... ; ...

The dependent recipe now just has to read a file rather than execute
heavy-program.

If the datum is small enough, it could be stored in a symlink. Symlinks
whose targets are small enough are stored entirely in the inode structure
by some Unix-like file systems.

   base-recipe:
     ...
     ln -sf (heavy-program --show-important-path) .base-recipe-symlink

If the datum is a path, that symlink could be used directly:

   dependent-recipe: base-recipe
IMPORTANT_PATH=.base-recipe-symlink ; command $$IMPORTANT_PATH ; ...

Or it could be resolved, if the commands need the original item:

   dependent-recipe: base-recipe
IMPORTANT_PATH=$(readlink .base-recipe-symlink) ; command $$IMPORTANT_PATH ; ...






reply via email to

[Prev in Thread] Current Thread [Next in Thread]