2008-08-05 Marco Barisione <marco.barisione@collabora.co.uk>
[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 # _headers          = header files that will be part of the distribution
9 # _built_sources    = files that will be autogenerated by the build system and
10 #                     will be part of the _SOURCES primary
11 # _built_nosources  = files that are autogenerated but are not part of the
12 #                     _SOURCES primary
13 # _cleanfiles       = files that will be removed by the clean target
14 #
15 # Sources, headers, flags, etc... should be added to the respective variables
16 # with the above suffix, e.g, webcore-specific sources should go to
17 # webcore_sources, gtk port API and WebCoreSupport parts to webkitgtk_sources,
18 # etc... The only exceptions are the global variables. See Global Variables
19 # below.
20 #
21 # Global Variables
22 #
23 # global_cppflags   = CPPFLAGS that apply to JSC, WebCore, and to any
24 #                     specific port
25 # global_cflags     = CFLAGS that apply to JSC, WebCore, and to
26 #                     any specific port
27 # global_cxxflags   = CXXFLAGS that apply to JSC, WebCore, and to any
28 #                     specific port
29
30 srcdir = @srcdir@
31 VPATH = @srcdir@
32
33 # Directory for autogenerated sources
34 GENSOURCES := $(top_builddir)/DerivedSources
35 GENPROGRAMS := $(top_builddir)/Programs
36
37 # Script for creating hash tables
38 CREATE_HASH_TABLE = $(srcdir)/JavaScriptCore/kjs/create_hash_table
39
40 # Libraries and support components
41 bin_PROGRAMS :=
42
43 noinst_PROGRAMS :=
44
45 lib_LIBRARIES :=
46
47 IDL_BINDINGS :=
48
49 # Files that will be distributed
50 EXTRA_DIST :=
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
65 global_cxxflags := \
66         $(SYMBOL_VISIBILITY_INLINES)
67
68 if !ENABLE_DEBUG
69 global_cflags += \
70         -fno-exceptions \
71         $(SYMBOL_VISIBILITY)
72
73 global_cxxflags += \
74         -fno-rtti
75 endif
76
77 # -no-undefined required for building DLLs on Windows
78 # It breaks the build on other platforms, so we use it conditionally
79 if OS_WIN32
80 no_undefined = -no-undefined
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
100 javascriptcore_cppflags += \
101         -I$(srcdir)/JavaScriptCore \
102         -I$(srcdir)/JavaScriptCore/ForwardingHeaders \
103         -I$(srcdir)/JavaScriptCore/wtf \
104         -I$(srcdir)/JavaScriptCore/kjs \
105         -I$(top_builddir)/DerivedSources
106
107 # The variables above are already included below so no need to touch
108 # these variables unless you really have to
109 nodist_EXTRA_libJavaScriptCore_la_SOURCES = \
110         $(javascriptcore_built_nosources)
111
112 nodist_libJavaScriptCore_la_SOURCES = \
113         $(javascriptcore_built_sources)
114
115 libJavaScriptCore_ladir = $(prefix)/include/webkit-1.0/JavaScriptCore
116 libJavaScriptCore_la_HEADERS = $(javascriptcore_h_api)
117
118 libJavaScriptCore_la_SOURCES = \
119         $(javascriptcore_sources)
120
121 libJavaScriptCore_la_LIBADD = \
122         $(UNICODE_LIBS) \
123         $(GLOBALDEPS_LIBS) \
124         -lpthread
125
126 libJavaScriptCore_la_CXXFLAGS = \
127         -fstrict-aliasing \
128         -O3 \
129         $(global_cxxflags) \
130         $(global_cflags) \
131         $(GLOBALDEPS_CFLAGS) \
132         $(UNICODE_CFLAGS)
133
134 libJavaScriptCore_la_CFLAGS = \
135         -fstrict-aliasing \
136         -O3 \
137         $(global_cflags) \
138         $(GLOBALDEPS_CFLAGS) \
139         $(UNICODE_CFLAGS)
140
141 libJavaScriptCore_la_CPPFLAGS = \
142         $(global_cppflags) \
143         $(javascriptcore_cppflags)
144
145 #
146 # WebCore
147 webcore_cppflags :=
148 webcore_sources :=
149 webcore_headers :=
150 webcore_libadd :=
151 webcore_built_sources :=
152 webcore_built_nosources :=
153 webcoregtk_cppflags :=
154 webcoregtk_sources :=
155 webcoregtk_headers :=
156
157 nodist_libWebCore_la_SOURCES = \
158         $(webcore_built_sources)
159
160 libWebCore_la_SOURCES = \
161         $(webcore_headers) \
162         $(webcore_sources) \
163         $(webcoregtk_headers) \
164         $(webcoregtk_sources)
165
166 libWebCore_la_CXXFLAGS = \
167         -fno-strict-aliasing \
168         -O2 \
169         $(global_cxxflags) \
170         $(global_cflags) \
171         $(GLOBALDEPS_CFLAGS) \
172         $(UNICODE_CFLAGS) \
173         $(WEBKITDEPS_CFLAGS) \
174         $(XT_CFLAGS) \
175         $(LIBCURL_CFLAGS) \
176         $(LIBSOUP_CFLAGS) \
177         $(FREETYPE_CFLAGS) \
178         $(SQLITE3_CFLAGS) \
179         $(GSTREAMER_CFLAGS) \
180         $(LIBXSLT_CFLAGS) \
181         $(COVERAGE_CFLAGS) \
182         $(HILDON_CFLAGS)
183
184 libWebCore_la_CFLAGS = \
185         -fno-strict-aliasing \
186         -O2 \
187         $(global_cflags) \
188         $(GLOBALDEPS_CFLAGS) \
189         $(UNICODE_CFLAGS) \
190         $(WEBKITDEPS_CFLAGS) \
191         $(XT_CFLAGS) \
192         $(LIBCURL_CFLAGS) \
193         $(LIBSOUP_CFLAGS) \
194         $(FREETYPE_CFLAGS) \
195         $(SQLITE3_CFLAGS) \
196         $(GSTREAMER_CFLAGS) \
197         $(LIBXSLT_CFLAGS) \
198         $(COVERAGE_CFLAGS) \
199         $(HILDON_CFLAGS)
200
201 libWebCore_la_CPPFLAGS = \
202         $(global_cppflags) \
203         $(webcore_cppflags) \
204         $(javascriptcore_cppflags) \
205         $(webcoregtk_cppflags) \
206         $(HILDON_CPPFLAGS)
207
208 libWebCore_la_LIBADD = \
209         libJavaScriptCore.la \
210         $(webcore_libadd) \
211         $(GLOBALDEPS_LIBS) \
212         $(WEBKITDEPS_LIBS) \
213         $(XT_LIBS) \
214         $(LIBCURL_LIBS) \
215         $(LIBSOUP_LIBS) \
216         $(FREETYPE_LIBS) \
217         $(UNICODE_LIBS) \
218         $(SQLITE3_LIBS) \
219         $(GSTREAMER_LIBS) \
220         $(LIBXSLT_LIBS) \
221         $(HILDON_LIBS) \
222         $(JPEG_LIBS) \
223         -lpthread
224
225 # WebKit
226 webkitgtk_h_api :=
227 webkitgtk_headers :=
228 webkitgtk_sources :=
229 webkitgtk_cppflags :=
230 webkitgtk_built_sources :=
231 webkitgtk_built_nosources :=
232 webkitgtk_cleanfiles :=
233
234 nodist_libwebkit_1_0_la_SOURCES = \
235         $(webkitgtk_built_sources)
236
237 libwebkit_1_0_ladir = $(prefix)/include/webkit-1.0/webkit
238 libwebkit_1_0_la_HEADERS = \
239         $(webkitgtk_h_api) \
240         WebKit/gtk/webkit/webkitenumtypes.h
241
242 libwebkit_1_0_la_SOURCES = \
243         $(webkitgtk_headers) \
244         $(webkitgtk_sources)
245
246 libwebkit_1_0_la_CXXFLAGS = \
247         $(libWebCore_la_CXXFLAGS)
248
249 libwebkit_1_0_la_CFLAGS = \
250         $(libWebCore_la_CFLAGS)
251
252 libwebkit_1_0_la_CPPFLAGS = \
253         $(libWebCore_la_CPPFLAGS) \
254         $(webkitgtk_cppflags)
255
256 libwebkit_1_0_la_LDFLAGS = \
257         $(COVERAGE_LDFLAGS) \
258         -version-info @LIBWEBKITGTK_VERSION@ \
259         $(no_undefined)
260
261 libwebkit_1_0_la_LIBADD = \
262         libWebCore.la
263
264 #
265 # Extra checks and flags
266 global_cppflags += \
267         -DBUILDING_CAIRO__=1 \
268         -DBUILDING_GTK__=1 \
269         -DWTF_CHANGES
270
271 if !ENABLE_FAST_MALLOC
272 global_cppflags += \
273         -DUSE_SYSTEM_MALLOC
274 endif
275
276 if TARGET_X11
277 global_cppflags += -DXP_UNIX
278 endif
279
280 if !ENABLE_DEBUG
281 global_cppflags += -DNDEBUG
282 else
283 webcoregtk_cppflags += \
284         -DG_DISABLE_DEPRECATED \
285         -DGDK_PIXBUF_DISABLE_DEPRECATED \
286         -DGDK_DISABLE_DEPRECATED \
287         -DGTK_DISABLE_DEPRECATED \
288         -DPANGO_DISABLE_DEPRECATED
289
290 # Might be useful in the future
291 #       -DGDK_MULTIHEAD_SAFE \
292 #       -DGTK_MULTIHEAD_SAFE
293 endif
294
295 if !ENABLE_DATABASE
296 global_cppflags += -DENABLE_DATABASE=0
297 endif
298
299 if !ENABLE_ICONDATABASE
300 global_cppflags += -DENABLE_ICONDATABASE=0
301 endif
302
303 if ENABLE_COVERAGE
304 global_cppflags += \
305         -DGCC_GENERATE_TEST_COVERAGE_FILES \
306         -DGCC_INSTRUMENT_PROGRAM_FLOW_ARCS
307 endif
308
309 if ENABLE_VIDEO
310 webcore_libadd += -lgstinterfaces-0.10 -lgstvideo-0.10
311 endif
312
313 webkitgtk_h_api += \
314         WebKit/gtk/webkit/webkit.h \
315         WebKit/gtk/webkit/webkitdefines.h \
316         WebKit/gtk/webkit/webkitnetworkrequest.h \
317         WebKit/gtk/webkit/webkitversion.h \
318         WebKit/gtk/webkit/webkitwebbackforwardlist.h \
319         WebKit/gtk/webkit/webkitwebframe.h \
320         WebKit/gtk/webkit/webkitwebhistoryitem.h \
321         WebKit/gtk/webkit/webkitwebsettings.h \
322         WebKit/gtk/webkit/webkitwebview.h
323
324 webkitgtk_built_sources += \
325         DerivedSources/webkitmarshal.h \
326         DerivedSources/webkitmarshal.cpp \
327         DerivedSources/webkitenumtypes.cpp \
328         WebKit/gtk/webkit/webkitenumtypes.h
329
330 webkitgtk_headers += \
331         WebKit/gtk/webkit/webkitprivate.h \
332         WebKit/gtk/WebCoreSupport/ChromeClientGtk.h \
333         WebKit/gtk/WebCoreSupport/ContextMenuClientGtk.h \
334         WebKit/gtk/WebCoreSupport/DragClientGtk.h \
335         WebKit/gtk/WebCoreSupport/EditorClientGtk.h \
336         WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.h \
337         WebKit/gtk/WebCoreSupport/InspectorClientGtk.h \
338         WebKit/gtk/WebCoreSupport/PasteboardHelperGtk.h
339
340 webkitgtk_sources += \
341         WebKit/gtk/webkit/webkitnetworkrequest.cpp \
342         WebKit/gtk/webkit/webkitprivate.cpp \
343         WebKit/gtk/webkit/webkitversion.cpp \
344         WebKit/gtk/webkit/webkitwebbackforwardlist.cpp \
345         WebKit/gtk/webkit/webkitwebframe.cpp \
346         WebKit/gtk/webkit/webkitwebhistoryitem.cpp \
347         WebKit/gtk/webkit/webkitwebsettings.cpp \
348         WebKit/gtk/webkit/webkitwebview.cpp \
349         WebKit/gtk/WebCoreSupport/ChromeClientGtk.cpp \
350         WebKit/gtk/WebCoreSupport/ContextMenuClientGtk.cpp \
351         WebKit/gtk/WebCoreSupport/DragClientGtk.cpp \
352         WebKit/gtk/WebCoreSupport/EditorClientGtk.cpp \
353         WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.cpp \
354         WebKit/gtk/WebCoreSupport/InspectorClientGtk.cpp \
355         WebKit/gtk/WebCoreSupport/PasteboardHelperGtk.cpp
356
357 webkitgtk_cppflags += \
358         -DBUILDING_WEBKIT \
359         -I$(srcdir)/WebKit/gtk \
360         -I$(srcdir)/WebKit/gtk/WebCoreSupport \
361         -I$(srcdir)/WebKit/gtk/webkit \
362         -I$(top_builddir)/WebKit/gtk/webkit
363
364 webkitgtk_cleanfiles += \
365         $(top_builddir)/Programs/GtkLauncher \
366         $(top_builddir)/WebKit/gtk/webkit-1.0.pc
367
368 pkgconfigdir = $(libdir)/pkgconfig
369 pkgconfig_DATA = WebKit/gtk/webkit-1.0.pc
370
371 stamp_files := \
372         stamp-webkitmarshal.cpp \
373         stamp-webkitmarshal.h \
374         stamp-webkitenumtypes.cpp \
375         stamp-webkitenumtypes.h
376
377 WEBKIT_MARSHAL = $(GENSOURCES)/webkitmarshal
378 WEBKIT_MARSHAL_LIST = $(WEBKIT_MARSHAL).list
379
380 $(WEBKIT_MARSHAL_LIST): $(webkitgtk_sources) GNUmakefile.am
381         ( cd $(top_srcdir) && \
382         sed -n -e 's/.*webkit_marshal_\([[:upper:][:digit:]]*__[[:upper:][:digit:]_]*\).*/\1/p' \
383         $(webkitgtk_sources) ) \
384         | sed -e 's/__/:/' -e 'y/_/,/' | sort -u > $@.tmp
385         if cmp -s $@.tmp $@; then \
386                 rm $@.tmp; \
387         else \
388                 mv $@.tmp $@; \
389         fi
390
391 $(WEBKIT_MARSHAL).cpp: stamp-webkitmarshal.cpp
392         @true
393
394 $(WEBKIT_MARSHAL).h: stamp-webkitmarshal.h
395         @true
396
397 stamp-webkitmarshal.cpp: $(WEBKIT_MARSHAL_LIST)
398         echo "extern \"C\" {" > $(WEBKIT_MARSHAL).cpp && \
399         $(GLIB_GENMARSHAL) --prefix=webkit_marshal $(WEBKIT_MARSHAL_LIST) --body >> $(WEBKIT_MARSHAL).cpp && echo '}' >> $(WEBKIT_MARSHAL).cpp && \
400         echo timestamp > $(@F)
401
402 stamp-webkitmarshal.h: $(WEBKIT_MARSHAL_LIST)
403         $(GLIB_GENMARSHAL) --prefix=webkit_marshal $(WEBKIT_MARSHAL_LIST) --header > $(WEBKIT_MARSHAL).h && \
404         echo timestamp > $(@F)
405
406 WebKit/gtk/webkit/webkitenumtypes.h: stamp-webkitenumtypes.h
407         @true
408 stamp-webkitenumtypes.h: $(webkitgtk_h_api) Makefile
409         (cd $(srcdir) \
410         && glib-mkenums \
411                         --fhead "#ifndef WEBKIT_ENUM_TYPES_H\n" \
412                         --fhead "#define WEBKIT_ENUM_TYPES_H\n\n" \
413                         --fhead "#include <glib-object.h>\n\n" \
414                         --fhead "#include <webkit/webkitdefines.h>\n\n" \
415                         --fhead "G_BEGIN_DECLS\n\n" \
416                         --ftail "G_END_DECLS\n\n" \
417                         --ftail "#endif\n" \
418                         --fprod "#include <@filename@>\n\n" \
419                         --eprod "#define WEBKIT_TYPE_@ENUMSHORT@ @enum_name@_get_type()\n\n" \
420                         --eprod "WEBKIT_API GType\n@enum_name@_get_type(void);\n\n" \
421                 $(webkitgtk_h_api) | \
422                 sed 's,WebKit/gtk/,,' | \
423                 sed 's,web_kit,webkit,' | \
424                 sed 's,WEBKIT_TYPE_KIT,WEBKIT_TYPE,' \
425                 ) > xgen-gth \
426         && (cmp -s xgen-gth WebKit/gtk/webkit/webkitenumtypes.h || cp xgen-gth WebKit/gtk/webkit/webkitenumtypes.h) \
427         && rm -f xgen-gth \
428         && echo timestamp > $(@F)
429
430 DerivedSources/webkitenumtypes.cpp: $(webkitgtk_h_api) Makefile
431         (cd $(srcdir) \
432         && glib-mkenums \
433                         --fhead "#include <config.h>\n" \
434                         --fhead "#include <glib-object.h>\n" \
435                         --fhead "#include \"$(top_builddir)/WebKit/gtk/webkit/webkitenumtypes.h\"\n\n" \
436                         --fhead "extern \"C\" {\n\n" \
437                         --fprod "\n/* enumerations from \"@filename@\" */" \
438                         --vhead "static const G@Type@Value _@enum_name@_values[] = {" \
439                         --vprod "    { @VALUENAME@, \"@VALUENAME@\", \"@valuenick@\" }," \
440                         --vtail "    { 0, NULL, NULL }\n};\n\n" \
441                         --vtail "GType @enum_name@_get_type(void)\n{\n" \
442                         --vtail "    static GType type = 0;\n\n" \
443                         --vtail "    if (!type)\n" \
444                         --vtail "        type = g_@type@_register_static(\"@EnumName@\", _@enum_name@_values);\n\n" \
445                         --vtail "    return type;\n}\n\n" \
446                         --ftail "}\n" \
447                 $(webkitgtk_h_api) | \
448                 sed 's,web_kit,webkit,' \
449                 ) > xgen-gtc \
450         && cp xgen-gtc $@ \
451         && rm -f xgen-gtc
452
453 # END WEBKIT GTK+
454
455 # Files that will be cleaned
456 MAINTAINERCLEANFILES := $(stamp_files) $(BUILT_SOURCES)
457 DISTCLEANFILES := $(stamp_files) $(BUILT_SOURCES)
458 CLEANFILES := $(stamp_files) $(BUILT_SOURCES)
459
460 # Include module makefiles
461 include JavaScriptCore/GNUmakefile.am
462 include WebCore/GNUmakefile.am
463 include WebKitTools/GNUmakefile.am
464
465 # Autogenerated sources
466 BUILT_SOURCES = \
467         $(javascriptcore_built_sources) \
468         $(javascriptcore_built_nosources) \
469         $(webcore_built_sources) \
470         $(webcore_built_nosources) \
471         $(webkitgtk_built_sources) \
472         $(webkitgtk_built_nosources)
473
474 # Project-wide clean rules
475 CLEANFILES += \
476         $(webkitgtk_cleanfiles)
477
478 MAINTAINERCLEANFILES += \
479         $(srcdir)/aconfig.h.in \
480         configure \
481         config.* \
482         GNUmakefile.in \
483         INSTALL \
484         README
485
486 # remove built sources and program directories
487 clean-local:
488         -rm -rf $(GENSOURCES) $(GENPROGRAMS)