2008-06-08 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 # _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 noinst_PROGRAMS :=
42
43 lib_LIBRARIES :=
44
45 IDL_BINDINGS :=
46
47 # Files that will be distributed
48 EXTRA_DIST :=
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
98 javascriptcore_cppflags += \
99         -I$(srcdir)/JavaScriptCore \
100         -I$(srcdir)/JavaScriptCore/ForwardingHeaders \
101         -I$(srcdir)/JavaScriptCore/wtf \
102         -I$(srcdir)/JavaScriptCore/kjs \
103         -I$(top_builddir)/DerivedSources
104
105 # The variables above are already included below so no need to touch
106 # these variables unless you really have to
107 nodist_EXTRA_libJavaScriptCore_la_SOURCES = \
108         $(javascriptcore_built_nosources)
109
110 nodist_libJavaScriptCore_la_SOURCES = \
111         $(javascriptcore_built_sources)
112
113 libJavaScriptCore_ladir = $(prefix)/include/webkit-1.0/JavaScriptCore
114 libJavaScriptCore_la_HEADERS = $(javascriptcore_h_api)
115
116 libJavaScriptCore_la_SOURCES = \
117         $(javascriptcore_sources)
118
119 libJavaScriptCore_la_LIBADD = \
120         $(UNICODE_LIBS) \
121         $(GLOBALDEPS_LIBS) \
122         -lpthread
123
124 libJavaScriptCore_la_CXXFLAGS = \
125         -fstrict-aliasing \
126         -O3 \
127         $(global_cxxflags) \
128         $(global_cflags) \
129         $(GLOBALDEPS_CFLAGS) \
130         $(UNICODE_CFLAGS)
131
132 libJavaScriptCore_la_CFLAGS = \
133         -fstrict-aliasing \
134         -O3 \
135         $(global_cflags) \
136         $(GLOBALDEPS_CFLAGS) \
137         $(UNICODE_CFLAGS)
138
139 libJavaScriptCore_la_CPPFLAGS = \
140         $(global_cppflags) \
141         $(javascriptcore_cppflags)
142
143 #
144 # WebCore
145 webcore_cppflags :=
146 webcore_sources :=
147 webcore_headers :=
148 webcore_libadd :=
149 webcore_built_sources :=
150 webcore_built_nosources :=
151 webcoregtk_cppflags :=
152 webcoregtk_sources :=
153 webcoregtk_headers :=
154
155 nodist_libWebCore_la_SOURCES = \
156         $(webcore_built_sources)
157
158 libWebCore_la_SOURCES = \
159         $(webcore_headers) \
160         $(webcore_sources) \
161         $(webcoregtk_headers) \
162         $(webcoregtk_sources)
163
164 libWebCore_la_CXXFLAGS = \
165         -fno-strict-aliasing \
166         -O2 \
167         $(global_cxxflags) \
168         $(global_cflags) \
169         $(GLOBALDEPS_CFLAGS) \
170         $(UNICODE_CFLAGS) \
171         $(WEBKITDEPS_CFLAGS) \
172         $(LIBCURL_CFLAGS) \
173         $(LIBSOUP_CFLAGS) \
174         $(FREETYPE_CFLAGS) \
175         $(SQLITE3_CFLAGS) \
176         $(GSTREAMER_CFLAGS) \
177         $(LIBXSLT_CFLAGS) \
178         $(COVERAGE_CFLAGS) \
179         $(HILDON_CFLAGS)
180
181 libWebCore_la_CFLAGS = \
182         -fno-strict-aliasing \
183         -O2 \
184         $(global_cflags) \
185         $(GLOBALDEPS_CFLAGS) \
186         $(UNICODE_CFLAGS) \
187         $(WEBKITDEPS_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         $(LIBCURL_LIBS) \
210         $(LIBSOUP_LIBS) \
211         $(FREETYPE_LIBS) \
212         $(UNICODE_LIBS) \
213         $(SQLITE3_LIBS) \
214         $(GSTREAMER_LIBS) \
215         $(LIBXSLT_LIBS) \
216         $(HILDON_LIBS) \
217         -lpthread \
218         -ljpeg
219
220 # WebKit
221 webkitgtk_h_api :=
222 webkitgtk_headers :=
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 = $(webkitgtk_h_api)
234
235 libwebkit_1_0_la_SOURCES = \
236         $(webkitgtk_headers) \
237         $(webkitgtk_sources)
238
239 libwebkit_1_0_la_CXXFLAGS = \
240         $(libWebCore_la_CXXFLAGS)
241
242 libwebkit_1_0_la_CFLAGS = \
243         $(libWebCore_la_CFLAGS)
244
245 libwebkit_1_0_la_CPPFLAGS = \
246         $(libWebCore_la_CPPFLAGS) \
247         $(webkitgtk_cppflags)
248
249 libwebkit_1_0_la_LDFLAGS = \
250         $(COVERAGE_LDFLAGS) \
251         -version-info @LIBWEBKITGTK_VERSION@ \
252         $(no_undefined)
253
254 libwebkit_1_0_la_LIBADD = \
255         libWebCore.la
256
257 #
258 # Extra checks and flags
259 global_cppflags += \
260         -DBUILDING_CAIRO__=1 \
261         -DBUILDING_GTK__=1 \
262         -DWTF_CHANGES
263
264 if !ENABLE_FAST_MALLOC
265 global_cppflags += \
266         -DUSE_SYSTEM_MALLOC
267 endif
268
269 if TARGET_X11
270 global_cppflags += -DXP_UNIX
271 webcore_libadd += -lXt
272 endif
273
274 if !ENABLE_DEBUG
275 global_cppflags += -DNDEBUG
276 else
277 webcoregtk_cppflags += \
278         -DG_DISABLE_DEPRECATED \
279         -DGDK_PIXBUF_DISABLE_DEPRECATED \
280         -DGDK_DISABLE_DEPRECATED \
281         -DGTK_DISABLE_DEPRECATED \
282         -DPANGO_DISABLE_DEPRECATED
283
284 # Might be useful in the future
285 #       -DGDK_MULTIHEAD_SAFE \
286 #       -DGTK_MULTIHEAD_SAFE
287 endif
288
289 if !ENABLE_DATABASE
290 global_cppflags += -DENABLE_DATABASE=0
291 endif
292
293 if !ENABLE_ICONDATABASE
294 global_cppflags += -DENABLE_ICONDATABASE=0
295 endif
296
297 if ENABLE_COVERAGE
298 global_cppflags += \
299         -DGCC_GENERATE_TEST_COVERAGE_FILES \
300         -DGCC_INSTRUMENT_PROGRAM_FLOW_ARCS
301 endif
302
303 if ENABLE_VIDEO
304 webcore_libadd += -lgstinterfaces-0.10 -lgstvideo-0.10
305 endif
306
307 webkitgtk_h_api += \
308         WebKit/gtk/webkit/webkit.h \
309         WebKit/gtk/webkit/webkitdefines.h \
310         WebKit/gtk/webkit/webkitnetworkrequest.h \
311         WebKit/gtk/webkit/webkitversion.h \
312         WebKit/gtk/webkit/webkitwebbackforwardlist.h \
313         WebKit/gtk/webkit/webkitwebframe.h \
314         WebKit/gtk/webkit/webkitwebhistoryitem.h \
315         WebKit/gtk/webkit/webkitwebsettings.h \
316         WebKit/gtk/webkit/webkitwebview.h
317
318 webkitgtk_built_sources += \
319         DerivedSources/webkit-marshal.h \
320         DerivedSources/webkit-marshal.cpp
321
322 webkitgtk_headers += \
323         WebKit/gtk/webkit/webkitprivate.h \
324         WebKit/gtk/WebCoreSupport/ChromeClientGtk.h \
325         WebKit/gtk/WebCoreSupport/ContextMenuClientGtk.h \
326         WebKit/gtk/WebCoreSupport/DragClientGtk.h \
327         WebKit/gtk/WebCoreSupport/EditorClientGtk.h \
328         WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.h \
329         WebKit/gtk/WebCoreSupport/InspectorClientGtk.h \
330         WebKit/gtk/WebCoreSupport/PasteboardHelperGtk.h
331
332 webkitgtk_sources += \
333         WebKit/gtk/webkit/webkitnetworkrequest.cpp \
334         WebKit/gtk/webkit/webkitprivate.cpp \
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         WebKit/gtk/WebCoreSupport/ChromeClientGtk.cpp \
342         WebKit/gtk/WebCoreSupport/ContextMenuClientGtk.cpp \
343         WebKit/gtk/WebCoreSupport/DragClientGtk.cpp \
344         WebKit/gtk/WebCoreSupport/EditorClientGtk.cpp \
345         WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.cpp \
346         WebKit/gtk/WebCoreSupport/InspectorClientGtk.cpp \
347         WebKit/gtk/WebCoreSupport/PasteboardHelperGtk.cpp
348
349 webkitgtk_cppflags += \
350         -DBUILDING_WEBKIT \
351         -I$(srcdir)/WebKit/gtk \
352         -I$(srcdir)/WebKit/gtk/WebCoreSupport \
353         -I$(srcdir)/WebKit/gtk/webkit \
354         -I$(top_builddir)/WebKit/gtk/webkit
355
356 webkitgtk_cleanfiles += \
357         $(top_builddir)/Programs/GtkLauncher \
358         $(top_builddir)/WebKit/gtk/webkit-1.0.pc
359
360 pkgconfigdir = $(libdir)/pkgconfig
361 pkgconfig_DATA = WebKit/gtk/webkit-1.0.pc
362
363 WEBKIT_MARSHAL = $(GENSOURCES)/webkit-marshal
364 WEBKIT_MARSHAL_LIST = $(srcdir)/WebKit/gtk/webkit/webkit-marshal.list
365
366 stamp_files := \
367         stamp-webkit-marshal.cpp \
368         stamp-webkit-marshal.h
369
370 DerivedSources/webkit-marshal.cpp: stamp-webkit-marshal.cpp
371         @true
372
373 DerivedSources/webkit-marshal.h: stamp-webkit-marshal.h
374         @true
375
376 stamp-webkit-marshal.cpp: $(WEBKIT_MARSHAL_LIST)
377         echo "extern \"C\" {" > $(WEBKIT_MARSHAL).cpp && \
378         $(GLIB_GENMARSHAL) --prefix=webkit_marshal $(WEBKIT_MARSHAL_LIST) --body >> $(WEBKIT_MARSHAL).cpp && echo '}' >> $(WEBKIT_MARSHAL).cpp && \
379         echo timestamp > $(@F)
380
381 stamp-webkit-marshal.h: $(WEBKIT_MARSHAL_LIST)
382         $(GLIB_GENMARSHAL) --prefix=webkit_marshal $(WEBKIT_MARSHAL_LIST) --header > $(WEBKIT_MARSHAL).h && \
383         echo timestamp > $(@F)
384
385 # END WEBKIT GTK+
386
387 # Files that will be cleaned
388 MAINTAINERCLEANFILES := $(stamp_files) $(BUILT_SOURCES)
389 DISTCLEANFILES := $(stamp_files) $(BUILT_SOURCES)
390 CLEANFILES := $(stamp_files) $(BUILT_SOURCES)
391
392 # Include module makefiles
393 include JavaScriptCore/GNUmakefile.am
394 include WebCore/GNUmakefile.am
395 include WebKitTools/GNUmakefile.am
396
397 # Autogenerated sources
398 BUILT_SOURCES = \
399         $(javascriptcore_built_sources) \
400         $(javascriptcore_built_nosources) \
401         $(webcore_built_sources) \
402         $(webcore_built_nosources) \
403         $(webkitgtk_built_sources) \
404         $(webkitgtk_built_nosources)
405
406 # Project-wide clean rules
407 CLEANFILES += \
408         $(webkitgtk_cleanfiles)
409
410 MAINTAINERCLEANFILES += \
411         $(srcdir)/aconfig.h.in \
412         configure \
413         config.* \
414         GNUmakefile.in \
415         INSTALL \
416         README
417
418 # remove built sources and program directories
419 clean-local:
420         -rm -rf $(GENSOURCES) $(GENPROGRAMS)