summaryrefslogtreecommitdiffstats
path: root/mkspecs/features/symbian/add_mmp_rules.prf
blob: 5384dbe961d5e92218bed0b1a8462b0154153676 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# Arg1: List of conditions to generate block for
# Arg2: List of variables containing rules to add
defineTest(addMMPRules) {
    unset(myConditions)
    unset(myVariables)
    unset(myIfDef)

    myConditions = $$eval($$1) default
    myVariables = $$eval($$2)
    myIfDef = if

    for(condition, $$list($$myConditions)) {
        contains(condition, default) {
            libBlock = "$${LITERAL_HASH}else"
        } else {
            libBlock = "$${LITERAL_HASH}$${myIfDef} defined($${condition})"
            myIfDef = elif
        }

        for(var, $$list($$myVariables)) {
            varVal = $$eval($${var}.$${condition})
            isEmpty(varVal) {
                # No value defined for current condition, so use default
                varVal = $$eval($${var}.default)
            }
            !isEmpty(varVal): libBlock += "$$join(varVal,$$escape_expand(\n))"
        }

        MMP_RULES += $$libBlock
    }
    MMP_RULES += "$${LITERAL_HASH}endif"
    export(MMP_RULES)
}