summaryrefslogtreecommitdiffstats
path: root/Tools/qmake/mkspecs/features/default_post.prf
blob: 78c93d7c0678f9284cad9a88a295474587657c00 (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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
# -------------------------------------------------------------------
# QtWebKit defaults for qmake. These rules are parsed after the
# actual project file.
#
# See 'Tools/qmake/README' for an overview of the build system
# -------------------------------------------------------------------

load(features)

# Flag that we're now done processing the project file. This allows
# a feature to distinguish between being processed due to a load()
# or include() and a CONFIG += feature.
CONFIG += config_step

# Help keep the build tree clean
MOC_DIR = moc
RCC_DIR = rcc
isEmpty(OBJECTS_DIR): OBJECTS_DIR = obj/$$activeBuildConfig()

# General default build tweaks
DEFINES += \
    BUILDING_QT__=1

haveQt(5): DEFINES += HAVE_QT5=1

CONFIG(release, debug|release): DEFINES *= NDEBUG

CONFIG += depend_includepath
DEPENDPATH += $$OUT_PWD

INCLUDEPATH += \
    $${ROOT_WEBKIT_DIR}/Source \
    $${ROOT_BUILD_DIR}/Source/include \
    $${QT.script.includes}

CONFIG -= warn_on

*-g++*: QMAKE_CXXFLAGS = \
    -Wall \
    -Wextra \
    -Wreturn-type \
    -fno-strict-aliasing \
    -Wchar-subscripts \
    -Wformat-security \
    -Wreturn-type \
    -Wno-unused-parameter \
    -Wno-sign-compare \
    -Wno-switch \
    -Wno-switch-enum \
    -Wundef \
    -Wmissing-noreturn \
    -Winit-self \
    $$QMAKE_CXXFLAGS

v8: DEFINES += WTF_USE_V8=1
else {
    contains(JAVASCRIPTCORE_JIT, yes): DEFINES+=ENABLE_JIT=1
    contains(JAVASCRIPTCORE_JIT, no): DEFINES+=ENABLE_JIT=0
}

# Template configurations
contains(TEMPLATE, derived) {
    # A (mostly) no-op template
    TEMPLATE = aux

    # Trick qmake into not generating a default $(DEL_FILE) rule
    CONFIG += compile_libtool

    CONFIG -= debug_and_release

    for(generator, GENERATORS) {
        eval($${generator}.CONFIG = target_predeps no_link)
        eval($${generator}.dependency_type = TYPE_C)

        isEmpty($${generator}.output_function) {
            prependEach($${generator}.output, $${GENERATED_SOURCES_DESTDIR}/)
        }

        script = $$eval($${generator}.script)
        eval($${generator}.depends += $$script)

        !isEmpty($${generator}.input) {
            # Compiler-style generator
            QMAKE_EXTRA_COMPILERS += $$generator
            DEFAULT_TARGETS += compiler_$${generator}_make_all
        } else {
            # Regular target generator
            QMAKE_EXTRA_TARGETS += $$generator
            DEFAULT_TARGETS += $$generator
        }
    }
} else {
    # Make sure the generated sources are compiled as well
    for(generator, GENERATORS) {
        isEqual($${generator}.add_output_to_sources, false): next()

        output = $$eval($${generator}.output)
        input = $$eval($${generator}.input)
        input_files = $$eval($$input)

        isEmpty($${generator}.output_function) {
            prependEach(output, $${GENERATED_SOURCES_DESTDIR}/)

            for(input_file, input_files) {
                base = $$basename(input_file)
                base ~= s/\\..+//
                output_file = $$replace(output,\\$\\{QMAKE_FILE_BASE\\}, $$base)

                SOURCES += $$output_file
            }
        } else {
            function = $$eval($${generator}.output_function)
            for(input_file, input_files) {
                eval(output_file = \$\$$$function\($$input_file\))
                SOURCES += $$output_file
            }
        }

        prependEach($${generator}.extra_sources, $${GENERATED_SOURCES_DESTDIR}/)
        SOURCES += $$eval($${generator}.extra_sources)
    }
}

contains(TEMPLATE, lib) {
    # Triggers the right export macros for WebKit internals
    DEFINES += BUILDING_$${TARGET}

    # Triggers the right export macro for the QtWebKit API (see qwebkitglobal.h)
    DEFINES += BUILDING_WEBKIT

    # Build both debug and release configurations
    mac: CONFIG += build_all

    # Prevent name clashes when building both debug and release. Qt5's module
    # system already takes care of this for the top level QtWebKit library.
    !module:debug_and_release: TARGET = $$qtLibraryTarget($$TARGET)

    isEmpty(DESTDIR): DESTDIR = $$activeBuildConfig()

    DEFINES += QT_ASCII_CAST_WARNINGS

    win32-msvc*|win32-icc: INCLUDEPATH += $$ROOT_WEBKIT_DIR/Source/JavaScriptCore/os-win32

    !plugin {
        !linux-g++*:!linux-icc*:contains(QT_CONFIG, reduce_exports):CONFIG += hide_symbols
        unix:contains(QT_CONFIG, reduce_relocations):CONFIG += bsymbolic_functions
    }
}

contains(QT, webkit) {
    haveQt(4) {
        # Qt 4 still uses custom rules to depend on QtWebKit
        load(qtwebkit)
    }

    # In addition to the main shared QtWebKit library we also
    # need to link to any intermediate shared libraries.
    force_static_libs_as_shared {
        WEBKIT += wtf webcore
        !v8: WEBKIT += javascriptcore
        !no_webkit2: WEBKIT += webkit2
    }
}

# Reorder libraries so that the link and include order is correct,
# and make sure the case matches the original case.
libraries = WebKit2 WebCore JavaScriptCore WTF
for(library, libraries) {
    contains(WEBKIT, $$lower($$library)) {
        WEBKIT -= $$lower($$library)
        WEBKIT *= $$library
    }
}

defineTest(needToLink) {
    # The main dynamic library always needs to link in the intermediate libraries
    contains(TARGET, $$resolveFinalLibraryName($${QT.webkit.name})): return(true)

    force_static_libs_as_shared {
        # So do the individual libraries if they are dynamic
        contains(libraries, $$TARGET): return(true)

        # Or anything that uses QtWebKit in this special config
        contains(QT, webkit): return(true)
    }

    # Lastly, we allow apps (jsc) to link directly to the intermediate
    # libraries intead of using the exported symbols from QtWebKit.
    contains(TEMPLATE, app):!contains(QT, webkit): return(true)

    # Anything else should just get include paths, etc, not link
    return(false)
}

for(library, WEBKIT) {
    # Juggle LIBS to keep the static link order correct
    existing_libs = $$LIBS
    unset(LIBS)

    # We definitly need include paths and such (this will set
    # SOURCE_DIR to the right path so we can use it below).
    library_identifier = $$lower($$library)
    include(../modules/$${library_identifier}.prf)

    # More juggling
    dependent_libs = $$LIBS
    unset(LIBS)

    # But we might also need to link against it
    needToLink() {
        linkAgainstLibrary($$library, $$eval(WEBKIT.$${library_identifier}.root_source_dir))
        LIBS += $$dependent_libs
    }

    LIBS = $$existing_libs $$LIBS
}

equals(_PRO_FILE_, $${ROOT_WEBKIT_DIR}/WebKit.pro):!isEmpty(OVERRIDE_SUBDIRS) {
    # The root WebKit project file is the only one that allows
    # you to pass a set of subtargets on the comand line.
    SUBDIRS = $$OVERRIDE_SUBDIRS
}

# Remove subdirs that do not exist
for(subdir, SUBDIRS) {
    path = $$eval($${subdir}.file)
    isEmpty(path): path = $$eval($${subdir}.subdir)
    isEmpty(path): path = $${subdir}
    !exists($${_PRO_FILE_PWD_}$${QMAKE_DIR_SEP}$${path}) {
        #message(Removing invalid subtarget $${subdir} $${path})
        #SUBDIRS -= $${subdir}
    }
}

# Doing `$(MAKE) qmake' should recurse through all subdirs
contains(TEMPLATE, subdirs):!no_recursive_qmake {
    recursive_qmake.target = qmake_all

    # We could do this using CONFIG += recurse but that adds
    # a dependency for each recursive target on its makefile,
    # while we want it to depend on *-qmake_all, so that we
    # don't end up running qmake twice.

    for(subdir, SUBDIRS) {
        contains(NO_RECURSIVE_QMAKE_SUBDIRS, $${subdir}) {
            debug(1, Skipping recursive qmake for $${subdir})
            next()
        }

        subdir_config = $$eval($${subdir}.CONFIG)
        contains(subdir_config, no_default_target):next()

        debug(1, "Making qmake recursive for $$subdir")

        variables = $$computeSubdirVariables($${subdir})

        target_name = $$eval($${variables}.target)-recursive_qmake

        eval($${target_name}.target = $$target_name)
        eval($${target_name}.depends = $$eval($${variables}.target)-qmake_all)
        commands = $$eval($${variables}.subdir_command) $(MAKE) -f $$eval($${variables}.makefile) qmake
        eval($${target_name}.commands = $$commands)

        QMAKE_EXTRA_TARGETS += $${target_name}
        recursive_qmake.depends += $${target_name}
    }

    !isEmpty(recursive_qmake.depends): QMAKE_EXTRA_TARGETS += recursive_qmake
}

incremental.target = incremental
incremental.commands = $(MAKE) -f $(MAKEFILE) qmake && $(MAKE) -f $(MAKEFILE)
QMAKE_EXTRA_TARGETS += incremental

# Don't set OBJECTS_DIR for subdirs, as that will unconditionally
# create the directory, even if we're not using it.
contains(TEMPLATE, subdirs) {
    unset(OBJECTS_DIR)
}

# Remove duplicated sources
SOURCES = $$unique(SOURCES)
OBJECTIVE_SOURCES = $$unique(OBJECTIVE_SOURCES)

# Someone might remove a header from the tree without touching
# the corresponding project file, for example if the project
# file never had the header in HEADERS. In that case we don't
# want warnings from make about "No rule to make target".
ignore_missing_headers.target = %.h
ignore_missing_headers.commands = $${MAKEFILE_NOOP_COMMAND}
QMAKE_EXTRA_TARGETS += ignore_missing_headers

# Override default target
build_pass:build_all:default_target.target = all
else: default_target.target = first
for(target, $$list($$unique(DEFAULT_TARGETS))) {
    default_target.depends += $$target
}
!isEmpty(default_target.depends): QMAKE_EXTRA_TARGETS += default_target

# Qt's debug_and_release config will replace every occurance of
# Release or Debug in the destination dir. This fails when the
# desination dir is absolute and contains a static path component
# that also contains either of those two words, so we make DESTDIR
# relative.
DESTDIR = $$replace(DESTDIR, ^$${ROOT_BUILD_DIR}, $${BUILD_ROOT_RELATIVE_TO_OUT_PWD})

# Since we loaded our own rules for depending on QtWebKit, and we
# have no more logic that checks contains(QT, webkit), we unset it
# here so that Qt will not add its own include and library paths.
haveQt(4): QT -= webkit webkit-private

load(default_post) # Load Qt's defaults