2008-09-23 Richard Hult <richard@imendio.com>
[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 if OS_GNU
82 version_script = Wl,--version-script,$(srcdir)/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/wtf \
107         -I$(srcdir)/JavaScriptCore/kjs \
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         $(GLOBALDEPS_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         $(GLOBALDEPS_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_libWebCore_la_SOURCES = \
156         $(webcore_built_sources)
157
158 libWebCore_la_SOURCES = \
159         $(webcore_sources) \
160         $(webcoregtk_sources)
161
162 libWebCore_la_CXXFLAGS = \
163         $(global_cxxflags) \
164         $(libWebCore_la_CFLAGS)
165
166 libWebCore_la_CFLAGS = \
167         -fno-strict-aliasing \
168         -O2 \
169         $(global_cflags) \
170         $(GLOBALDEPS_CFLAGS) \
171         $(UNICODE_CFLAGS) \
172         $(LIBXML_CFLAGS) \
173         $(CAIRO_CFLAGS) \
174         $(PANGO_CFLAGS) \
175         $(GTK_CFLAGS) \
176         $(XT_CFLAGS) \
177         $(LIBCURL_CFLAGS) \
178         $(LIBSOUP_CFLAGS) \
179         $(FREETYPE_CFLAGS) \
180         $(SQLITE3_CFLAGS) \
181         $(GSTREAMER_CFLAGS) \
182         $(LIBXSLT_CFLAGS) \
183         $(COVERAGE_CFLAGS) \
184         $(HILDON_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         $(webcore_libadd) \
196         $(GLOBALDEPS_LIBS) \
197         $(LIBXML_LIBS) \
198         $(CAIRO_LIBS) \
199         $(PANGO_LIBS) \
200         $(GTK_LIBS) \
201         $(XT_LIBS) \
202         $(LIBCURL_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         -lpthread
212
213 # WebKit
214 webkitgtk_h_api :=
215 webkitgtk_sources :=
216 webkitgtk_cppflags :=
217 webkitgtk_built_sources :=
218 webkitgtk_built_nosources :=
219 webkitgtk_cleanfiles :=
220
221 nodist_libwebkit_1_0_la_SOURCES = \
222         $(webkitgtk_built_sources)
223
224 libwebkit_1_0_ladir = $(prefix)/include/webkit-1.0/webkit
225 libwebkit_1_0_la_HEADERS = \
226         $(webkitgtk_h_api) \
227         WebKit/gtk/webkit/webkitenumtypes.h
228
229 libwebkit_1_0_la_SOURCES = \
230         $(webkitgtk_sources)
231
232 libwebkit_1_0_la_CXXFLAGS = \
233         $(libWebCore_la_CXXFLAGS)
234
235 libwebkit_1_0_la_CFLAGS = \
236         $(libWebCore_la_CFLAGS)
237
238 libwebkit_1_0_la_CPPFLAGS = \
239         $(libWebCore_la_CPPFLAGS) \
240         $(webkitgtk_cppflags)
241
242 libwebkit_1_0_la_LDFLAGS = \
243         $(COVERAGE_LDFLAGS) \
244         -version-info @LIBWEBKITGTK_VERSION@ \
245         $(version_script) \
246         $(no_undefined)
247
248 libwebkit_1_0_la_LIBADD = \
249         libWebCore.la
250
251 #
252 # Extra checks and flags
253 global_cppflags += \
254         -DBUILDING_CAIRO__=1 \
255         -DBUILDING_GTK__=1 \
256         -DWTF_CHANGES
257
258 if !ENABLE_FAST_MALLOC
259 global_cppflags += \
260         -DUSE_SYSTEM_MALLOC
261 endif
262
263 if TARGET_X11
264 global_cppflags += -DXP_UNIX
265 endif
266
267 if !ENABLE_DEBUG
268 global_cppflags += -DNDEBUG
269 else
270 webcoregtk_cppflags += \
271         -DG_DISABLE_DEPRECATED \
272         -DGDK_PIXBUF_DISABLE_DEPRECATED \
273         -DGDK_DISABLE_DEPRECATED \
274         -DGTK_DISABLE_DEPRECATED \
275         -DPANGO_DISABLE_DEPRECATED
276
277 # Might be useful in the future
278 #       -DGDK_MULTIHEAD_SAFE \
279 #       -DGTK_MULTIHEAD_SAFE
280 endif
281
282 if !ENABLE_DATABASE
283 global_cppflags += -DENABLE_DATABASE=0
284 endif
285
286 if !ENABLE_ICONDATABASE
287 global_cppflags += -DENABLE_ICONDATABASE=0
288 endif
289
290 if ENABLE_COVERAGE
291 global_cppflags += \
292         -DGCC_GENERATE_TEST_COVERAGE_FILES \
293         -DGCC_INSTRUMENT_PROGRAM_FLOW_ARCS
294 endif
295
296 if ENABLE_VIDEO
297 webcore_libadd += -lgstinterfaces-0.10 -lgstvideo-0.10
298 endif
299
300 webkitgtk_h_api += \
301         WebKit/gtk/webkit/webkit.h \
302         WebKit/gtk/webkit/webkitdefines.h \
303         WebKit/gtk/webkit/webkitnetworkrequest.h \
304         WebKit/gtk/webkit/webkitversion.h \
305         WebKit/gtk/webkit/webkitwebbackforwardlist.h \
306         WebKit/gtk/webkit/webkitwebframe.h \
307         WebKit/gtk/webkit/webkitwebhistoryitem.h \
308         WebKit/gtk/webkit/webkitwebsettings.h \
309         WebKit/gtk/webkit/webkitwebview.h
310
311 webkitgtk_built_sources += \
312         DerivedSources/webkitenumtypes.cpp \
313         DerivedSources/webkitmarshal.cpp \
314         DerivedSources/webkitmarshal.h \
315         WebKit/gtk/webkit/webkitenumtypes.h
316
317 webkitgtk_sources += \
318         WebKit/gtk/WebCoreSupport/ChromeClientGtk.cpp \
319         WebKit/gtk/WebCoreSupport/ChromeClientGtk.h \
320         WebKit/gtk/WebCoreSupport/ContextMenuClientGtk.cpp \
321         WebKit/gtk/WebCoreSupport/ContextMenuClientGtk.h \
322         WebKit/gtk/WebCoreSupport/DragClientGtk.cpp \
323         WebKit/gtk/WebCoreSupport/DragClientGtk.h \
324         WebKit/gtk/WebCoreSupport/EditorClientGtk.cpp \
325         WebKit/gtk/WebCoreSupport/EditorClientGtk.h \
326         WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.cpp \
327         WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.h \
328         WebKit/gtk/WebCoreSupport/InspectorClientGtk.cpp \
329         WebKit/gtk/WebCoreSupport/InspectorClientGtk.h \
330         WebKit/gtk/WebCoreSupport/PasteboardHelperGtk.cpp \
331         WebKit/gtk/WebCoreSupport/PasteboardHelperGtk.h \
332         WebKit/gtk/webkit/webkitnetworkrequest.cpp \
333         WebKit/gtk/webkit/webkitprivate.cpp \
334         WebKit/gtk/webkit/webkitprivate.h \
335         WebKit/gtk/webkit/webkitversion.cpp \
336         WebKit/gtk/webkit/webkitwebbackforwardlist.cpp \
337         WebKit/gtk/webkit/webkitwebframe.cpp \
338         WebKit/gtk/webkit/webkitwebhistoryitem.cpp \
339         WebKit/gtk/webkit/webkitwebsettings.cpp \
340         WebKit/gtk/webkit/webkitwebview.cpp
341
342 webkitgtk_cppflags += \
343         -DBUILDING_WEBKIT \
344         -I$(srcdir)/WebKit/gtk \
345         -I$(srcdir)/WebKit/gtk/WebCoreSupport \
346         -I$(srcdir)/WebKit/gtk/webkit \
347         -I$(top_builddir)/WebKit/gtk/webkit
348
349 webkitgtk_cleanfiles += \
350         $(top_builddir)/Programs/GtkLauncher \
351         $(top_builddir)/WebKit/gtk/webkit-1.0.pc
352
353 pkgconfigdir = $(libdir)/pkgconfig
354 pkgconfig_DATA = WebKit/gtk/webkit-1.0.pc
355
356 stamp_files := \
357         stamp-webkitmarshal.cpp \
358         stamp-webkitmarshal.h \
359         stamp-webkitenumtypes.cpp \
360         stamp-webkitenumtypes.h
361
362 WEBKIT_MARSHAL = $(GENSOURCES)/webkitmarshal
363 WEBKIT_MARSHAL_LIST = $(WEBKIT_MARSHAL).list
364
365 $(WEBKIT_MARSHAL_LIST): $(webkitgtk_sources) GNUmakefile.am
366         ( cd $(top_srcdir) && \
367         sed -n -e 's/.*webkit_marshal_\([[:upper:][:digit:]]*__[[:upper:][:digit:]_]*\).*/\1/p' \
368         $(webkitgtk_sources) ) \
369         | sed -e 's/__/:/' -e 'y/_/,/' | sort -u > $@.tmp
370         if cmp -s $@.tmp $@; then \
371                 rm $@.tmp; \
372         else \
373                 mv $@.tmp $@; \
374         fi
375
376 $(WEBKIT_MARSHAL).cpp: stamp-webkitmarshal.cpp
377         @true
378
379 $(WEBKIT_MARSHAL).h: stamp-webkitmarshal.h
380         @true
381
382 stamp-webkitmarshal.cpp: $(WEBKIT_MARSHAL_LIST)
383         echo "extern \"C\" {" > $(WEBKIT_MARSHAL).cpp && \
384         $(GLIB_GENMARSHAL) --prefix=webkit_marshal $(WEBKIT_MARSHAL_LIST) --body >> $(WEBKIT_MARSHAL).cpp && echo '}' >> $(WEBKIT_MARSHAL).cpp && \
385         echo timestamp > $(@F)
386
387 stamp-webkitmarshal.h: $(WEBKIT_MARSHAL_LIST)
388         $(GLIB_GENMARSHAL) --prefix=webkit_marshal $(WEBKIT_MARSHAL_LIST) --header > $(WEBKIT_MARSHAL).h && \
389         echo timestamp > $(@F)
390
391 WebKit/gtk/webkit/webkitenumtypes.h: stamp-webkitenumtypes.h
392         @true
393 stamp-webkitenumtypes.h: $(webkitgtk_h_api) GNUmakefile
394         (cd $(srcdir) \
395         && glib-mkenums \
396                         --fhead "#ifndef WEBKIT_ENUM_TYPES_H\n" \
397                         --fhead "#define WEBKIT_ENUM_TYPES_H\n\n" \
398                         --fhead "#include <glib-object.h>\n\n" \
399                         --fhead "#include <webkit/webkitdefines.h>\n\n" \
400                         --fhead "G_BEGIN_DECLS\n\n" \
401                         --ftail "G_END_DECLS\n\n" \
402                         --ftail "#endif\n" \
403                         --fprod "#include <@filename@>\n\n" \
404                         --eprod "#define WEBKIT_TYPE_@ENUMSHORT@ @enum_name@_get_type()\n\n" \
405                         --eprod "WEBKIT_API GType\n@enum_name@_get_type(void);\n\n" \
406                 $(webkitgtk_h_api) | \
407                 sed 's,WebKit/gtk/,,' | \
408                 sed 's,web_kit,webkit,' | \
409                 sed 's,WEBKIT_TYPE_KIT,WEBKIT_TYPE,' \
410                 ) > xgen-gth \
411         && (cmp -s xgen-gth WebKit/gtk/webkit/webkitenumtypes.h || cp xgen-gth WebKit/gtk/webkit/webkitenumtypes.h) \
412         && rm -f xgen-gth \
413         && echo timestamp > $(@F)
414
415 DerivedSources/webkitenumtypes.cpp: $(webkitgtk_h_api) GNUmakefile
416         (cd $(srcdir) \
417         && glib-mkenums \
418                         --fhead "#include <config.h>\n" \
419                         --fhead "#include <glib-object.h>\n" \
420                         --fhead "#include \"$(top_builddir)/WebKit/gtk/webkit/webkitenumtypes.h\"\n\n" \
421                         --fhead "extern \"C\" {\n\n" \
422                         --fprod "\n/* enumerations from \"@filename@\" */" \
423                         --vhead "static const G@Type@Value _@enum_name@_values[] = {" \
424                         --vprod "    { @VALUENAME@, \"@VALUENAME@\", \"@valuenick@\" }," \
425                         --vtail "    { 0, NULL, NULL }\n};\n\n" \
426                         --vtail "GType @enum_name@_get_type(void)\n{\n" \
427                         --vtail "    static GType type = 0;\n\n" \
428                         --vtail "    if (!type)\n" \
429                         --vtail "        type = g_@type@_register_static(\"@EnumName@\", _@enum_name@_values);\n\n" \
430                         --vtail "    return type;\n}\n\n" \
431                         --ftail "}\n" \
432                 $(webkitgtk_h_api) | \
433                 sed 's,web_kit,webkit,' \
434                 ) > xgen-gtc \
435         && cp xgen-gtc $@ \
436         && rm -f xgen-gtc
437
438 # END WEBKIT GTK+
439 #
440 # Files that will be distributed
441 EXTRA_DIST = \
442         $(javascriptcore_dist) \
443         $(webcore_dist) \
444         symbols.filter
445
446 # Files that will be cleaned
447 MAINTAINERCLEANFILES := $(stamp_files) $(BUILT_SOURCES)
448 DISTCLEANFILES := $(stamp_files) $(BUILT_SOURCES)
449 CLEANFILES := $(stamp_files) $(BUILT_SOURCES)
450
451 # Include module makefiles
452 include JavaScriptCore/GNUmakefile.am
453 include WebCore/GNUmakefile.am
454 include WebKitTools/GNUmakefile.am
455
456 # Autogenerated sources
457 BUILT_SOURCES = \
458         $(javascriptcore_built_sources) \
459         $(javascriptcore_built_nosources) \
460         $(webcore_built_sources) \
461         $(webcore_built_nosources) \
462         $(webkitgtk_built_sources) \
463         $(webkitgtk_built_nosources)
464
465 # Project-wide clean rules
466 CLEANFILES += \
467         $(webkitgtk_cleanfiles)
468
469 MAINTAINERCLEANFILES += \
470         $(srcdir)/aconfig.h.in \
471         configure \
472         config.* \
473         GNUmakefile.in \
474         INSTALL \
475         README
476
477 # remove built sources and program directories
478 clean-local:
479         -rm -rf $(GENSOURCES) $(GENPROGRAMS)