2010-05-03 Abhishek Arya <inferno@chromium.org>
[WebKit-https.git] / GNUmakefile.am
1 # Top-level Makefile rule for automake
2 #
3 # Variable conventions:
4 #
5 # _h_api            = API headers that will be installed and included in the distribution
6 # _cppflags         = flags that will be passed to the C/CXX Preprocessor
7 # _sources          = sources that will be compiled and included in the distribution
8 # _built_sources    = files that will be autogenerated by the build system and
9 #                     will be part of the _SOURCES primary
10 # _built_nosources  = files that are autogenerated but are not part of the
11 #                     _SOURCES primary
12 # _cleanfiles       = files that will be removed by the clean target
13 #
14 # Sources, headers, flags, etc... should be added to the respective variables
15 # with the above suffix, e.g, webcore-specific sources should go to
16 # webcore_sources, gtk port API and WebCoreSupport parts to webkitgtk_sources,
17 # etc... The only exceptions are the global variables. See Global Variables
18 # below.
19 #
20 # Global Variables
21 #
22 # global_cppflags   = CPPFLAGS that apply to JSC, WebCore, and to any
23 #                     specific port
24 # global_cflags     = CFLAGS that apply to JSC, WebCore, and to
25 #                     any specific port
26 # global_cxxflags   = CXXFLAGS that apply to JSC, WebCore, and to any
27 #                     specific port
28
29 srcdir = @srcdir@
30 VPATH = @srcdir@
31
32 DISTCHECK_CONFIGURE_FLAGS = \
33         --enable-introspection  \
34         --enable-gtk-doc
35
36 # Directory for autogenerated sources
37 GENSOURCES := $(top_builddir)/DerivedSources
38 GENSOURCESWEBKITDOM := $(top_builddir)/DerivedSources/webkit
39 GENPROGRAMS := $(top_builddir)/Programs
40
41 # Script for creating hash tables
42 CREATE_HASH_TABLE = $(srcdir)/JavaScriptCore/create_hash_table
43
44 # Programs to run the WebKitGtk unit tests
45 GTESTER = gtester
46 GTESTER_REPORT = gtester-report
47
48 # Libraries and support components
49 bin_PROGRAMS :=
50 noinst_PROGRAMS :=
51 noinst_HEADERS :=
52 noinst_LTLIBRARIES :=
53 lib_LIBRARIES :=
54 IDL_BINDINGS :=
55 TEST_PROGS :=
56 POFILES :=
57 MOFILES :=
58 javascriptcore_h_api :=
59 javascriptcore_cppflags:=
60 javascriptcore_sources :=
61 javascriptcore_built_sources :=
62 javascriptcore_built_nosources :=
63 javascriptcore_dist :=
64 webcore_cppflags :=
65 webcore_sources :=
66 webcore_libadd :=
67 webcore_built_sources :=
68 webcore_built_nosources :=
69 webcore_dist :=
70 webcoregtk_cppflags :=
71 webcoregtk_sources :=
72 webkitgtk_h_api :=
73 webkitgtk_sources :=
74 webkitgtk_cppflags :=
75 webkitgtk_built_sources :=
76 webkitgtk_built_nosources :=
77 webkitgtk_cleanfiles :=
78 global_cppflags :=
79 global_cflags :=
80 global_cxxflags :=
81 corekit_cflags :=
82 corekit_cppflags :=
83 JSCORE_GIRSOURCES :=
84 WEBKIT_GIRSOURCES :=
85 typelibsdir :=
86 typelibs_DATA :=
87 EXTRA_DIST :=
88 BUILT_SOURCES :=
89 CLEANFILES :=
90 DISTCLEANFILES :=
91 MAINTAINERCLEANFILES :=
92
93 webcoregtk_cppflags += \
94         -I$(top_builddir)/DerivedSources/webkit \
95         -I$(srcdir)/WebCore/bindings \
96         -I$(srcdir)/WebCore/bindings/gobject
97
98 # CFLAGS/CXXFLAGS used by WebCore and WebKit
99 #
100 # gtk+.pc already include glib, cairo, freetype and pango CFLAGS
101 # Don't include them for now to reduce the noise when compiling
102 # $(GLIB_CFLAGS) $(CAIRO_CFLAGS) $(PANGO_CFLAGS)  $(FREETYPE_CFLAGS)
103 corekit_cflags += \
104         -fno-strict-aliasing \
105         $(COVERAGE_CFLAGS) \
106         $(ENCHANT_CFLAGS) \
107         $(GAIL_CFLAGS) \
108         $(GEOCLUE_CFLAGS) \
109         $(GLIB_CFLAGS) \
110         $(GSTREAMER_CFLAGS) \
111         $(GTK_CFLAGS) \
112         $(HILDON_CFLAGS) \
113         $(LIBSOUP_CFLAGS) \
114         $(LIBXML_CFLAGS) \
115         $(LIBXSLT_CFLAGS) \
116         $(SQLITE3_CFLAGS) \
117         $(UNICODE_CFLAGS) \
118         $(XT_CFLAGS)
119
120 # When building webcore/webkit, we want WebCore/config.h and NOT
121 # JavaScriptCore/config.h, hence, it's important that WebCore/ should come first
122 # before JavaScriptCore in the include path.
123 corekit_cppflags += \
124         $(global_cppflags) \
125         $(webcore_cppflags) \
126         $(webcoregtk_cppflags) \
127         $(javascriptcore_cppflags)
128
129 # For the Gtk port we want to use XP_UNIX both in X11 and Mac
130 if !TARGET_WIN32
131 corekit_cppflags += -DXP_UNIX
132 endif
133
134 # Default compiler flags
135 global_cflags += \
136         -Wall -W -Wcast-align -Wchar-subscripts -Wreturn-type \
137         -Wformat -Wformat-security -Wno-format-y2k -Wundef \
138         -Wmissing-format-attribute -Wpointer-arith -Wwrite-strings \
139         -Wno-unused-parameter -Wno-parentheses \
140         -fno-exceptions
141
142 global_cxxflags += \
143         $(global_cflags) \
144         $(SYMBOL_VISIBILITY_INLINES) \
145         -fno-rtti
146
147 # -no-undefined required for building DLLs on Windows
148 # It breaks the build on other platforms, so we use it conditionally
149 if OS_WIN32
150 no_undefined = -no-undefined
151 version_script = -export-symbols-regex "^(webkit_|JS).*"
152 endif
153
154 if OS_GNU
155 version_script = -Wl,--version-script,$(srcdir)/autotools/symbols.filter
156 endif
157
158 # Shared libraries
159 lib_LTLIBRARIES = \
160         libwebkit-1.0.la
161
162 # Convenience libraries
163 noinst_LTLIBRARIES += \
164         libJavaScriptCore.la
165
166 # JavaScriptCore
167 javascriptcore_cppflags += \
168         -I$(srcdir)/JavaScriptCore/ForwardingHeaders \
169         -I$(srcdir)/JavaScriptCore/parser \
170         -I$(srcdir)/JavaScriptCore/wtf \
171         -I$(srcdir)/JavaScriptCore/wtf/gtk \
172         -I$(srcdir)/JavaScriptCore/wtf/gobject \
173         -I$(top_builddir)/DerivedSources
174
175 nodist_EXTRA_libJavaScriptCore_la_SOURCES = \
176         $(javascriptcore_built_nosources)
177
178 nodist_libJavaScriptCore_la_SOURCES = \
179         $(javascriptcore_built_sources)
180
181 libJavaScriptCore_ladir = $(prefix)/include/webkit-1.0/JavaScriptCore
182 libJavaScriptCore_la_HEADERS = $(javascriptcore_h_api)
183
184 libJavaScriptCore_la_SOURCES = \
185         $(javascriptcore_sources)
186
187 libJavaScriptCore_la_LIBADD = \
188         $(UNICODE_LIBS) \
189         $(GLIB_LIBS) \
190         -lpthread
191
192 libJavaScriptCore_la_CXXFLAGS = \
193         $(global_cxxflags) \
194         $(libJavaScriptCore_la_CFLAGS)
195
196 libJavaScriptCore_la_CFLAGS = \
197         -fstrict-aliasing \
198         -O3 \
199         $(global_cflags) \
200         $(GLIB_CFLAGS) \
201         $(UNICODE_CFLAGS)
202
203 libJavaScriptCore_la_CPPFLAGS = \
204         $(global_cppflags) \
205         $(javascriptcore_cppflags)
206
207 # WebKit
208 nodist_EXTRA_libwebkit_1_0_la_SOURCES = \
209         $(webcore_built_nosources)
210
211 nodist_libwebkit_1_0_la_SOURCES = \
212         $(webcore_built_sources) \
213         $(webkitgtk_built_sources)
214
215 libwebkit_1_0_ladir = $(prefix)/include/webkit-1.0/webkit
216 libwebkit_1_0_la_HEADERS = \
217         $(webkitgtk_h_api) \
218         WebKit/gtk/webkit/webkitenumtypes.h
219
220 libwebkit_1_0_la_SOURCES = \
221         $(webcore_sources) \
222         $(webcoregtk_sources) \
223         $(webkitgtk_sources)
224
225 libwebkit_1_0_la_CXXFLAGS = \
226         $(global_cxxflags) \
227         $(corekit_cflags)
228
229 libwebkit_1_0_la_CFLAGS = \
230         $(global_cflags) \
231         $(corekit_cflags)
232
233 libwebkit_1_0_la_CPPFLAGS = \
234         $(corekit_cppflags) \
235         $(webkitgtk_cppflags) \
236         $(HILDON_CPPFLAGS)
237
238 libwebkit_1_0_la_LDFLAGS = \
239         -version-info @LIBWEBKITGTK_VERSION@ \
240         $(version_script) \
241         $(no_undefined)
242
243 libwebkit_1_0_la_LIBADD = \
244         -lpthread \
245         libJavaScriptCore.la \
246         libWebCoreJS.la \
247         libgdom.la \
248         $(webcore_ldflags) \
249         $(CAIRO_LIBS) \
250         $(COVERAGE_LDFLAGS) \
251         $(ENCHANT_LIBS) \
252         $(FREETYPE_LIBS) \
253         $(GAIL_LIBS) \
254         $(GEOCLUE_LIBS) \
255         $(GLIB_LIBS) \
256         $(GSTREAMER_LIBS) \
257         $(GTK_LIBS) \
258         $(HILDON_LIBS) \
259         $(JPEG_LIBS) \
260         $(LIBSOUP_LIBS) \
261         $(LIBXML_LIBS) \
262         $(LIBXSLT_LIBS) \
263         $(PANGO_LIBS) \
264         $(PNG_LIBS) \
265         $(SQLITE3_LIBS) \
266         $(UNICODE_LIBS) \
267         $(XT_LIBS)
268
269 libgdom_ladir = $(prefix)/include/webkit-1.0/webkit
270 libgdom_la_HEADERS = \
271         $(libgdom_h_api)
272
273 #
274 # Extra checks and flags
275 global_cppflags += \
276         -DBUILDING_CAIRO__=1 \
277         -DBUILDING_GTK__=1 \
278         -DWTF_CHANGES
279
280 if USE_ICU_UNICODE
281 global_cppflags += \
282         -DWTF_USE_ICU_UNICODE=1
283 endif
284
285 if USE_GLIB_UNICODE
286 global_cppflags += \
287         -DWTF_USE_GLIB_UNICODE=1
288 endif
289
290 if !ENABLE_FAST_MALLOC
291 global_cppflags += \
292         -DUSE_SYSTEM_MALLOC
293 endif
294
295 if !ENABLE_DEBUG
296 global_cppflags += -DNDEBUG
297 global_cflags += $(SYMBOL_VISIBILITY)
298
299 else
300 webcoregtk_cppflags += \
301         -DG_DISABLE_DEPRECATED \
302         -DGDK_PIXBUF_DISABLE_DEPRECATED \
303         -DGDK_DISABLE_DEPRECATED \
304         -DGTK_DISABLE_DEPRECATED \
305         -DPANGO_DISABLE_DEPRECATED
306
307 # Might be useful in the future
308 #       -DGDK_MULTIHEAD_SAFE \
309 #       -DGTK_MULTIHEAD_SAFE
310 endif
311
312 if ENABLE_COVERAGE
313 global_cppflags += \
314         -DGCC_GENERATE_TEST_COVERAGE_FILES \
315         -DGCC_INSTRUMENT_PROGRAM_FLOW_ARCS
316 endif
317
318 webkitgtk_h_api += \
319         $(srcdir)/WebKit/gtk/webkit/webkit.h \
320         $(srcdir)/WebKit/gtk/webkit/webkitdefines.h \
321         $(srcdir)/WebKit/gtk/webkit/webkitdownload.h \
322         $(srcdir)/WebKit/gtk/webkit/webkiterror.h \
323         $(srcdir)/WebKit/gtk/webkit/webkithittestresult.h \
324         $(srcdir)/WebKit/gtk/webkit/webkitnetworkrequest.h \
325         $(srcdir)/WebKit/gtk/webkit/webkitnetworkresponse.h \
326         $(srcdir)/WebKit/gtk/webkit/webkitsoupauthdialog.h \
327         $(srcdir)/WebKit/gtk/webkit/webkitwebbackforwardlist.h \
328         $(srcdir)/WebKit/gtk/webkit/webkitwebdatasource.h \
329         $(srcdir)/WebKit/gtk/webkit/webkitwebframe.h \
330         $(srcdir)/WebKit/gtk/webkit/webkitwebhistoryitem.h \
331         $(srcdir)/WebKit/gtk/webkit/webkitwebinspector.h \
332         $(srcdir)/WebKit/gtk/webkit/webkitwebnavigationaction.h \
333         $(srcdir)/WebKit/gtk/webkit/webkitwebpolicydecision.h \
334         $(srcdir)/WebKit/gtk/webkit/webkitgeolocationpolicydecision.h \
335         $(srcdir)/WebKit/gtk/webkit/webkitwebresource.h \
336         $(srcdir)/WebKit/gtk/webkit/webkitwebsettings.h \
337         $(srcdir)/WebKit/gtk/webkit/webkitwebwindowfeatures.h \
338         $(srcdir)/WebKit/gtk/webkit/webkitwebview.h \
339         $(srcdir)/WebKit/gtk/webkit/webkitwebdatabase.h \
340         $(srcdir)/WebKit/gtk/webkit/webkitsecurityorigin.h \
341         $(top_builddir)/WebKit/gtk/webkit/webkitversion.h
342
343 webkitgtk_built_sources += \
344         DerivedSources/webkitenumtypes.cpp \
345         DerivedSources/webkitdomenumtypes.cpp \
346         DerivedSources/webkitmarshal.cpp \
347         DerivedSources/webkitmarshal.h \
348         WebKit/gtk/webkit/webkitenumtypes.h
349
350 webkitgtk_sources += \
351         WebKit/gtk/WebCoreSupport/ChromeClientGtk.cpp \
352         WebKit/gtk/WebCoreSupport/ChromeClientGtk.h \
353         WebKit/gtk/WebCoreSupport/ContextMenuClientGtk.cpp \
354         WebKit/gtk/WebCoreSupport/ContextMenuClientGtk.h \
355         WebKit/gtk/WebCoreSupport/DocumentLoaderGtk.cpp \
356         WebKit/gtk/WebCoreSupport/DocumentLoaderGtk.h \
357         WebKit/gtk/WebCoreSupport/DragClientGtk.cpp \
358         WebKit/gtk/WebCoreSupport/DragClientGtk.h \
359         WebKit/gtk/WebCoreSupport/EditorClientGtk.cpp \
360         WebKit/gtk/WebCoreSupport/EditorClientGtk.h \
361         WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.cpp \
362         WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.h \
363         WebKit/gtk/WebCoreSupport/InspectorClientGtk.cpp \
364         WebKit/gtk/WebCoreSupport/InspectorClientGtk.h \
365         WebKit/gtk/WebCoreSupport/PasteboardHelperGtk.cpp \
366         WebKit/gtk/WebCoreSupport/PasteboardHelperGtk.h \
367         WebKit/gtk/webkit/webkitapplicationcache.cpp \
368         WebKit/gtk/webkit/webkitdownload.cpp \
369         WebKit/gtk/webkit/webkiterror.cpp \
370         WebKit/gtk/webkit/webkithittestresult.cpp \
371         WebKit/gtk/webkit/webkitnetworkrequest.cpp \
372         WebKit/gtk/webkit/webkitnetworkresponse.cpp \
373         WebKit/gtk/webkit/webkitprivate.cpp \
374         WebKit/gtk/webkit/webkitprivate.h \
375         WebKit/gtk/webkit/webkitsoupauthdialog.c \
376         WebKit/gtk/webkit/webkitversion.cpp \
377         WebKit/gtk/webkit/webkitwebbackforwardlist.cpp \
378         WebKit/gtk/webkit/webkitwebdatasource.cpp \
379         WebKit/gtk/webkit/webkitwebframe.cpp \
380         WebKit/gtk/webkit/webkitwebhistoryitem.cpp \
381         WebKit/gtk/webkit/webkitwebinspector.cpp \
382         WebKit/gtk/webkit/webkitwebnavigationaction.cpp \
383         WebKit/gtk/webkit/webkitwebpolicydecision.cpp \
384         WebKit/gtk/webkit/webkitgeolocationpolicydecision.cpp \
385         WebKit/gtk/webkit/webkitwebresource.cpp \
386         WebKit/gtk/webkit/webkitwebdatabase.cpp \
387         WebKit/gtk/webkit/webkitsecurityorigin.cpp \
388         WebKit/gtk/webkit/webkitwebsettings.cpp \
389         WebKit/gtk/webkit/webkitwebview.cpp \
390         WebKit/gtk/webkit/webkitwebwindowfeatures.cpp \
391         WebKit/gtk/webkit/webkitworkers.cpp
392
393 webkitgtk_cppflags += \
394         -DBUILDING_WEBKIT \
395         -DPACKAGE_LOCALE_DIR=\"$(localedir)\" \
396         -DDATA_DIR=\"${datadir}\" \
397         -I$(srcdir)/WebKit/gtk \
398         -I$(srcdir)/WebKit/gtk/WebCoreSupport \
399         -I$(srcdir)/WebKit/gtk/webkit \
400         -I$(top_builddir)/WebKit/gtk \
401         -I$(top_builddir)/WebKit/gtk/webkit \
402         -I$(GENSOURCESWEBKITDOM)
403
404 webkitgtk_cleanfiles += \
405         $(top_builddir)/stamp-webkitmarshal.cpp \
406         $(top_builddir)/stamp-webkitmarshal.h \
407         $(top_builddir)/stamp-webkitenumtypes.cpp \
408         $(top_builddir)/stamp-webkitenumtypes.h \
409         $(top_builddir)/Programs/GtkLauncher \
410         $(top_builddir)/WebKit/gtk/docs/version.xml \
411         $(top_builddir)/WebKit/gtk/docs/GNUmakefile \
412         $(top_builddir)/WebKit/gtk/webkit-1.0.pc \
413         $(top_builddir)/WebKit/gtk/webkit/webkitenumtypes.h \
414         $(top_builddir)/WebKit/gtk/webkit/webkitversion.h
415
416 pkgconfigdir = $(libdir)/pkgconfig
417 pkgconfig_DATA = WebKit/gtk/webkit-1.0.pc
418
419 if ENABLE_INTROSPECTION
420 JSCORE_GIRSOURCES += JSCore-1.0.gir
421 WEBKIT_GIRSOURCES += WebKit-1.0.gir
422
423 # JSCore-1.0.gir is handwritten - this is a hack to make the typelib
424 # generation work during make dist
425 JSCore-1.0.gir: $(srcdir)/WebKit/gtk/JSCore-1.0.gir
426         cp $(srcdir)/WebKit/gtk/JSCore-1.0.gir $(builddir)/
427
428 $(WEBKIT_GIRSOURCES): $(JSCORE_GIRSOURCES) $(G_IR_SCANNER) libwebkit-1.0.la
429         $(AM_V_GEN)$(G_IR_SCANNER) -v --namespace WebKit --nsversion=1.0 \
430              --include=GObject-2.0 \
431              --include=Gtk-2.0 \
432              --include=JSCore-1.0 \
433              --include=Soup-2.4 \
434              --library=webkit-1.0 \
435              --libtool="$(LIBTOOL)" \
436              --pkg gobject-2.0 \
437              --pkg gtk+-2.0 \
438              --pkg libsoup-2.4 \
439              --output $@ \
440              --add-include-path $(top_srcdir)/WebKit/gtk \
441              -I$(top_srcdir)/WebKit/gtk \
442              -I$(top_builddir)/WebKit/gtk \
443              -I$(top_srcdir)/JavaScriptCore/ForwardingHeaders \
444              -I$(top_srcdir) \
445              $(webkitgtk_h_api)
446
447 girdir = $(GIRDIR)
448 gir_DATA = $(WEBKIT_GIRSOURCES) $(JSCORE_GIRSOURCES)
449
450 typelibsdir += $(GIRTYPELIBDIR)
451 typelibs_DATA += $(JSCORE_GIRSOURCES:.gir=.typelib) $(WEBKIT_GIRSOURCES:.gir=.typelib)
452
453 %.typelib: %.gir $(G_IR_COMPILER)
454         $(AM_V_GEN)$(G_IR_COMPILER) --includedir $(top_srcdir)/WebKit/gtk $< -o $@
455
456 CLEANFILES += $(JSCORE_GIRSOURCES) $(WEBKIT_GIRSOURCES) $(typelibs_DATA)
457
458 endif
459
460 EXTRA_DIST += WebKit/gtk/JSCore-1.0.gir
461
462 WEBKIT_MARSHAL = $(GENSOURCES)/webkitmarshal
463 WEBKIT_MARSHAL_LIST = $(top_srcdir)/WebKit/gtk/webkitmarshal.list
464
465 $(WEBKIT_MARSHAL).cpp: stamp-webkitmarshal.cpp
466         @true
467
468 $(WEBKIT_MARSHAL).h: stamp-webkitmarshal.h
469         @true
470
471 stamp-webkitmarshal.cpp: $(WEBKIT_MARSHAL_LIST)
472         $(AM_V_GEN) echo "extern \"C\" {" > $(WEBKIT_MARSHAL).cpp && \
473         $(GLIB_GENMARSHAL) --prefix=webkit_marshal $(WEBKIT_MARSHAL_LIST) --body >> $(WEBKIT_MARSHAL).cpp && echo '}' >> $(WEBKIT_MARSHAL).cpp && \
474         echo timestamp > $(@F)
475
476 stamp-webkitmarshal.h: $(WEBKIT_MARSHAL_LIST)
477         $(AM_V_GEN)$(GLIB_GENMARSHAL) --prefix=webkit_marshal $(WEBKIT_MARSHAL_LIST) --header > $(WEBKIT_MARSHAL).h && \
478         echo timestamp > $(@F)
479
480 WebKit/gtk/webkit/webkitenumtypes.h: stamp-webkitenumtypes.h
481         @true
482 stamp-webkitenumtypes.h: $(webkitgtk_h_api) GNUmakefile
483         $(AM_V_GEN)glib-mkenums \
484                         --fhead "#ifndef WEBKIT_ENUM_TYPES_H\n" \
485                         --fhead "#define WEBKIT_ENUM_TYPES_H\n\n" \
486                         --fhead "#include <glib-object.h>\n\n" \
487                         --fhead "#include <webkit/webkitdefines.h>\n\n" \
488                         --fhead "G_BEGIN_DECLS\n\n" \
489                         --ftail "G_END_DECLS\n\n" \
490                         --ftail "#endif\n" \
491                         --fprod "#include <webkit/@basename@>\n\n" \
492                         --eprod "#define WEBKIT_TYPE_@ENUMSHORT@ @enum_name@_get_type()\n\n" \
493                         --eprod "WEBKIT_API GType\n@enum_name@_get_type(void);\n\n" \
494                 $(webkitgtk_h_api) | \
495                 sed 's,web_kit,webkit,' | \
496                 sed 's,WEBKIT_TYPE_KIT,WEBKIT_TYPE,' \
497                 > xgen-gth \
498         && (cmp -s xgen-gth WebKit/gtk/webkit/webkitenumtypes.h || cp xgen-gth WebKit/gtk/webkit/webkitenumtypes.h) \
499         && rm -f xgen-gth \
500         && echo timestamp > $(@F)
501
502 DerivedSources/webkitenumtypes.cpp: $(webkitgtk_h_api) GNUmakefile
503         $(AM_V_GEN)glib-mkenums \
504                         --fhead "#include <config.h>\n" \
505                         --fhead "#include <glib-object.h>\n" \
506                         --fhead "#include \"$(top_builddir)/WebKit/gtk/webkit/webkitenumtypes.h\"\n\n" \
507                         --fhead "extern \"C\" {\n\n" \
508                         --fprod "\n/* enumerations from \"@filename@\" */" \
509                         --vhead "static const G@Type@Value _@enum_name@_values[] = {" \
510                         --vprod "    { @VALUENAME@, \"@VALUENAME@\", \"@valuenick@\" }," \
511                         --vtail "    { 0, NULL, NULL }\n};\n\n" \
512                         --vtail "GType @enum_name@_get_type(void)\n{\n" \
513                         --vtail "    static GType type = 0;\n\n" \
514                         --vtail "    if (!type)\n" \
515                         --vtail "        type = g_@type@_register_static(\"@EnumName@\", _@enum_name@_values);\n\n" \
516                         --vtail "    return type;\n}\n\n" \
517                         --ftail "}\n" \
518                 $(webkitgtk_h_api) | \
519                 sed 's,web_kit,webkit,' \
520                 > xgen-gtc \
521         && cp xgen-gtc $@ \
522         && rm -f xgen-gtc
523
524 WebKit/gtk/webkit/webkitdomenumtypes.h: stamp-webkitdomenumtypes.h
525         @true
526 stamp-webkitdomenumtypes.h: $(libgdom_h_api) GNUmakefile
527         $(AM_V_GEN)glib-mkenums \
528                         --fhead "#ifndef WEBKIT_DOM_ENUM_TYPES_H\n" \
529                         --fhead "#define WEBKIT_DOM_ENUM_TYPES_H\n\n" \
530                         --fhead "#include <glib-object.h>\n\n" \
531                         --fhead "G_BEGIN_DECLS\n\n" \
532                         --ftail "G_END_DECLS\n\n" \
533                         --ftail "#endif\n" \
534                         --fprod "#include <webkit/@basename@>\n\n" \
535                         --eprod "#define WEBKIT_DOM_TYPE_@ENUMSHORT@ @enum_name@_get_type()\n\n" \
536                         --eprod "WEBKIT_API GType\n@enum_name@_get_type(void);n\n" \
537                         $(libgdom_h_api) | \
538                 sed 's,web_kit,webkit_dom,' | \
539                 sed 's,WEBKIT_DOM_TYPE_KIT,WEBKIT_DOM_TYPE,' \
540                 > xgen-cgth \
541         && (cmp -s xgen-cgth WebKit/gtk/webkit/webkitdomenumtypes.h || cp xgen-cgth WebKit/gtk/webkit/webkitdomenumtypes.h) \
542         && rm -f xgen-cgth \
543         && echo timestamp > $(@F)
544
545 DerivedSources/webkitdomenumtypes.cpp: $(top_builddir)/WebKit/gtk/webkit/webkitdomenumtypes.h $(libgdom_h_api) GNUmakefile
546         $(AM_V_GEN)glib-mkenums \
547                         --fhead "#include <config.h>\n" \
548                         --fhead "#include <glib-object.h>\n" \
549                         --fhead "#include \"$(top_builddir)/WebKit/gtk/webkit/webkitdomenumtypes.h\"\n\n" \
550                         --fhead "extern \"C\" {\n\n" \
551                         --fprod "\n/* enumerations from \"@filename@\" */" \
552                         --vhead "static const G@Type@Value _@enum_name@_values] = {" \
553                         --vprod "    { @VALUENAME@, \"@VALUENAME@\", \"@valuenick@\" }," \
554                         --vtail "    { 0, NULL, NULL }\n};\n\n" \
555                         --vtail "GType @enum_name@_get_type(void)\n{\n" \
556                         --vtail "    static GType type = 0;\n\n" \
557                         --vtail "    if (!type)\n" \
558                         --vtail "        type = g_@type@_register_static(\"@EnumName@\", _@enum_name@_values);\n\n" \
559                         --vtail "    return type;\n}\n\n" \
560                         --ftail "}\n" \
561                 $(libgdom_h_api) | \
562                 sed 's,web_kit,webkitdom,' \
563                 > xgen-cgtc \
564         && cp xgen-cgtc $@ \
565         && rm -f xgen-cgtc
566
567 # Files that will be distributed
568 EXTRA_DIST += \
569         $(srcdir)/gtk-doc.make \
570         WebKit/LICENSE \
571         $(javascriptcore_dist) \
572         $(webcore_dist) \
573         $(srcdir)/autotools/symbols.filter \
574         $(srcdir)/WebKit/gtk/ChangeLog \
575         $(srcdir)/WebKit/gtk/NEWS \
576         $(srcdir)/WebKit/gtk/webkitmarshal.list \
577         $(srcdir)/WebKit/gtk/docs/GNUmakefile.* \
578         $(srcdir)/WebKit/gtk/docs/webkitenvironment.xml \
579         $(srcdir)/WebKit/gtk/docs/webkitgtk-docs.sgml \
580         $(srcdir)/WebKit/gtk/docs/webkitgtk-sections.txt \
581         $(srcdir)/WebKit/gtk/docs/version.xml.in \
582         $(srcdir)/WebKit/gtk/po/* \
583         $(srcdir)/WebKit/gtk/resources/* \
584         $(srcdir)/WebKit/gtk/tests/resources/* \
585         $(srcdir)/WebKit/gtk/tests/test_utils.h
586
587 # extra resource files
588 resourcesdir = ${datadir}/webkit-1.0/resources
589 dist_resources_DATA = \
590         $(shell ls $(srcdir)/WebKit/gtk/resources/*.html)
591
592 # END WEBKIT GTK+
593
594 # Include module makefiles
595 include JavaScriptCore/GNUmakefile.am
596 include WebCore/GNUmakefile.am
597 include WebKitTools/GNUmakefile.am
598 include WebKit/gtk/po/GNUmakefile.am
599
600 # Build unit tests
601 noinst_PROGRAMS += $(TEST_PROGS)
602
603 webkit_tests_cflags = \
604         -fno-strict-aliasing \
605         -I$(srcdir)/JavaScriptCore/ForwardingHeaders \
606         -I$(srcdir)/WebKit/gtk \
607         -I$(top_builddir)/WebKit/gtk \
608         -I$(top_builddir)/DerivedSources \
609         -I$(top_srcdir)/WebCore/bindings \
610         -I$(top_srcdir)/WebCore/bindings/gobject \
611         $(global_cflags) \
612         $(GLIB_CFLAGS) \
613         $(GTK_CFLAGS) \
614         $(LIBSOUP_CFLAGS)
615
616 webkit_tests_ldadd = \
617         libwebkit-1.0.la \
618         $(GTK_LIBS)     \
619         $(GLIB_LIBS) \
620         $(LIBSOUP_LIBS)
621
622 webkit_tests_ldflags = \
623         -no-install \
624         -no-fast-install
625
626 TEST_PROGS += \
627         Programs/unittests/testdomdocument \
628         Programs/unittests/testhttpbackend \
629         Programs/unittests/testloading \
630         Programs/unittests/testglobals \
631         Programs/unittests/testmimehandling \
632         Programs/unittests/testnetworkrequest \
633         Programs/unittests/testnetworkresponse \
634         Programs/unittests/testwebframe \
635         Programs/unittests/testwebbackforwardlist \
636         Programs/unittests/testwebhistoryitem \
637         Programs/unittests/testwindow \
638         Programs/unittests/testdownload \
639         Programs/unittests/testatk \
640         Programs/unittests/testatkroles \
641         Programs/unittests/testhittestresult \
642         Programs/unittests/testwebsettings \
643         Programs/unittests/testwebresource \
644         Programs/unittests/testwebdatasource \
645         Programs/unittests/testwebview \
646         Programs/unittests/testkeyevents
647
648 # Add additional tests here
649 Programs_unittests_testdomdocument_SOURCES = WebKit/gtk/tests/testdomdocument.c
650 Programs_unittests_testdomdocument_CFLAGS = $(webkit_tests_cflags)
651 Programs_unittests_testdomdocument_LDADD = $(webkit_tests_ldadd)
652 Programs_unittests_testdomdocument_LDFLAGS = $(webkit_tests_ldflags)
653
654 Programs_unittests_testhttpbackend_SOURCES = WebKit/gtk/tests/testhttpbackend.c
655 Programs_unittests_testhttpbackend_CFLAGS = $(webkit_tests_cflags)
656 Programs_unittests_testhttpbackend_LDADD = $(webkit_tests_ldadd)
657 Programs_unittests_testhttpbackend_LDFLAGS = $(webkit_tests_ldflags)
658
659 Programs_unittests_testglobals_SOURCES = WebKit/gtk/tests/testglobals.c
660 Programs_unittests_testglobals_CFLAGS = $(webkit_tests_cflags)
661 Programs_unittests_testglobals_LDADD = $(webkit_tests_ldadd)
662 Programs_unittests_testglobals_LDFLAGS = $(webkit_tests_ldflags)
663
664 Programs_unittests_testloading_SOURCES = WebKit/gtk/tests/testloading.c
665 Programs_unittests_testloading_CFLAGS = $(webkit_tests_cflags)
666 Programs_unittests_testloading_LDADD = $(webkit_tests_ldadd)
667 Programs_unittests_testloading_LDFLAGS = $(webkit_tests_ldflags)
668
669 Programs_unittests_testmimehandling_SOURCES = WebKit/gtk/tests/testmimehandling.c WebKit/gtk/tests/test_utils.c
670 Programs_unittests_testmimehandling_CFLAGS = $(webkit_tests_cflags)
671 Programs_unittests_testmimehandling_LDADD = $(webkit_tests_ldadd)
672 Programs_unittests_testmimehandling_LDFLAGS = $(webkit_tests_ldflags)
673
674 Programs_unittests_testnetworkrequest_SOURCES = WebKit/gtk/tests/testnetworkrequest.c
675 Programs_unittests_testnetworkrequest_CFLAGS = $(webkit_tests_cflags)
676 Programs_unittests_testnetworkrequest_LDADD = $(webkit_tests_ldadd)
677 Programs_unittests_testnetworkrequest_LDFLAGS = $(webkit_tests_ldflags)
678
679 Programs_unittests_testnetworkresponse_SOURCES = WebKit/gtk/tests/testnetworkresponse.c
680 Programs_unittests_testnetworkresponse_CFLAGS = $(webkit_tests_cflags)
681 Programs_unittests_testnetworkresponse_LDADD = $(webkit_tests_ldadd)
682 Programs_unittests_testnetworkresponse_LDFLAGS = $(webkit_tests_ldflags)
683
684 Programs_unittests_testwebframe_SOURCES = WebKit/gtk/tests/testwebframe.c
685 Programs_unittests_testwebframe_CFLAGS = $(webkit_tests_cflags)
686 Programs_unittests_testwebframe_LDADD = $(webkit_tests_ldadd)
687 Programs_unittests_testwebframe_LDFLAGS = $(webkit_tests_ldflags)
688
689 Programs_unittests_testwebbackforwardlist_SOURCES = WebKit/gtk/tests/testwebbackforwardlist.c
690 Programs_unittests_testwebbackforwardlist_CFLAGS = $(webkit_tests_cflags)
691 Programs_unittests_testwebbackforwardlist_LDADD = $(webkit_tests_ldadd)
692 Programs_unittests_testwebbackforwardlist_LDFLAGS = $(webkit_tests_ldflags)
693
694 Programs_unittests_testwebhistoryitem_SOURCES = WebKit/gtk/tests/testwebhistoryitem.c
695 Programs_unittests_testwebhistoryitem_CFLAGS = $(webkit_tests_cflags)
696 Programs_unittests_testwebhistoryitem_LDADD = $(webkit_tests_ldadd)
697 Programs_unittests_testwebhistoryitem_LDFLAGS = $(webkit_tests_ldflags)
698
699 Programs_unittests_testwindow_SOURCES = WebKit/gtk/tests/testwindow.c
700 Programs_unittests_testwindow_CFLAGS = $(webkit_tests_cflags)
701 Programs_unittests_testwindow_LDADD = $(webkit_tests_ldadd)
702 Programs_unittests_testwindow_LDFLAGS = $(webkit_tests_ldflags)
703
704 Programs_unittests_testdownload_SOURCES = WebKit/gtk/tests/testdownload.c
705 Programs_unittests_testdownload_CFLAGS = $(webkit_tests_cflags)
706 Programs_unittests_testdownload_LDADD = $(webkit_tests_ldadd)
707 Programs_unittests_testdownload_LDFLAGS = $(webkit_tests_ldflags)
708
709 Programs_unittests_testatk_SOURCES = WebKit/gtk/tests/testatk.c
710 Programs_unittests_testatk_CFLAGS = $(webkit_tests_cflags)
711 Programs_unittests_testatk_LDADD = $(webkit_tests_ldadd)
712 Programs_unittests_testatk_LDFLAGS = $(webkit_tests_ldflags)
713
714 Programs_unittests_testatkroles_SOURCES = WebKit/gtk/tests/testatkroles.c
715 Programs_unittests_testatkroles_CFLAGS = $(webkit_tests_cflags)
716 Programs_unittests_testatkroles_LDADD = $(webkit_tests_ldadd)
717 Programs_unittests_testatkroles_LDFLAGS = $(webkit_tests_ldflags)
718
719 Programs_unittests_testwebsettings_SOURCES = WebKit/gtk/tests/testwebsettings.c
720 Programs_unittests_testwebsettings_CFLAGS = $(webkit_tests_cflags)
721 Programs_unittests_testwebsettings_LDADD = $(webkit_tests_ldadd)
722 Programs_unittests_testwebsettings_LDFLAGS = $(webkit_tests_ldflags)
723
724 Programs_unittests_testwebresource_SOURCES = WebKit/gtk/tests/testwebresource.c
725 Programs_unittests_testwebresource_CFLAGS = $(webkit_tests_cflags)
726 Programs_unittests_testwebresource_LDADD = $(webkit_tests_ldadd)
727
728 Programs_unittests_testwebdatasource_SOURCES = WebKit/gtk/tests/testwebdatasource.c
729 Programs_unittests_testwebdatasource_CFLAGS = $(webkit_tests_cflags)
730 Programs_unittests_testwebdatasource_LDADD = $(webkit_tests_ldadd)
731
732 Programs_unittests_testwebview_SOURCES = WebKit/gtk/tests/testwebview.c WebKit/gtk/tests/test_utils.c
733 Programs_unittests_testwebview_CFLAGS = $(webkit_tests_cflags)
734 Programs_unittests_testwebview_LDADD = $(webkit_tests_ldadd)
735 Programs_unittests_testwebview_LDFLAGS = $(webkit_tests_ldflags)
736
737 Programs_unittests_testhittestresult_SOURCES = WebKit/gtk/tests/testhittestresult.c
738 Programs_unittests_testhittestresult_CFLAGS = $(webkit_tests_cflags)
739 Programs_unittests_testhittestresult_LDADD = $(webkit_tests_ldadd)
740
741 Programs_unittests_testkeyevents_SOURCES = WebKit/gtk/tests/testkeyevents.c
742 Programs_unittests_testkeyevents_CFLAGS = $(webkit_tests_cflags)
743 Programs_unittests_testkeyevents_LDADD = $(webkit_tests_ldadd)
744 Programs_unittests_testkeyevents_LDFLAGS = $(webkit_tests_ldflags)
745
746 # Autogenerated sources
747 BUILT_SOURCES += \
748         $(javascriptcore_built_sources) \
749         $(javascriptcore_built_nosources) \
750         $(webcore_built_sources) \
751         $(webcore_built_nosources) \
752         $(webkitgtk_built_sources) \
753         $(webkitgtk_built_nosources) \
754         $(gdom_built_nosources)
755
756 # Project-wide clean rules
757 # Files that will be cleaned
758 CLEANFILES += \
759         $(BUILT_SOURCES) \
760         $(webkitgtk_cleanfiles)
761
762 DISTCLEANFILES += \
763         $(CLEANFILES) \
764         $(builddir)/doltcompile \
765         $(builddir)/doltlibtool
766
767 MAINTAINERCLEANFILES += \
768         $(CLEANFILES) \
769         $(builddir)/doltcompile \
770         $(builddir)/doltlibtool \
771         $(srcdir)/aconfig.h.in \
772         $(srcdir)/autotools/config.* \
773         $(srcdir)/autotools/compile \
774         $(srcdir)/autotools/depcomp \
775         $(srcdir)/autotools/install-sh \
776         $(srcdir)/autotools/missing \
777         $(srcdir)/configure \
778         $(srcdir)/GNUmakefile.in \
779         $(srcdir)/INSTALL \
780         $(srcdir)/README \
781         $(top_builddir)/config.*
782
783 # Older automake versions (1.7) place Plo files in a different place so we need
784 # to create the output directory manually.
785 all-local: stamp-po
786         $(mkdir_p) $(top_builddir)/$(DEPDIR)/DerivedSources
787
788 # remove built sources and program directories
789 clean-local:
790         -rm -rf $(GENPROGRAMS)
791
792 maintainer-clean-local: distclean-local
793
794 distclean-local:
795         -rm -rf $(GENSOURCES) $(GENPROGRAMS)
796
797 install-data-local: po-install-data-local
798
799 installdirs-data-local: po-installdirs-data-local
800
801 uninstall-local: po-uninstall-local
802
803 # Run all tests in cwd
804 # FIXME: we should run this under xvfb
805 test: $(TEST_PROGS)
806         $(GTESTER) --verbose $(TEST_PROGS);
807
808 # test-report: run tests in cwd and generate report
809 # full-report: run tests in cwd with -m perf and -m slow and generate report
810 # perf-report: run tests in cwd with -m perf and generate report
811 test-report full-report perf-report: $(TEST_PROGS)
812         @ case $@ in \
813           test-report) test_options="-k";; \
814           full-report) test_options="-k -m=perf";; \
815           perf-report) test_options="-k -m=perf -m=slow";; \
816           esac ; \
817           $(GTESTER) --verbose $$test_options -o test-report.xml $(TEST_PROGS); \
818           $(GTESTER_REPORT) test-report.xml > test-report.html ;
819
820 .PHONY: test test-report perf-report full-report
821 check-local: test