mkspecs/features/symbian/def_files.prf
changeset 30 5dc02b23752f
parent 29 b72c6db6890b
child 33 3e2da88830cd
--- a/mkspecs/features/symbian/def_files.prf	Wed Jun 23 19:07:03 2010 +0300
+++ b/mkspecs/features/symbian/def_files.prf	Tue Jul 06 15:10:48 2010 +0300
@@ -3,37 +3,75 @@
 
 CONFIG -= def_files_disabled
 
-# Firstly, if the MMP_RULES already contain a defBlock variable, don't generate another one
-# (this bit is slightly magic, because it depends upon everyone creating their DEFFILE statements
-# in a defBlock variable; but otherwise we have to expand MMP_RULES then scan for the DEFFILE keyword)
-!contains(MMP_RULES, defBlock) {
-    # Apps are executables on Symbian, so don't have exports, and therefore don't have DEF files
-    # Plugins use standard DEF files, which qmake generates, so shouldn't be using these DEFFILE
-    # statements - they use the qmake generated statements instead
-    # Static libraries obviously don't have DEF files, as they don't take part in dynamic linkage
-    !contains(TEMPLATE, app):!contains(CONFIG, plugin):!contains(CONFIG, staticlib): {
-        !isEmpty(defFilePath) {
-            defBlock = \
-            "$${LITERAL_HASH}ifdef WINSCW" \
-            "DEFFILE $$defFilePath/bwins/$${TARGET}.def" \
-            "$${LITERAL_HASH}elif defined EABI" \
-            "DEFFILE $$defFilePath/eabi/$${TARGET}.def" \
-            "$${LITERAL_HASH}endif"
+symbian-abld|symbian-sbsv2 {
+    # Firstly, if the MMP_RULES already contain a defBlock variable, don't generate another one
+    # (this bit is slightly magic, because it depends upon everyone creating their DEFFILE statements
+    # in a defBlock variable; but otherwise we have to expand MMP_RULES then scan for the DEFFILE keyword)
+    !contains(MMP_RULES, defBlock):!contains(MMP_RULES, EXPORTUNFROZEN) {
+        # Apps are executables on Symbian, so don't have exports, and therefore don't have DEF files
+        # Plugins use standard DEF files, which qmake generates, so shouldn't be using these DEFFILE
+        # statements - they use the qmake generated statements instead
+        # Static libraries obviously don't have DEF files, as they don't take part in dynamic linkage
+        !contains(TEMPLATE, app):!contains(CONFIG, plugin):!contains(CONFIG, staticlib): {
+            !isEmpty(DEF_FILE) {
+                defBlock = \
+                "$${LITERAL_HASH}ifdef WINSCW" \
+                "DEFFILE $$DEF_FILE/bwins/$${TARGET}.def" \
+                "$${LITERAL_HASH}elif defined EABI" \
+                "DEFFILE $$DEF_FILE/eabi/$${TARGET}.def" \
+                "$${LITERAL_HASH}endif"
+            } else:!isEmpty(defFilePath) {
+                defBlock = \
+                "$${LITERAL_HASH}ifdef WINSCW" \
+                "DEFFILE $$defFilePath/bwins/$${TARGET}.def" \
+                "$${LITERAL_HASH}elif defined EABI" \
+                "DEFFILE $$defFilePath/eabi/$${TARGET}.def" \
+                "$${LITERAL_HASH}endif"
+            } else {
+                # If defFilePath is not defined, then put the folders containing the DEF files at the
+                # same level as the .pro (and generated MMP) file(s)
+                defBlock = \
+                "$${LITERAL_HASH}ifdef WINSCW" \
+                "DEFFILE ./bwins/$${TARGET}.def" \
+                "$${LITERAL_HASH}elif defined EABI" \
+                "DEFFILE ./eabi/$${TARGET}.def" \
+                "$${LITERAL_HASH}endif"
+            }
             MMP_RULES += defBlock
-        } else {
-            # If defFilePath is not defined, then put the folders containing the DEF files at the
-            # same level as the .pro (and generated MMP) file(s)
-            exists("$$_PRO_FILE_PWD_/eabi") {
-               defBlock = \
-               "$${LITERAL_HASH}ifdef WINSCW" \
-               "DEFFILE ./bwins/$${TARGET}.def" \
-               "$${LITERAL_HASH}elif defined EABI" \
-               "DEFFILE ./eabi/$${TARGET}.def" \
-               "$${LITERAL_HASH}endif"
-               MMP_RULES += defBlock
-            }
+        }
+    }
+
+} else:contains(TEMPLATE, lib):!contains(CONFIG, static):!contains(CONFIG, staticlib) {
+    !isEmpty(DEF_FILE) {
+        defFile = $$DEF_FILE
+    } else {
+        defFile = .
+    }
+    system("$$QMAKE_CHK_DIR_EXISTS $$_PRO_FILE_PWD_/$$defFile") {
+        !exists("$$_PRO_FILE_PWD_/$$defFile/eabi") {
+            system("$$QMAKE_MKDIR $$_PRO_FILE_PWD_/$$defFile/eabi")
         }
-       
+        elf2e32FileToAdd = $$_PRO_FILE_PWD_/$$defFile/eabi/$$basename(TARGET)u.def
+    } else {
+        elf2e32FileToAdd = $$_PRO_FILE_PWD_/$$defFile
     }
+    QMAKE_ELF2E32_FLAGS += "`test -e $$elf2e32FileToAdd && echo --definput=$$elf2e32FileToAdd`"
+
+    symbianObjdir = $$OBJECTS_DIR
+    isEmpty(symbianObjdir):symbianObjdir = .
+
+    freeze_target.target = freeze
+    freeze_target.depends = first
+    # The perl part is to convert to unix line endings and remove comments, which the s60 tools refuse to do.
+    freeze_target.commands = perl -n -e \'next if (/; NEW/); s/\r//g; if (/MISSING:(.*)/x) { print(\"\$\$1 ABSENT\\n\"); } else { print; }\' < $$symbianObjdir/$${TARGET}.def >  $$elf2e32FileToAdd
+    QMAKE_EXTRA_TARGETS += freeze_target
+} else:contains(TEMPLATE, subdirs) {
+    freeze_target.target = freeze
+    freeze_target.CONFIG = recursive
+    freeze_target.recurse = $$SUBDIRS
+    QMAKE_EXTRA_TARGETS += freeze_target
+} else {
+    freeze_target.target = freeze
+    freeze_target.commands =
+    QMAKE_EXTRA_TARGETS += freeze_target
 }
-