2008-07-25 Jan Michael Alonzo <jmalonzo@webkit.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 # _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         $(LIBCURL_CFLAGS) \
175         $(LIBSOUP_CFLAGS) \
176         $(FREETYPE_CFLAGS) \
177         $(SQLITE3_CFLAGS) \
178         $(GSTREAMER_CFLAGS) \
179         $(LIBXSLT_CFLAGS) \
180         $(COVERAGE_CFLAGS) \
181         $(HILDON_CFLAGS)
182
183 libWebCore_la_CFLAGS = \
184         -fno-strict-aliasing \
185         -O2 \
186         $(global_cflags) \
187         $(GLOBALDEPS_CFLAGS) \
188         $(UNICODE_CFLAGS) \
189         $(WEBKITDEPS_CFLAGS) \
190         $(LIBCURL_CFLAGS) \
191         $(LIBSOUP_CFLAGS) \
192         $(FREETYPE_CFLAGS) \
193         $(SQLITE3_CFLAGS) \
194         $(GSTREAMER_CFLAGS) \
195         $(LIBXSLT_CFLAGS) \
196         $(COVERAGE_CFLAGS) \
197         $(HILDON_CFLAGS)
198
199 libWebCore_la_CPPFLAGS = \
200         $(global_cppflags) \
201         $(webcore_cppflags) \
202         $(javascriptcore_cppflags) \
203         $(webcoregtk_cppflags) \
204         $(HILDON_CPPFLAGS)
205
206 libWebCore_la_LIBADD = \
207         libJavaScriptCore.la \
208         $(webcore_libadd) \
209         $(GLOBALDEPS_LIBS) \
210         $(WEBKITDEPS_LIBS) \
211         $(LIBCURL_LIBS) \
212         $(LIBSOUP_LIBS) \
213         $(FREETYPE_LIBS) \
214         $(UNICODE_LIBS) \
215         $(SQLITE3_LIBS) \
216         $(GSTREAMER_LIBS) \
217         $(LIBXSLT_LIBS) \
218         $(HILDON_LIBS) \
219         $(JPEG_LIBS) \
220         -lpthread
221
222 # WebKit
223 webkitgtk_h_api :=
224 webkitgtk_headers :=
225 webkitgtk_sources :=
226 webkitgtk_cppflags :=
227 webkitgtk_built_sources :=
228 webkitgtk_built_nosources :=
229 webkitgtk_cleanfiles :=
230
231 nodist_libwebkit_1_0_la_SOURCES = \
232         $(webkitgtk_built_sources)
233
234 libwebkit_1_0_ladir = $(prefix)/include/webkit-1.0/webkit
235 libwebkit_1_0_la_HEADERS = \
236         $(webkitgtk_h_api) \
237         WebKit/gtk/webkit/webkitenumtypes.h
238
239 libwebkit_1_0_la_SOURCES = \
240         $(webkitgtk_headers) \
241         $(webkitgtk_sources)
242
243 libwebkit_1_0_la_CXXFLAGS = \
244         $(libWebCore_la_CXXFLAGS)
245
246 libwebkit_1_0_la_CFLAGS = \
247         $(libWebCore_la_CFLAGS)
248
249 libwebkit_1_0_la_CPPFLAGS = \
250         $(libWebCore_la_CPPFLAGS) \
251         $(webkitgtk_cppflags)
252
253 libwebkit_1_0_la_LDFLAGS = \
254         $(COVERAGE_LDFLAGS) \
255         -version-info @LIBWEBKITGTK_VERSION@ \
256         $(no_undefined)
257
258 libwebkit_1_0_la_LIBADD = \
259         libWebCore.la
260
261 #
262 # Extra checks and flags
263 global_cppflags += \
264         -DBUILDING_CAIRO__=1 \
265         -DBUILDING_GTK__=1 \
266         -DWTF_CHANGES
267
268 if !ENABLE_FAST_MALLOC
269 global_cppflags += \
270         -DUSE_SYSTEM_MALLOC
271 endif
272
273 if TARGET_X11
274 global_cppflags += -DXP_UNIX
275 webcore_libadd += -lXt
276 endif
277
278 if !ENABLE_DEBUG
279 global_cppflags += -DNDEBUG
280 else
281 webcoregtk_cppflags += \
282         -DG_DISABLE_DEPRECATED \
283         -DGDK_PIXBUF_DISABLE_DEPRECATED \
284         -DGDK_DISABLE_DEPRECATED \
285         -DGTK_DISABLE_DEPRECATED \
286         -DPANGO_DISABLE_DEPRECATED
287
288 # Might be useful in the future
289 #       -DGDK_MULTIHEAD_SAFE \
290 #       -DGTK_MULTIHEAD_SAFE
291 endif
292
293 if !ENABLE_DATABASE
294 global_cppflags += -DENABLE_DATABASE=0
295 endif
296
297 if !ENABLE_ICONDATABASE
298 global_cppflags += -DENABLE_ICONDATABASE=0
299 endif
300
301 if ENABLE_COVERAGE
302 global_cppflags += \
303         -DGCC_GENERATE_TEST_COVERAGE_FILES \
304         -DGCC_INSTRUMENT_PROGRAM_FLOW_ARCS
305 endif
306
307 if ENABLE_VIDEO
308 webcore_libadd += -lgstinterfaces-0.10 -lgstvideo-0.10
309 endif
310
311 webkitgtk_h_api += \
312         WebKit/gtk/webkit/webkit.h \
313         WebKit/gtk/webkit/webkitdefines.h \
314         WebKit/gtk/webkit/webkitnetworkrequest.h \
315         WebKit/gtk/webkit/webkitversion.h \
316         WebKit/gtk/webkit/webkitwebbackforwardlist.h \
317         WebKit/gtk/webkit/webkitwebframe.h \
318         WebKit/gtk/webkit/webkitwebhistoryitem.h \
319         WebKit/gtk/webkit/webkitwebsettings.h \
320         WebKit/gtk/webkit/webkitwebview.h
321
322 webkitgtk_built_sources += \
323         DerivedSources/webkit-marshal.h \
324         DerivedSources/webkit-marshal.cpp \
325         DerivedSources/webkitenumtypes.cpp \
326         WebKit/gtk/webkit/webkitenumtypes.h
327
328 webkitgtk_headers += \
329         WebKit/gtk/webkit/webkitprivate.h \
330         WebKit/gtk/WebCoreSupport/ChromeClientGtk.h \
331         WebKit/gtk/WebCoreSupport/ContextMenuClientGtk.h \
332         WebKit/gtk/WebCoreSupport/DragClientGtk.h \
333         WebKit/gtk/WebCoreSupport/EditorClientGtk.h \
334         WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.h \
335         WebKit/gtk/WebCoreSupport/InspectorClientGtk.h \
336         WebKit/gtk/WebCoreSupport/PasteboardHelperGtk.h
337
338 webkitgtk_sources += \
339         WebKit/gtk/webkit/webkitnetworkrequest.cpp \
340         WebKit/gtk/webkit/webkitprivate.cpp \
341         WebKit/gtk/webkit/webkitversion.cpp \
342         WebKit/gtk/webkit/webkitwebbackforwardlist.cpp \
343         WebKit/gtk/webkit/webkitwebframe.cpp \
344         WebKit/gtk/webkit/webkitwebhistoryitem.cpp \
345         WebKit/gtk/webkit/webkitwebsettings.cpp \
346         WebKit/gtk/webkit/webkitwebview.cpp \
347         WebKit/gtk/WebCoreSupport/ChromeClientGtk.cpp \
348         WebKit/gtk/WebCoreSupport/ContextMenuClientGtk.cpp \
349         WebKit/gtk/WebCoreSupport/DragClientGtk.cpp \
350         WebKit/gtk/WebCoreSupport/EditorClientGtk.cpp \
351         WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.cpp \
352         WebKit/gtk/WebCoreSupport/InspectorClientGtk.cpp \
353         WebKit/gtk/WebCoreSupport/PasteboardHelperGtk.cpp
354
355 webkitgtk_cppflags += \
356         -DBUILDING_WEBKIT \
357         -I$(srcdir)/WebKit/gtk \
358         -I$(srcdir)/WebKit/gtk/WebCoreSupport \
359         -I$(srcdir)/WebKit/gtk/webkit \
360         -I$(top_builddir)/WebKit/gtk/webkit
361
362 webkitgtk_cleanfiles += \
363         $(top_builddir)/Programs/GtkLauncher \
364         $(top_builddir)/WebKit/gtk/webkit-1.0.pc
365
366 pkgconfigdir = $(libdir)/pkgconfig
367 pkgconfig_DATA = WebKit/gtk/webkit-1.0.pc
368
369 stamp_files := \
370         stamp-webkit-marshal.cpp \
371         stamp-webkit-marshal.h \
372         stamp-webkitenumtypes.cpp \
373         stamp-webkitenumtypes.h
374
375 WEBKIT_MARSHAL = $(GENSOURCES)/webkit-marshal
376 WEBKIT_MARSHAL_LIST = $(srcdir)/WebKit/gtk/webkit/webkit-marshal.list
377
378 DerivedSources/webkit-marshal.cpp: stamp-webkit-marshal.cpp
379         @true
380
381 DerivedSources/webkit-marshal.h: stamp-webkit-marshal.h
382         @true
383
384 stamp-webkit-marshal.cpp: $(WEBKIT_MARSHAL_LIST)
385         echo "extern \"C\" {" > $(WEBKIT_MARSHAL).cpp && \
386         $(GLIB_GENMARSHAL) --prefix=webkit_marshal $(WEBKIT_MARSHAL_LIST) --body >> $(WEBKIT_MARSHAL).cpp && echo '}' >> $(WEBKIT_MARSHAL).cpp && \
387         echo timestamp > $(@F)
388
389 stamp-webkit-marshal.h: $(WEBKIT_MARSHAL_LIST)
390         $(GLIB_GENMARSHAL) --prefix=webkit_marshal $(WEBKIT_MARSHAL_LIST) --header > $(WEBKIT_MARSHAL).h && \
391         echo timestamp > $(@F)
392
393 WebKit/gtk/webkit/webkitenumtypes.h: stamp-webkitenumtypes.h
394         @true
395 stamp-webkitenumtypes.h: $(webkitgtk_h_api) Makefile
396         (cd $(srcdir) \
397         && glib-mkenums \
398                         --fhead "#ifndef WEBKIT_ENUM_TYPES_H\n" \
399                         --fhead "#define WEBKIT_ENUM_TYPES_H\n\n" \
400                         --fhead "#include <glib-object.h>\n\n" \
401                         --fhead "#include <webkit/webkitdefines.h>\n\n" \
402                         --fhead "G_BEGIN_DECLS\n\n" \
403                         --ftail "G_END_DECLS\n\n" \
404                         --ftail "#endif\n" \
405                         --fprod "#include <@filename@>\n\n" \
406                         --eprod "#define WEBKIT_TYPE_@ENUMSHORT@ @enum_name@_get_type()\n\n" \
407                         --eprod "WEBKIT_API GType\n@enum_name@_get_type(void);\n\n" \
408                 $(webkitgtk_h_api) | \
409                 sed 's,WebKit/gtk/,,' | \
410                 sed 's,web_kit,webkit,' | \
411                 sed 's,WEBKIT_TYPE_KIT,WEBKIT_TYPE,' \
412                 ) > xgen-gth \
413         && (cmp -s xgen-gth WebKit/gtk/webkit/webkitenumtypes.h || cp xgen-gth WebKit/gtk/webkit/webkitenumtypes.h) \
414         && rm -f xgen-gth \
415         && echo timestamp > $(@F)
416
417 DerivedSources/webkitenumtypes.cpp: $(webkitgtk_h_api) Makefile
418         (cd $(srcdir) \
419         && glib-mkenums \
420                         --fhead "#include <config.h>\n" \
421                         --fhead "#include <glib-object.h>\n" \
422                         --fhead "#include \"$(top_builddir)/WebKit/gtk/webkit/webkitenumtypes.h\"\n\n" \
423                         --fhead "extern \"C\" {\n\n" \
424                         --fprod "\n/* enumerations from \"@filename@\" */" \
425                         --vhead "static const G@Type@Value _@enum_name@_values[] = {" \
426                         --vprod "    { @VALUENAME@, \"@VALUENAME@\", \"@valuenick@\" }," \
427                         --vtail "    { 0, NULL, NULL }\n};\n\n" \
428                         --vtail "GType @enum_name@_get_type(void)\n{\n" \
429                         --vtail "    static GType type = 0;\n\n" \
430                         --vtail "    if (!type)\n" \
431                         --vtail "        type = g_@type@_register_static(\"@EnumName@\", _@enum_name@_values);\n\n" \
432                         --vtail "    return type;\n}\n\n" \
433                         --ftail "}\n" \
434                 $(webkitgtk_h_api) | \
435                 sed 's,web_kit,webkit,' \
436                 ) > xgen-gtc \
437         && cp xgen-gtc $@ \
438         && rm -f xgen-gtc
439
440 # END WEBKIT GTK+
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)