Any qmake experts out there?

Lubomir I. Ivanov neolit123 at gmail.com
Fri Jan 30 09:08:36 PST 2015


On 30 January 2015 at 03:07, Lubomir I. Ivanov <neolit123 at gmail.com> wrote:
> here is my progress in a single patch if someone is interested.
>
> i'm CCing Thiago, because maybe he can help with a qmake issue.
>
> basically i have the same setup that this patch applies in a test project:
> - the version_h rule is generated in a .pro (.pri) file
> - the rule simply calls a script that may or may not create or update
> ssrf-version.h
>
> the problem is that qmake does not generate the rule in the first
> place for subsurface (hopefully not a qmake bug).
>
> for my other test project it generates this:
> $(DESTDIR_TARGET): ssrf-version.h...
>
> <snip>
>
> ssrf-version.h: FORCE
>     @sh ./scripts/write-version ssrf-version.h 4.3 win
>
> the above is not ideal because i think we really want .PHONY but qmake
> doesn't really provide us with the option to add to the directive and
> what it has instead is QMAKE_EXTRA_TARGETS and PRE_TARGETDEPS.
> with FORCE (an empty rule) i have no experience with but it does
> generate the ssrf-version.h.tmp file each time 'make' is called, which
> is what we want in a way.
>

some progress, but i think i'm either finding some problems with qmake
or it's very undocumented.

i was able to create a rule, but now the problem of re-linking rises.
(patch attached)

PHONY_DEPS = .
version_h.input = PHONY_DEPS
version_h.output = phony_version
version_h.commands = @echo writing $$VERSION_FILE ... && sh
./scripts/write-version $$VERSION_FILE $$VERSION $$VER_OS
version_h.CONFIG += no_link target_predeps
QMAKE_EXTRA_COMPILERS += version_h
QMAKE_CLEAN += $$VERSION_FILE

this line is the problematic one:
version_h.CONFIG += no_link target_predeps

it supposedly tells qmake not to link the output of this rule and to
insert it a $(DESTDIR_TARGET) dependency.
the problem is that it shouldn't be a  $(DESTDIR_TARGET) dependency,
it should be a rule that is a PHONY rule...

if i remove "target_predeps" and manually go in the Makefile and add
phony_version in the "first" rule as:
first: phony_version all
it works...

things like:
first.depends += phony_version
or
all.depends += phony_version
don't work.

any ideas of a "target_predeps" alternative?

lubomir
--


More information about the subsurface mailing list