[bug #63537] Regression in switches that can be flipped back and forth.

2022-12-19 Thread Paul D. Smith
Update of bug #63537 (project make):

  Status:None => Fixed  
 Assigned to:None => psmith 
 Open/Closed:Open => Closed 
Operating System:None => Any
   Fixed Release:None => SCM

___

Follow-up Comment #2:

Pushed these changes; thanks Dmitry!


___

Reply to this item at:

  

___
Message sent via Savannah
https://savannah.gnu.org/




[bug #63484] make 4.4 incorrectly thinks target does not exist

2022-12-19 Thread Paul D. Smith
Update of bug #63484 (project make):

  Status:None => Fixed  
 Assigned to:None => psmith 
 Open/Closed:Open => Closed 
Operating System:None => Any
   Fixed Release:None => SCM

___

Follow-up Comment #3:

Pushed these changes, thanks Dmitry!


___

Reply to this item at:

  

___
Message sent via Savannah
https://savannah.gnu.org/




[bug #63516] `include` of absolute path prepends path with `./`

2022-12-19 Thread Paul D. Smith
Update of bug #63516 (project make):

  Status:None => Fixed  
 Assigned to:None => psmith 
 Open/Closed:Open => Closed 
   Fixed Release:None => SCM

___

Follow-up Comment #10:

Fix pushed.  Thanks for the report!


___

Reply to this item at:

  

___
Message sent via Savannah
https://savannah.gnu.org/




[bug #63510] Confusing "update target 'foo' due to: target does not exist" message

2022-12-19 Thread Paul D. Smith
Update of bug #63510 (project make):

  Item Group:None => Enhancement
  Status:None => Fixed  
 Assigned to:None => psmith 
 Open/Closed:Open => Closed 
Operating System:None => Any
   Fixed Release:None => SCM
   Triage Status:None => Small Effort   

___

Follow-up Comment #6:

Pushed.  Thanks for the report.


___

Reply to this item at:

  

___
Message sent via Savannah
https://savannah.gnu.org/




Re: [doc] MAKEOVERRIDES is undocumented

2022-12-19 Thread Dmitry Goncharov
On Mon, Dec 19, 2022 at 1:54 PM Alejandro Colomar
 wrote:
> That would render the $(includedir) variable unusable for use within the
> Makefile (for example, within targets that install the header files).

We can introduce another variable, e.g. myincludedir and initialize it
with the expanded value of includedir and use myincludedir within the
makefile.

includedir:=$${prefix}/include
$(eval myincludedir:=$(includedir))
myconfig.pc:; @echo 'includedir=$(includedir)' >> myconfig.pc


regards, Dmitry



Re: [doc] MAKEOVERRIDES is undocumented

2022-12-19 Thread Alejandro Colomar

Hi Paul,

On 12/19/22 20:48, Paul Smith wrote:

On Mon, 2022-12-19 at 17:25 +0100, Alejandro Colomar wrote:

And another variable (and this one is not mentioned at all in the
manual): MAKEFLAGS.


Maybe I misunderstood, but MAKEFLAGS is discussed extensively in the
manual.


Yeah, maybe I wrote some typo or something and didn't find it.  Now I find it 
all over the manual, so I don't know what was my problem a couple of hours ago. 
Sorry. :/


Cheers,

Alex

--



OpenPGP_signature
Description: OpenPGP digital signature


Re: [doc] MAKEOVERRIDES is undocumented

2022-12-19 Thread Paul Smith
On Mon, 2022-12-19 at 17:25 +0100, Alejandro Colomar wrote:
> And another variable (and this one is not mentioned at all in the
> manual): MAKEFLAGS.

Maybe I misunderstood, but MAKEFLAGS is discussed extensively in the
manual.



Re: [doc] MAKEOVERRIDES is undocumented

2022-12-19 Thread Alejandro Colomar

Hi Dmitry,

On 12/19/22 20:35, Dmitry Goncharov wrote:

On Mon, Dec 19, 2022 at 2:33 PM Jeffrey Walton  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 
.


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

--



OpenPGP_signature
Description: OpenPGP digital signature


Re: [doc] MAKEOVERRIDES is undocumented

2022-12-19 Thread Dmitry Goncharov
On Mon, Dec 19, 2022 at 2:33 PM Jeffrey Walton  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



Re: [doc] MAKEOVERRIDES is undocumented

2022-12-19 Thread Jeffrey Walton
On Mon, Dec 19, 2022 at 1:53 PM Alejandro Colomar
 wrote:
>
> On 12/19/22 19:18, Dmitry Goncharov wrote:
> > On Mon, Dec 19, 2022 at 11:24 AM Jeffrey Walton  wrote:
> >> For the *.pc file, we need '$(prefix)' to survive unexpanded.
> >
> > What about
> > includedir:=$${prefix}/include
> > myconfig.pc:; @echo 'includedir=$(includedir)' >> myconfig.pc
>
> That would render the $(includedir) variable unusable for use within the
> Makefile (for example, within targets that install the header files).

Yep, that's why we track both includedir and pc_includedir.

Jeff



Re: [doc] MAKEOVERRIDES is undocumented

2022-12-19 Thread Alejandro Colomar

Hi Dmitry,

On 12/19/22 19:18, Dmitry Goncharov wrote:

On Mon, Dec 19, 2022 at 11:24 AM Jeffrey Walton  wrote:

For the *.pc file, we need '$(prefix)' to survive unexpanded.


What about
includedir:=$${prefix}/include
myconfig.pc:; @echo 'includedir=$(includedir)' >> myconfig.pc

?


That would render the $(includedir) variable unusable for use within the 
Makefile (for example, within targets that install the header files).


Cheers,

Alex



regards, Dmitry


--



OpenPGP_signature
Description: OpenPGP digital signature


Re: [doc] MAKEOVERRIDES is undocumented

2022-12-19 Thread Dmitry Goncharov
On Mon, Dec 19, 2022 at 11:24 AM Jeffrey Walton  wrote:
> For the *.pc file, we need '$(prefix)' to survive unexpanded.

What about
includedir:=$${prefix}/include
myconfig.pc:; @echo 'includedir=$(includedir)' >> myconfig.pc

?

regards, Dmitry



Re: [doc] MAKEOVERRIDES is undocumented

2022-12-19 Thread Alejandro Colomar

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  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: 
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

--



OpenPGP_signature
Description: OpenPGP digital signature


Re: [doc] MAKEOVERRIDES is undocumented

2022-12-19 Thread Alejandro Colomar

Hi Paul,

On 12/19/22 17:16, Paul Smith wrote:

On Mon, 2022-12-19 at 16:45 +0100, Alejandro Colomar wrote:

I had to search some related things in stackoverflow to find this.  I
think you should document this (and a few others) in 'Other Special
Variables'
.


I agree it would be good to add these variables there.  But, note that
this variable is documented:

https://www.gnu.org/software/make/manual/html_node/Options_002fRecursion.html#index-MAKEOVERRIDES

You can find this by searching the index of the manual:

https://www.gnu.org/software/make/manual/html_node/Name-Index.html


Actually, I found that, but after looking at stackoverflow.  Since I gign't know 
the name of the variable I needed, I didn't know exactly what to search for.  I 
only knew the functionallity I wanted.


I knew about the existence of MAKECMDGOALS, which BTW is also only referenced in 
other docs, but not listed in the documentation for special variables either. 
So I searched stackoverflow for things related to MAKECMDGOALS in search of a 
mention to anything similar, and I got it:



And another variable (and this one is not mentioned at all in the manual): 
MAKEFLAGS.  When I tested these variables, I was a bit confused about MAKEFLAGS: 
it didn't print `j`, but printed `p`...




I think looking in the manual is usually a better bet than looking in
stackoverflow, at least initially :).


Anyway, I'm diverting.  The thing is that when I know the functionallity but not 
the name, either it's listed in the list where it should be, or stackoverflow is 
better at finding stuff :)


I usually start searching at the single-page HTML document here:
.  Then, plan B is SO.


Cheers,

Alex

--



OpenPGP_signature
Description: OpenPGP digital signature


Re: [doc] MAKEOVERRIDES is undocumented

2022-12-19 Thread Jeffrey Walton
On Mon, Dec 19, 2022 at 11:22 AM 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)

For the *.pc file, we need '$(prefix)' to survive unexpanded.

Jeff



Re: [doc] MAKEOVERRIDES is undocumented

2022-12-19 Thread Paul Smith
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.



Re: [doc] MAKEOVERRIDES is undocumented

2022-12-19 Thread Paul Smith
On Mon, 2022-12-19 at 16:45 +0100, Alejandro Colomar wrote:
> I had to search some related things in stackoverflow to find this.  I
> think you should document this (and a few others) in 'Other Special
> Variables'
> .

I agree it would be good to add these variables there.  But, note that
this variable is documented:

https://www.gnu.org/software/make/manual/html_node/Options_002fRecursion.html#index-MAKEOVERRIDES

You can find this by searching the index of the manual:

https://www.gnu.org/software/make/manual/html_node/Name-Index.html

I think looking in the manual is usually a better bet than looking in
stackoverflow, at least initially :).



Re: [doc] MAKEOVERRIDES is undocumented

2022-12-19 Thread Alejandro Colomar

Hi Jeffrey,

On 12/19/22 16:57, Jeffrey Walton wrote:

On Mon, Dec 19, 2022 at 10:45 AM Alejandro Colomar
 wrote:


I needed to use MAKEOVERRIDES for updating a pkgconf (.pc) file.  I want it to
have the correct directory variables as used when building/installing the
library, so if the user specifies 'includedir=/foo/bar' in the command line, the
.pc file should be updated with that info.

The rule I had to use is:

$(_LIB_pc): $(_LIB_pc_u) Makefile | $$(@D)/
 $(info  SED $@)
 sed 's/Version:.*/Version: $(DISTVERSION)/' <$< >$@
 sed -i 's,prefix=.*,prefix=$(prefix),' $@
ifneq ($(filter includedir=%,$(MAKEOVERRIDES)),)
 sed -i 's,includedir=.*,includedir=$(includedir),' $@
endif

As you can see, I need to check if it was overridden in the command line
(otherwise, the default 'includedir=${prefix}/include' in the .pc file is fine).
   And then I do override it.


I don't think you need to go to extremes. Just check if includedir is
set. If so, use it. If not, use the default of $prefix/include.

You can do this in your makefile [1,2]:

ifeq ($(includedir),)
  includedir := $(prefix)/include
  PC_INCLUDEDIR = $${prefix}/include
else
  PC_INCLUDEDIR = $(includedir)
endif

 myconfig.pc:
 ...
@echo 'includedir=$(PC_INCLUDEDIR)' >> myconfig.pc

Jeff

[1] https://github.com/weidai11/cryptopp/blob/master/GNUmakefile#L202
[2] https://github.com/weidai11/cryptopp/blob/master/GNUmakefile#L1544


Interesting!  Thanks for the idea!

Anyway, the missing documentation bug is still a concern :)


Cheers,

Alex

--



OpenPGP_signature
Description: OpenPGP digital signature


Re: [doc] MAKEOVERRIDES is undocumented

2022-12-19 Thread Jeffrey Walton
On Mon, Dec 19, 2022 at 10:45 AM Alejandro Colomar
 wrote:
>
> I needed to use MAKEOVERRIDES for updating a pkgconf (.pc) file.  I want it to
> have the correct directory variables as used when building/installing the
> library, so if the user specifies 'includedir=/foo/bar' in the command line, 
> the
> .pc file should be updated with that info.
>
> The rule I had to use is:
>
> $(_LIB_pc): $(_LIB_pc_u) Makefile | $$(@D)/
> $(info  SED $@)
> sed 's/Version:.*/Version: $(DISTVERSION)/' <$< >$@
> sed -i 's,prefix=.*,prefix=$(prefix),' $@
> ifneq ($(filter includedir=%,$(MAKEOVERRIDES)),)
> sed -i 's,includedir=.*,includedir=$(includedir),' $@
> endif
>
> As you can see, I need to check if it was overridden in the command line
> (otherwise, the default 'includedir=${prefix}/include' in the .pc file is 
> fine).
>   And then I do override it.

I don't think you need to go to extremes. Just check if includedir is
set. If so, use it. If not, use the default of $prefix/include.

You can do this in your makefile [1,2]:

   ifeq ($(includedir),)
 includedir := $(prefix)/include
 PC_INCLUDEDIR = $${prefix}/include
   else
 PC_INCLUDEDIR = $(includedir)
   endif

myconfig.pc:
...
   @echo 'includedir=$(PC_INCLUDEDIR)' >> myconfig.pc

Jeff

[1] https://github.com/weidai11/cryptopp/blob/master/GNUmakefile#L202
[2] https://github.com/weidai11/cryptopp/blob/master/GNUmakefile#L1544



[doc] MAKEOVERRIDES is undocumented

2022-12-19 Thread Alejandro Colomar

Hi!

I needed to use MAKEOVERRIDES for updating a pkgconf (.pc) file.  I want it to 
have the correct directory variables as used when building/installing the 
library, so if the user specifies 'includedir=/foo/bar' in the command line, the 
.pc file should be updated with that info.


The rule I had to use is:


$(_LIB_pc): $(_LIB_pc_u) Makefile | $$(@D)/
$(info  SED $@)
sed 's/Version:.*/Version: $(DISTVERSION)/' <$< >$@
sed -i 's,prefix=.*,prefix=$(prefix),' $@
ifneq ($(filter includedir=%,$(MAKEOVERRIDES)),)
sed -i 's,includedir=.*,includedir=$(includedir),' $@
endif


As you can see, I need to check if it was overridden in the command line 
(otherwise, the default 'includedir=${prefix}/include' in the .pc file is fine). 
 And then I do override it.


I had to search some related things in stackoverflow to find this.  I think you 
should document this (and a few others) in 'Other Special Variables' 
.



Cheers,

Alex

--



OpenPGP_signature
Description: OpenPGP digital signature