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