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