[Development] Breaking up QtPlatformSupport

Lincoln Ramsay lincoln.ramsay at nokia.com
Wed Mar 14 02:07:56 CET 2012


On 03/12/2012 11:56 PM, ext Thiago Macieira wrote:
> qmake does not add a dependency on the .a file, so the other target doesn't get
> relinked.

Qtopia had a large number of .a files and this hit us hard so we devised 
a workaround.

# A function to create explicit dependencies in a Makefile
defineTest(create_raw_dependency) {
     var=$$1
     dep=$$2
     eval($${var}.depends*=\$$dep)
     export($${var}.depends)
     QMAKE_EXTRA_TARGETS*=$$var
     export(QMAKE_EXTRA_TARGETS)
}

# relink our binary when foo.a changes
create_raw_dependency($$TARGET, /path/to/foo.a)

This literally gave us a rule in the Makefile like this:
mybin: /path/to/foo.a

Luckily, make doesn't care if you have multiple "rules" for a product, 
as long as only one of them executes commands.

I doubt this works on non-Makefile projects though. Possibly not even on 
non-GNU make. Probably easier to just have qmake generate the dependency 
itself :)


-- 
Lincoln Ramsay - Senior Software Engineer
Qt Development Frameworks, Nokia - http://qt.nokia.com/



More information about the Development mailing list