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) endifMaybe 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 <[email protected]> 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. > > JeffExpanding 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/>
OpenPGP_signature
Description: OpenPGP digital signature
