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