WebCore:
[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 # Directory for autogenerated sources
33 GENSOURCES := $(top_builddir)/DerivedSources
34 GENPROGRAMS := $(top_builddir)/Programs
35
36 # Script for creating hash tables
37 CREATE_HASH_TABLE = $(srcdir)/JavaScriptCore/create_hash_table
38
39 # Libraries and support components
40 bin_PROGRAMS :=
41
42 noinst_PROGRAMS :=
43
44 noinst_HEADERS :=
45
46 lib_LIBRARIES :=
47
48 IDL_BINDINGS :=
49
50 TEST_PROGS :=
51
52 # Global flags to CPP
53 global_cppflags :=
54
55 global_cppflags += \
56         -DWTF_USE_ICU_UNICODE=1
57
58 # Default compiler flags
59 global_cflags := \
60         -Wall -W -Wcast-align -Wchar-subscripts -Wreturn-type \
61         -Wformat -Wformat-security -Wno-format-y2k -Wundef \
62         -Wmissing-format-attribute -Wpointer-arith -Wwrite-strings \
63         -Wno-unused-parameter -Wno-parentheses \
64         -fno-exceptions
65
66 global_cxxflags := \
67         $(SYMBOL_VISIBILITY_INLINES) \
68         -fno-rtti
69
70 if !ENABLE_DEBUG
71 global_cflags += \
72         $(SYMBOL_VISIBILITY)
73 endif
74
75 # -no-undefined required for building DLLs on Windows
76 # It breaks the build on other platforms, so we use it conditionally
77 if OS_WIN32
78 no_undefined = -no-undefined
79 endif
80
81 if OS_GNU
82 version_script = -Wl,--version-script,$(srcdir)/autotools/symbols.filter
83 endif
84
85 # Shared libraries
86 lib_LTLIBRARIES = \
87         libwebkit-1.0.la
88
89 # Convenience libraries
90 noinst_LTLIBRARIES = \
91         libJavaScriptCore.la \
92         libWebCore.la
93
94 #
95 # JavaScriptCore
96 javascriptcore_h_api :=
97 javascriptcore_cppflags:=
98 javascriptcore_sources :=
99 javascriptcore_built_sources :=
100 javascriptcore_built_nosources :=
101 javascriptcore_dist :=
102
103 javascriptcore_cppflags += \
104         -I$(srcdir)/JavaScriptCore \
105         -I$(srcdir)/JavaScriptCore/ForwardingHeaders \
106         -I$(srcdir)/JavaScriptCore/parser \
107         -I$(srcdir)/JavaScriptCore/wtf \
108         -I$(top_builddir)/DerivedSources
109
110 # The variables above are already included below so no need to touch
111 # these variables unless you really have to
112 nodist_EXTRA_libJavaScriptCore_la_SOURCES = \
113         $(javascriptcore_built_nosources)
114
115 nodist_libJavaScriptCore_la_SOURCES = \
116         $(javascriptcore_built_sources)
117
118 libJavaScriptCore_ladir = $(prefix)/include/webkit-1.0/JavaScriptCore
119 libJavaScriptCore_la_HEADERS = $(javascriptcore_h_api)
120
121 libJavaScriptCore_la_SOURCES = \
122         $(javascriptcore_sources)
123
124 libJavaScriptCore_la_LIBADD = \
125         $(UNICODE_LIBS) \
126         $(GLIB_LIBS) \
127         -lpthread
128
129 libJavaScriptCore_la_CXXFLAGS = \
130         $(global_cxxflags) \
131         $(libJavaScriptCore_la_CFLAGS)
132
133 libJavaScriptCore_la_CFLAGS = \
134         -fstrict-aliasing \
135         -O3 \
136         $(global_cflags) \
137         $(GLIB_CFLAGS) \
138         $(UNICODE_CFLAGS)
139
140 libJavaScriptCore_la_CPPFLAGS = \
141         $(global_cppflags) \
142         $(javascriptcore_cppflags)
143
144 #
145 # WebCore
146 webcore_cppflags :=
147 webcore_sources :=
148 webcore_libadd :=
149 webcore_built_sources :=
150 webcore_built_nosources :=
151 webcore_dist :=
152 webcoregtk_cppflags :=
153 webcoregtk_sources :=
154
155 nodist_EXTRA_libWebCore_la_SOURCES = \
156         $(webcore_built_nosources)
157
158 nodist_libWebCore_la_SOURCES = \
159         $(webcore_built_sources)
160
161 libWebCore_la_SOURCES = \
162         $(webcore_sources) \
163         $(webcoregtk_sources)
164
165 libWebCore_la_CXXFLAGS = \
166         $(global_cxxflags) \
167         $(libWebCore_la_CFLAGS)
168
169 libWebCore_la_CFLAGS = \
170         -fno-strict-aliasing \
171         $(global_cflags) \
172         $(GLIB_CFLAGS) \
173         $(UNICODE_CFLAGS) \
174         $(LIBXML_CFLAGS) \
175         $(CAIRO_CFLAGS) \
176         $(PANGO_CFLAGS) \
177         $(GTK_CFLAGS) \
178         $(XT_CFLAGS) \
179         $(LIBSOUP_CFLAGS) \
180         $(FREETYPE_CFLAGS) \
181         $(SQLITE3_CFLAGS) \
182         $(GSTREAMER_CFLAGS) \
183         $(LIBXSLT_CFLAGS) \
184         $(COVERAGE_CFLAGS) \
185         $(HILDON_CFLAGS) \
186         $(GEOCLUE_CFLAGS)
187
188 libWebCore_la_CPPFLAGS = \
189         $(global_cppflags) \
190         $(webcore_cppflags) \
191         $(javascriptcore_cppflags) \
192         $(webcoregtk_cppflags) \
193         $(HILDON_CPPFLAGS)
194
195 libWebCore_la_LIBADD = \
196         libJavaScriptCore.la \
197         libWebCoreJS.la \
198         $(webcore_libadd) \
199         $(GLIB_LIBS) \
200         $(LIBXML_LIBS) \
201         $(CAIRO_LIBS) \
202         $(PANGO_LIBS) \
203         $(GTK_LIBS) \
204         $(XT_LIBS) \
205         $(LIBSOUP_LIBS) \
206         $(FREETYPE_LIBS) \
207         $(UNICODE_LIBS) \
208         $(SQLITE3_LIBS) \
209         $(GSTREAMER_LIBS) \
210         $(LIBXSLT_LIBS) \
211         $(HILDON_LIBS) \
212         $(JPEG_LIBS) \
213         $(PNG_LIBS) \
214         $(GEOCLUE_LIBS) \
215         -lpthread
216
217 # WebKit
218 webkitgtk_h_api :=
219 webkitgtk_sources :=
220 webkitgtk_cppflags :=
221 webkitgtk_built_sources :=
222 webkitgtk_built_nosources :=
223 webkitgtk_cleanfiles :=
224
225 nodist_libwebkit_1_0_la_SOURCES = \
226         $(webkitgtk_built_sources)
227
228 libwebkit_1_0_ladir = $(prefix)/include/webkit-1.0/webkit
229 libwebkit_1_0_la_HEADERS = \
230         $(webkitgtk_h_api) \
231         WebKit/gtk/webkit/webkitenumtypes.h
232
233 libwebkit_1_0_la_SOURCES = \
234         $(webkitgtk_sources)
235
236 libwebkit_1_0_la_CXXFLAGS = \
237         $(libWebCore_la_CXXFLAGS)
238
239 libwebkit_1_0_la_CFLAGS = \
240         $(libWebCore_la_CFLAGS) \
241         $(GNOMEKEYRING_CFLAGS)
242
243 libwebkit_1_0_la_CPPFLAGS = \
244         $(libWebCore_la_CPPFLAGS) \
245         $(webkitgtk_cppflags)
246
247 libwebkit_1_0_la_LDFLAGS = \
248         $(COVERAGE_LDFLAGS) \
249         -version-info @LIBWEBKITGTK_VERSION@ \
250         $(version_script) \
251         $(no_undefined)
252
253 libwebkit_1_0_la_LIBADD = \
254         libWebCore.la \
255         $(GNOMEKEYRING_LIBS)
256
257 #
258 # Extra checks and flags
259 global_cppflags += \
260         -DBUILDING_CAIRO__=1 \
261         -DBUILDING_GTK__=1 \
262         -DWTF_CHANGES
263
264 if !ENABLE_FAST_MALLOC
265 global_cppflags += \
266         -DUSE_SYSTEM_MALLOC
267 endif
268
269 if TARGET_X11
270 global_cppflags += -DXP_UNIX
271 endif
272
273 if !ENABLE_DEBUG
274 global_cppflags += -DNDEBUG
275 else
276 webcoregtk_cppflags += \
277         -DG_DISABLE_DEPRECATED \
278         -DGDK_PIXBUF_DISABLE_DEPRECATED \
279         -DGDK_DISABLE_DEPRECATED \
280         -DGTK_DISABLE_DEPRECATED \
281         -DPANGO_DISABLE_DEPRECATED
282
283 # Might be useful in the future
284 #       -DGDK_MULTIHEAD_SAFE \
285 #       -DGTK_MULTIHEAD_SAFE
286 endif
287
288 if !ENABLE_DATABASE
289 global_cppflags += -DENABLE_DATABASE=0
290 endif
291
292 if !ENABLE_ICONDATABASE
293 global_cppflags += -DENABLE_ICONDATABASE=0
294 endif
295
296 if ENABLE_COVERAGE
297 global_cppflags += \
298         -DGCC_GENERATE_TEST_COVERAGE_FILES \
299         -DGCC_INSTRUMENT_PROGRAM_FLOW_ARCS
300 endif
301
302 if ENABLE_VIDEO
303 webcore_libadd += -lgstinterfaces-0.10 -lgstvideo-0.10
304 endif
305
306 webkitgtk_h_api += \
307         WebKit/gtk/webkit/webkit.h \
308         WebKit/gtk/webkit/webkitdefines.h \
309         WebKit/gtk/webkit/webkitdownload.h \
310         WebKit/gtk/webkit/webkitnetworkrequest.h \
311         WebKit/gtk/webkit/webkitsoupauthdialog.h \
312         WebKit/gtk/webkit/webkitversion.h \
313         WebKit/gtk/webkit/webkitwebbackforwardlist.h \
314         WebKit/gtk/webkit/webkitwebframe.h \
315         WebKit/gtk/webkit/webkitwebhistoryitem.h \
316         WebKit/gtk/webkit/webkitwebinspector.h \
317         WebKit/gtk/webkit/webkitwebnavigationaction.h \
318         WebKit/gtk/webkit/webkitwebpolicydecision.h \
319         WebKit/gtk/webkit/webkitwebsettings.h \
320         WebKit/gtk/webkit/webkitwebwindowfeatures.h \
321         WebKit/gtk/webkit/webkitwebview.h
322
323 webkitgtk_built_sources += \
324         DerivedSources/webkitenumtypes.cpp \
325         DerivedSources/webkitmarshal.cpp \
326         DerivedSources/webkitmarshal.h \
327         WebKit/gtk/webkit/webkitenumtypes.h
328
329 webkitgtk_sources += \
330         WebKit/gtk/WebCoreSupport/ChromeClientGtk.cpp \
331         WebKit/gtk/WebCoreSupport/ChromeClientGtk.h \
332         WebKit/gtk/WebCoreSupport/ContextMenuClientGtk.cpp \
333         WebKit/gtk/WebCoreSupport/ContextMenuClientGtk.h \
334         WebKit/gtk/WebCoreSupport/DragClientGtk.cpp \
335         WebKit/gtk/WebCoreSupport/DragClientGtk.h \
336         WebKit/gtk/WebCoreSupport/EditorClientGtk.cpp \
337         WebKit/gtk/WebCoreSupport/EditorClientGtk.h \
338         WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.cpp \
339         WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.h \
340         WebKit/gtk/WebCoreSupport/InspectorClientGtk.cpp \
341         WebKit/gtk/WebCoreSupport/InspectorClientGtk.h \
342         WebKit/gtk/WebCoreSupport/PasteboardHelperGtk.cpp \
343         WebKit/gtk/WebCoreSupport/PasteboardHelperGtk.h \
344         WebKit/gtk/webkit/webkitnetworkrequest.cpp \
345         WebKit/gtk/webkit/webkitprivate.cpp \
346         WebKit/gtk/webkit/webkitprivate.h \
347         WebKit/gtk/webkit/webkitsoupauthdialog.c \
348         WebKit/gtk/webkit/webkitversion.cpp \
349         WebKit/gtk/webkit/webkitwebbackforwardlist.cpp \
350         WebKit/gtk/webkit/webkitwebframe.cpp \
351         WebKit/gtk/webkit/webkitwebhistoryitem.cpp \
352         WebKit/gtk/webkit/webkitwebinspector.cpp \
353         WebKit/gtk/webkit/webkitwebnavigationaction.cpp \
354         WebKit/gtk/webkit/webkitwebpolicydecision.cpp \
355         WebKit/gtk/webkit/webkitwebsettings.cpp \
356         WebKit/gtk/webkit/webkitdownload.cpp \
357         WebKit/gtk/webkit/webkitwebview.cpp \
358         WebKit/gtk/webkit/webkitwebwindowfeatures.cpp
359
360 webkitgtk_cppflags += \
361         -DBUILDING_WEBKIT \
362         -I$(srcdir)/WebKit/gtk \
363         -I$(srcdir)/WebKit/gtk/WebCoreSupport \
364         -I$(srcdir)/WebKit/gtk/webkit \
365         -I$(top_builddir)/WebKit/gtk/webkit
366
367 webkitgtk_cleanfiles += \
368         $(top_builddir)/Programs/GtkLauncher \
369         $(top_builddir)/WebKit/gtk/webkit-1.0.pc \
370         $(top_builddir)/WebKit/gtk/webkit/webkitenumtypes.h
371
372 pkgconfigdir = $(libdir)/pkgconfig
373 pkgconfig_DATA = WebKit/gtk/webkit-1.0.pc
374
375 stamp_files := \
376         stamp-webkitmarshal.cpp \
377         stamp-webkitmarshal.h \
378         stamp-webkitenumtypes.cpp \
379         stamp-webkitenumtypes.h
380
381 WEBKIT_MARSHAL = $(GENSOURCES)/webkitmarshal
382 WEBKIT_MARSHAL_LIST = $(top_srcdir)/WebKit/gtk/webkitmarshal.list
383
384 $(WEBKIT_MARSHAL).cpp: stamp-webkitmarshal.cpp
385         @true
386
387 $(WEBKIT_MARSHAL).h: stamp-webkitmarshal.h
388         @true
389
390 stamp-webkitmarshal.cpp: $(WEBKIT_MARSHAL_LIST)
391         echo "extern \"C\" {" > $(WEBKIT_MARSHAL).cpp && \
392         $(GLIB_GENMARSHAL) --prefix=webkit_marshal $(WEBKIT_MARSHAL_LIST) --body >> $(WEBKIT_MARSHAL).cpp && echo '}' >> $(WEBKIT_MARSHAL).cpp && \
393         echo timestamp > $(@F)
394
395 stamp-webkitmarshal.h: $(WEBKIT_MARSHAL_LIST)
396         $(GLIB_GENMARSHAL) --prefix=webkit_marshal $(WEBKIT_MARSHAL_LIST) --header > $(WEBKIT_MARSHAL).h && \
397         echo timestamp > $(@F)
398
399 WebKit/gtk/webkit/webkitenumtypes.h: stamp-webkitenumtypes.h
400         @true
401 stamp-webkitenumtypes.h: $(webkitgtk_h_api) GNUmakefile
402         (cd $(srcdir) \
403         && glib-mkenums \
404                         --fhead "#ifndef WEBKIT_ENUM_TYPES_H\n" \
405                         --fhead "#define WEBKIT_ENUM_TYPES_H\n\n" \
406                         --fhead "#include <glib-object.h>\n\n" \
407                         --fhead "#include <webkit/webkitdefines.h>\n\n" \
408                         --fhead "G_BEGIN_DECLS\n\n" \
409                         --ftail "G_END_DECLS\n\n" \
410                         --ftail "#endif\n" \
411                         --fprod "#include <@filename@>\n\n" \
412                         --eprod "#define WEBKIT_TYPE_@ENUMSHORT@ @enum_name@_get_type()\n\n" \
413                         --eprod "WEBKIT_API GType\n@enum_name@_get_type(void);\n\n" \
414                 $(webkitgtk_h_api) | \
415                 sed 's,WebKit/gtk/,,' | \
416                 sed 's,web_kit,webkit,' | \
417                 sed 's,WEBKIT_TYPE_KIT,WEBKIT_TYPE,' \
418                 ) > xgen-gth \
419         && (cmp -s xgen-gth WebKit/gtk/webkit/webkitenumtypes.h || cp xgen-gth WebKit/gtk/webkit/webkitenumtypes.h) \
420         && rm -f xgen-gth \
421         && echo timestamp > $(@F)
422
423 DerivedSources/webkitenumtypes.cpp: $(webkitgtk_h_api) GNUmakefile
424         (cd $(srcdir) \
425         && glib-mkenums \
426                         --fhead "#include <config.h>\n" \
427                         --fhead "#include <glib-object.h>\n" \
428                         --fhead "#include \"$(top_builddir)/WebKit/gtk/webkit/webkitenumtypes.h\"\n\n" \
429                         --fhead "extern \"C\" {\n\n" \
430                         --fprod "\n/* enumerations from \"@filename@\" */" \
431                         --vhead "static const G@Type@Value _@enum_name@_values[] = {" \
432                         --vprod "    { @VALUENAME@, \"@VALUENAME@\", \"@valuenick@\" }," \
433                         --vtail "    { 0, NULL, NULL }\n};\n\n" \
434                         --vtail "GType @enum_name@_get_type(void)\n{\n" \
435                         --vtail "    static GType type = 0;\n\n" \
436                         --vtail "    if (!type)\n" \
437                         --vtail "        type = g_@type@_register_static(\"@EnumName@\", _@enum_name@_values);\n\n" \
438                         --vtail "    return type;\n}\n\n" \
439                         --ftail "}\n" \
440                 $(webkitgtk_h_api) | \
441                 sed 's,web_kit,webkit,' \
442                 ) > xgen-gtc \
443         && cp xgen-gtc $@ \
444         && rm -f xgen-gtc
445
446 # END WEBKIT GTK+
447 #
448 # Files that will be distributed
449 EXTRA_DIST = \
450         WebKit/LICENSE \
451         $(javascriptcore_dist) \
452         $(webcore_dist) \
453         $(srcdir)/autotools/symbols.filter \
454         $(srcdir)/WebKit/gtk/ChangeLog \
455         $(srcdir)/WebKit/gtk/NEWS \
456         $(srcdir)/WebKit/gtk/webkitmarshal.list
457
458 # Files that will be cleaned
459 MAINTAINERCLEANFILES := $(stamp_files) $(BUILT_SOURCES) doltcompile doltlibtool
460 DISTCLEANFILES := $(stamp_files) $(BUILT_SOURCES) doltcompile doltlibtool
461 CLEANFILES := $(stamp_files) $(BUILT_SOURCES)
462
463 # Include module makefiles
464 include JavaScriptCore/GNUmakefile.am
465 include WebCore/GNUmakefile.am
466 include WebKitTools/GNUmakefile.am
467
468 # Build unit tests
469 noinst_PROGRAMS += $(TEST_PROGS)
470
471 webkit_tests_cflags = \
472         -fno-strict-aliasing \
473         -O2 \
474         -I$(srcdir)/JavaScriptCore/ForwardingHeaders \
475         -I$(srcdir)/WebKit/gtk \
476         -I$(top_builddir)/WebKit/gtk \
477         $(global_cflags) \
478         $(GLIB_CFLAGS) \
479         $(GTK_CFLAGS) \
480         $(LIBSOUP_CFLAGS)
481
482 webkit_tests_ldadd = \
483         libwebkit-1.0.la \
484         $(GTK_LIBS)     \
485         $(GLIB_LIBS) \
486         $(LIBSOUP_LIBS)
487
488 TEST_PROGS += Programs/unittests/testwebframe \
489         Programs/unittests/testwebbackforwardlist \
490         Programs/unittests/testwebhistoryitem
491
492 # Add additional tests here
493 Programs_unittests_testwebframe_SOURCES = WebKit/gtk/tests/testwebframe.c
494 Programs_unittests_testwebframe_CFLAGS = $(webkit_tests_cflags)
495 Programs_unittests_testwebframe_LDADD = $(webkit_tests_ldadd)
496
497 Programs_unittests_testwebbackforwardlist_SOURCES = WebKit/gtk/tests/testwebbackforwardlist.c
498 Programs_unittests_testwebbackforwardlist_CFLAGS = $(webkit_tests_cflags)
499 Programs_unittests_testwebbackforwardlist_LDADD = $(webkit_tests_ldadd)
500
501 Programs_unittests_testwebhistoryitem_SOURCES = WebKit/gtk/tests/testwebhistoryitem.c
502 Programs_unittests_testwebhistoryitem_CFLAGS = $(webkit_tests_cflags)
503 Programs_unittests_testwebhistoryitem_LDADD = $(webkit_tests_ldadd)
504
505
506 # Autogenerated sources
507 BUILT_SOURCES := \
508         $(javascriptcore_built_sources) \
509         $(javascriptcore_built_nosources) \
510         $(webcore_built_sources) \
511         $(webcore_built_nosources) \
512         $(webkitgtk_built_sources) \
513         $(webkitgtk_built_nosources)
514
515 # Project-wide clean rules
516 CLEANFILES += \
517         $(webkitgtk_cleanfiles)
518
519 MAINTAINERCLEANFILES += \
520         $(srcdir)/aconfig.h.in \
521         $(srcdir)/autotools/config.* \
522         $(srcdir)/autotools/compile \
523         $(srcdir)/autotools/depcomp \
524         $(srcdir)/autotools/install-sh \
525         $(srcdir)/autotools/missing \
526         $(srcdir)/configure \
527         $(srcdir)/GNUmakefile.in \
528         $(srcdir)/INSTALL \
529         $(srcdir)/README \
530         $(top_builddir)/config.*
531
532 # Older automake versions (1.7) place Plo files in a different place so we need
533 # to create the output directory manually.
534 all-local:
535         mkdir -p $(top_builddir)/$(DEPDIR)/DerivedSources
536
537 # remove built sources and program directories
538 clean-local:
539         -rm -rf $(GENPROGRAMS)
540
541 maintainer-clean-local: distclean-local
542
543 distclean-local:
544         -rm -rf $(GENSOURCES) $(GENPROGRAMS)