1 # -------------------------------------------------------------------
2 # QtWebKit defaults for qmake. These rules are parsed after the
5 # See 'Tools/qmake/README' for an overview of the build system
6 # -------------------------------------------------------------------
10 # Flag that we're now done processing the project file. This allows
11 # a feature to distinguish between being processed due to a load()
12 # or include() and a CONFIG += feature.
15 # Help keep the build tree clean
18 isEmpty(OBJECTS_DIR): OBJECTS_DIR = obj/$$activeBuildConfig()
20 # General default build tweaks
24 haveQt(5): DEFINES += HAVE_QT5=1
26 CONFIG(release, debug|release): DEFINES *= NDEBUG
28 CONFIG += depend_includepath
29 DEPENDPATH += $$OUT_PWD
32 $${ROOT_WEBKIT_DIR}/Source \
33 $${ROOT_BUILD_DIR}/Source/include \
34 $${QT.script.includes}
38 *-g++*: QMAKE_CXXFLAGS = \
42 -fno-strict-aliasing \
46 -Wno-unused-parameter \
55 v8: DEFINES += WTF_USE_V8=1
57 contains(JAVASCRIPTCORE_JIT, yes): DEFINES+=ENABLE_JIT=1
58 contains(JAVASCRIPTCORE_JIT, no): DEFINES+=ENABLE_JIT=0
61 # Template configurations
62 contains(TEMPLATE, derived) {
63 # A (mostly) no-op template
66 # Trick qmake into not generating a default $(DEL_FILE) rule
67 CONFIG += compile_libtool
69 CONFIG -= debug_and_release
71 for(generator, GENERATORS) {
72 eval($${generator}.CONFIG = target_predeps no_link)
73 eval($${generator}.dependency_type = TYPE_C)
75 isEmpty($${generator}.output_function) {
76 prependEach($${generator}.output, $${GENERATED_SOURCES_DESTDIR}/)
79 script = $$eval($${generator}.script)
80 eval($${generator}.depends += $$script)
82 !isEmpty($${generator}.input) {
83 # Compiler-style generator
84 QMAKE_EXTRA_COMPILERS += $$generator
85 DEFAULT_TARGETS += compiler_$${generator}_make_all
87 # Regular target generator
88 QMAKE_EXTRA_TARGETS += $$generator
89 DEFAULT_TARGETS += $$generator
93 # Make sure the generated sources are compiled as well
94 for(generator, GENERATORS) {
95 isEqual($${generator}.add_output_to_sources, false): next()
97 output = $$eval($${generator}.output)
98 input = $$eval($${generator}.input)
99 input_files = $$eval($$input)
101 isEmpty($${generator}.output_function) {
102 prependEach(output, $${GENERATED_SOURCES_DESTDIR}/)
104 for(input_file, input_files) {
105 base = $$basename(input_file)
107 output_file = $$replace(output,\\$\\{QMAKE_FILE_BASE\\}, $$base)
109 SOURCES += $$output_file
112 function = $$eval($${generator}.output_function)
113 for(input_file, input_files) {
114 eval(output_file = \$\$$$function\($$input_file\))
115 SOURCES += $$output_file
119 prependEach($${generator}.extra_sources, $${GENERATED_SOURCES_DESTDIR}/)
120 SOURCES += $$eval($${generator}.extra_sources)
124 contains(TEMPLATE, lib) {
125 # Triggers the right export macros for WebKit internals
126 DEFINES += BUILDING_$${TARGET}
128 # Triggers the right export macro for the QtWebKit API (see qwebkitglobal.h)
129 DEFINES += BUILDING_WEBKIT
131 # Build both debug and release configurations
132 mac: CONFIG += build_all
134 # Prevent name clashes when building both debug and release. Qt5's module
135 # system already takes care of this for the top level QtWebKit library.
136 !module:debug_and_release: TARGET = $$qtLibraryTarget($$TARGET)
138 isEmpty(DESTDIR): DESTDIR = $$activeBuildConfig()
140 DEFINES += QT_ASCII_CAST_WARNINGS
142 win32-msvc*|win32-icc: INCLUDEPATH += $$ROOT_WEBKIT_DIR/Source/JavaScriptCore/os-win32
145 !linux-g++*:!linux-icc*:contains(QT_CONFIG, reduce_exports):CONFIG += hide_symbols
146 unix:contains(QT_CONFIG, reduce_relocations):CONFIG += bsymbolic_functions
150 contains(QT, webkit) {
152 # Qt 4 still uses custom rules to depend on QtWebKit
156 # In addition to the main shared QtWebKit library we also
157 # need to link to any intermediate shared libraries.
158 force_static_libs_as_shared {
159 WEBKIT += wtf webcore
160 !v8: WEBKIT += javascriptcore
161 !no_webkit2: WEBKIT += webkit2
165 # Reorder libraries so that the link and include order is correct,
166 # and make sure the case matches the original case.
167 libraries = WebKit2 WebCore JavaScriptCore WTF
168 for(library, libraries) {
169 contains(WEBKIT, $$lower($$library)) {
170 WEBKIT -= $$lower($$library)
175 defineTest(needToLink) {
176 # The main dynamic library always needs to link in the intermediate libraries
177 contains(TARGET, $$resolveFinalLibraryName($${QT.webkit.name})): return(true)
179 force_static_libs_as_shared {
180 # So do the individual libraries if they are dynamic
181 contains(libraries, $$TARGET): return(true)
183 # Or anything that uses QtWebKit in this special config
184 contains(QT, webkit): return(true)
187 # Lastly, we allow apps (jsc) to link directly to the intermediate
188 # libraries intead of using the exported symbols from QtWebKit.
189 contains(TEMPLATE, app):!contains(QT, webkit): return(true)
191 # Anything else should just get include paths, etc, not link
195 for(library, WEBKIT) {
196 # Juggle LIBS to keep the static link order correct
197 existing_libs = $$LIBS
200 # We definitly need include paths and such (this will set
201 # SOURCE_DIR to the right path so we can use it below).
202 library_identifier = $$lower($$library)
203 include(../modules/$${library_identifier}.prf)
206 dependent_libs = $$LIBS
209 # But we might also need to link against it
211 linkAgainstLibrary($$library, $$eval(WEBKIT.$${library_identifier}.root_source_dir))
212 LIBS += $$dependent_libs
215 LIBS = $$existing_libs $$LIBS
218 equals(_PRO_FILE_, $${ROOT_WEBKIT_DIR}/WebKit.pro):!isEmpty(OVERRIDE_SUBDIRS) {
219 # The root WebKit project file is the only one that allows
220 # you to pass a set of subtargets on the comand line.
221 SUBDIRS = $$OVERRIDE_SUBDIRS
224 # Remove subdirs that do not exist
225 for(subdir, SUBDIRS) {
226 path = $$eval($${subdir}.file)
227 isEmpty(path): path = $$eval($${subdir}.subdir)
228 isEmpty(path): path = $${subdir}
229 !exists($${_PRO_FILE_PWD_}$${QMAKE_DIR_SEP}$${path}) {
230 #message(Removing invalid subtarget $${subdir} $${path})
231 #SUBDIRS -= $${subdir}
235 # Doing `$(MAKE) qmake' should recurse through all subdirs
236 contains(TEMPLATE, subdirs):!no_recursive_qmake {
237 recursive_qmake.target = qmake_all
239 # We could do this using CONFIG += recurse but that adds
240 # a dependency for each recursive target on its makefile,
241 # while we want it to depend on *-qmake_all, so that we
242 # don't end up running qmake twice.
244 for(subdir, SUBDIRS) {
245 contains(NO_RECURSIVE_QMAKE_SUBDIRS, $${subdir}) {
246 debug(1, Skipping recursive qmake for $${subdir})
250 subdir_config = $$eval($${subdir}.CONFIG)
251 contains(subdir_config, no_default_target):next()
253 debug(1, "Making qmake recursive for $$subdir")
255 variables = $$computeSubdirVariables($${subdir})
257 target_name = $$eval($${variables}.target)-recursive_qmake
259 eval($${target_name}.target = $$target_name)
260 eval($${target_name}.depends = $$eval($${variables}.target)-qmake_all)
261 commands = $$eval($${variables}.subdir_command) $(MAKE) -f $$eval($${variables}.makefile) qmake
262 eval($${target_name}.commands = $$commands)
264 QMAKE_EXTRA_TARGETS += $${target_name}
265 recursive_qmake.depends += $${target_name}
268 !isEmpty(recursive_qmake.depends): QMAKE_EXTRA_TARGETS += recursive_qmake
271 incremental.target = incremental
272 incremental.commands = $(MAKE) -f $(MAKEFILE) qmake && $(MAKE) -f $(MAKEFILE)
273 QMAKE_EXTRA_TARGETS += incremental
275 # Don't set OBJECTS_DIR for subdirs, as that will unconditionally
276 # create the directory, even if we're not using it.
277 contains(TEMPLATE, subdirs) {
281 # Remove duplicated sources
282 SOURCES = $$unique(SOURCES)
283 OBJECTIVE_SOURCES = $$unique(OBJECTIVE_SOURCES)
285 # Someone might remove a header from the tree without touching
286 # the corresponding project file, for example if the project
287 # file never had the header in HEADERS. In that case we don't
288 # want warnings from make about "No rule to make target".
289 ignore_missing_headers.target = %.h
290 ignore_missing_headers.commands = $${MAKEFILE_NOOP_COMMAND}
291 QMAKE_EXTRA_TARGETS += ignore_missing_headers
293 # Override default target
294 build_pass:build_all:default_target.target = all
295 else: default_target.target = first
296 for(target, $$list($$unique(DEFAULT_TARGETS))) {
297 default_target.depends += $$target
299 !isEmpty(default_target.depends): QMAKE_EXTRA_TARGETS += default_target
301 # Qt's debug_and_release config will replace every occurance of
302 # Release or Debug in the destination dir. This fails when the
303 # desination dir is absolute and contains a static path component
304 # that also contains either of those two words, so we make DESTDIR
306 DESTDIR = $$replace(DESTDIR, ^$${ROOT_BUILD_DIR}, $${BUILD_ROOT_RELATIVE_TO_OUT_PWD})
308 # Since we loaded our own rules for depending on QtWebKit, and we
309 # have no more logic that checks contains(QT, webkit), we unset it
310 # here so that Qt will not add its own include and library paths.
311 haveQt(4): QT -= webkit webkit-private
313 load(default_post) # Load Qt's defaults