[Qt-interest] setting makefile variable from .pro file
Pete Black
theblackpeter at gmail.com
Thu Feb 26 18:33:20 CET 2009
Pete Black wrote:
> andrew.m.goth at l-3com.com wrote:
>> Pete Black wrote:
>>> Looks like I might have to create a custom make target that sets
>>> INSTALL_ROOT or script it.
>> I don't think it's possible for a target to set a variable. Well, one
>> way you could do it (if you were the one writing the makefile, which you
>> aren't!) is with conditional expressions:
>
> It is actually. Create a custom target that sets INSTALL_ROOT and add it
> to the top of INSTALLS. Problem with this approach is that something is
> needed for when calling make uninstall and those targets only get added
> to the uninstall: makefile target if they have any files associated with
> them. Have a look in the makefile for install: and uninstall and you'll
> see what I mean.
>
> After some procrastinating I decided to do it quick and dirty like this
> (remember, my only requirement is that it's contained in the .pro file):
>
> !exists($$MAKEFILE) {
> system("touch $$MAKEFILE")
> system("qmake src.pro")
> INSTALL_ROOT = "\/usr\/local"
> CMD="sed -i 's/INSTALL_PROGRAM.*=.*/&\nINSTALL_ROOT =
> $$INSTALL_ROOT/' $$MAKEFILE"
> system($$CMD)
> error("Ignore this error, everything is fine!")
> }
>
> So this will now set a default value in the generated makefile just
> after INSTALL_PROGRAM. It's also possible to override that value like usual:
>
> make install INSTALL_ROOT=./
>
> Anyway, I opened up a feature suggestion request, let's see what happens.
>
> Pete
Qt opened up a task here:
http://www.qtsoftware.com/developer/task-tracker/index_html?id=246151&method=entry
Pete
More information about the Qt-interest-old
mailing list