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 17:29:04 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.6.0

Hi Paul,

On 12/19/22 17:22, Paul Smith wrote:
On Mon, 2022-12-19 at 10:57 -0500, Jeffrey Walton wrote:
    ifeq ($(includedir),)
      includedir := $(prefix)/include
      PC_INCLUDEDIR = $${prefix}/include
    else
      PC_INCLUDEDIR = $(includedir)
    endif

Maybe I'm misunderstanding some subtlety here but why not just:

   includedir := $(prefix)/include
   PC_INCLUDEDIR = $(includedir)

??

An assignment of includedir on the command line will override any
setting in the makefile, so no need to use an ifeq etc.



On 12/19/22 17:23, Jeffrey Walton wrote:
> On Mon, Dec 19, 2022 at 11:22 AM Paul Smith <psmith@gnu.org> wrote:
>>
>> On Mon, 2022-12-19 at 10:57 -0500, Jeffrey Walton wrote:
>>>     ifeq ($(includedir),)
>>>       includedir := $(prefix)/include
>>>       PC_INCLUDEDIR = $${prefix}/include
>>>     else
>>>       PC_INCLUDEDIR = $(includedir)
>>>     endif
>>
>> Maybe I'm misunderstanding some subtlety here but why not just:
>>
>>    includedir := $(prefix)/include
>>    PC_INCLUDEDIR = $(includedir)
>
> For the *.pc file, we need '$(prefix)' to survive unexpanded.
>
> Jeff


Expanding on what Jeffrey said, pkgconf(1) allows setting the prefix (similar to what make does):

pkgconf(1):
       -‐define‐prefix
               Attempts to determine the prefix variable to use for CFLAGS and
               LIBS entry relocations.  This is mainly  useful  for  platforms
               where framework SDKs are relocatable, such as Windows.

So, to allow for that, you need to specify thing something like:

$ cat share/pkgconfig/libstp-uninstalled.pc
Name: libstp
Description: String library
URL: http://www.alejandro-colomar.es/src/alx/alx/libstp.git
Version: <version>
Requires:
Requires.private:

prefix=/usr/local
includedir=${prefix}/include
libdir=${prefix}/lib

Cflags: -isystem${includedir}
Libs: -L${libdir}/libstp -lstp -lc
Libs.private:


If includedir has been explicitly set in make, it makes sense to explicitly set it in the .pc file. However, if it's default (i.e., depending on prefix), it should be kept as such.

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]