bug-make
[Top][All Lists]
Advanced

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

Re: [doc] MAKEOVERRIDES is undocumented


From: Alejandro Colomar
Subject: Re: [doc] MAKEOVERRIDES is undocumented
Date: Mon, 19 Dec 2022 20:44:58 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.6.0

Hi Dmitry,

On 12/19/22 20:35, Dmitry Goncharov wrote:
On Mon, Dec 19, 2022 at 2:33 PM Jeffrey Walton <noloader@gmail.com> wrote:
Yep, that's why we track both includedir and pc_includedir.

You don't have to resort to if statements to initialize either of the variables.
regards, Dmitry


Let me try to explain:


The build system of a library needs to (among other things):

- Install the header files in the system.
- Provide a pc(5) file that knows where the library was installed, and tells users of the library how to use it.

When you're building and installing the library, you want to use standard Variables for Installation Directories <https://www.gnu.org/software/make/manual/make.html#Directory-Variables>.

So the interface of the build system is:

    make install [prefix=/foo] [includedir=/bar/baz]

The user may or may not specify them. From that interface, the Makefile needs to accomplish both tasks (updating the pc(5) file, and actually installing the header files).

Since the interface only provides a single variable (because it would be wrong to ask the user to specify it twice), the Makefile needs to do some magic to be able to use them in the two different situations.

One can use two variables, in which case one needs to be calculated from the other. The most natural thing is to keep $(installdir) usable within the Makefile, and have a special variable for pc(5), as Jeffrey suggested.

The other way is to just have a conditional at the recipe like I did. But a conditional is always necessary.

If you need me to develop a small example for visualization, please ask.

Cheers,

Alex

--
<http://www.alejandro-colomar.es/>

Attachment: OpenPGP_signature
Description: OpenPGP digital signature


reply via email to

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