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