bug-make
[Top][All Lists]
Advanced

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

[doc] MAKEOVERRIDES is undocumented


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

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' <https://www.gnu.org/software/make/manual/html_node/Special-Variables.html>.


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]