2008-10-03 Anders Carlsson <andersca@apple.com>
[webkit/qt.git] / GNUmakefile.am
blob6029357d5b2193652aec6332cff82928b0c078b6
1 # Top-level Makefile rule for automake
3 # Variable conventions:
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
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.
20 # Global Variables
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
29 srcdir = @srcdir@
30 VPATH = @srcdir@
32 # Directory for autogenerated sources
33 GENSOURCES := $(top_builddir)/DerivedSources
34 GENPROGRAMS := $(top_builddir)/Programs
36 # Script for creating hash tables
37 CREATE_HASH_TABLE = $(srcdir)/JavaScriptCore/kjs/create_hash_table
39 # Libraries and support components
40 bin_PROGRAMS :=
42 noinst_PROGRAMS :=
44 noinst_HEADERS :=
46 lib_LIBRARIES :=
48 IDL_BINDINGS :=
50 # Global flags to CPP
51 global_cppflags :=
53 global_cppflags += \
54         -DWTF_USE_ICU_UNICODE=1
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
63 global_cxxflags := \
64         $(SYMBOL_VISIBILITY_INLINES)
66 if !ENABLE_DEBUG
67 global_cflags += \
68         -fno-exceptions \
69         $(SYMBOL_VISIBILITY)
71 global_cxxflags += \
72         -fno-rtti
73 endif
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
81 if OS_GNU
82 version_script = Wl,--version-script,$(srcdir)/symbols.filter
83 endif
85 # Shared libraries
86 lib_LTLIBRARIES = \
87         libwebkit-1.0.la
89 # Convenience libraries
90 noinst_LTLIBRARIES = \
91         libJavaScriptCore.la \
92         libWebCore.la
95 # JavaScriptCore
96 javascriptcore_h_api :=
97 javascriptcore_cppflags:=
98 javascriptcore_sources :=
99 javascriptcore_built_sources :=
100 javascriptcore_built_nosources :=
101 javascriptcore_dist :=
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
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)
115 nodist_libJavaScriptCore_la_SOURCES = \
116         $(javascriptcore_built_sources)
118 libJavaScriptCore_ladir = $(prefix)/include/webkit-1.0/JavaScriptCore
119 libJavaScriptCore_la_HEADERS = $(javascriptcore_h_api)
121 libJavaScriptCore_la_SOURCES = \
122         $(javascriptcore_sources)
124 libJavaScriptCore_la_LIBADD = \
125         $(UNICODE_LIBS) \
126         $(GLOBALDEPS_LIBS) \
127         -lpthread
129 libJavaScriptCore_la_CXXFLAGS = \
130         $(global_cxxflags) \
131         $(libJavaScriptCore_la_CFLAGS)
133 libJavaScriptCore_la_CFLAGS = \
134         -fstrict-aliasing \
135         -O3 \
136         $(global_cflags) \
137         $(GLOBALDEPS_CFLAGS) \
138         $(UNICODE_CFLAGS)
140 libJavaScriptCore_la_CPPFLAGS = \
141         $(global_cppflags) \
142         $(javascriptcore_cppflags)
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 :=
155 nodist_libWebCore_la_SOURCES = \
156         $(webcore_built_sources)
158 libWebCore_la_SOURCES = \
159         $(webcore_sources) \
160         $(webcoregtk_sources)
162 libWebCore_la_CXXFLAGS = \
163         $(global_cxxflags) \
164         $(libWebCore_la_CFLAGS)
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)
186 libWebCore_la_CPPFLAGS = \
187         $(global_cppflags) \
188         $(webcore_cppflags) \
189         $(javascriptcore_cppflags) \
190         $(webcoregtk_cppflags) \
191         $(HILDON_CPPFLAGS)
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
213 # WebKit
214 webkitgtk_h_api :=
215 webkitgtk_sources :=
216 webkitgtk_cppflags :=
217 webkitgtk_built_sources :=
218 webkitgtk_built_nosources :=
219 webkitgtk_cleanfiles :=
221 nodist_libwebkit_1_0_la_SOURCES = \
222         $(webkitgtk_built_sources)
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
229 libwebkit_1_0_la_SOURCES = \
230         $(webkitgtk_sources)
232 libwebkit_1_0_la_CXXFLAGS = \
233         $(libWebCore_la_CXXFLAGS)
235 libwebkit_1_0_la_CFLAGS = \
236         $(libWebCore_la_CFLAGS)
238 libwebkit_1_0_la_CPPFLAGS = \
239         $(libWebCore_la_CPPFLAGS) \
240         $(webkitgtk_cppflags)
242 libwebkit_1_0_la_LDFLAGS = \
243         $(COVERAGE_LDFLAGS) \
244         -version-info @LIBWEBKITGTK_VERSION@ \
245         $(version_script) \
246         $(no_undefined)
248 libwebkit_1_0_la_LIBADD = \
249         libWebCore.la
252 # Extra checks and flags
253 global_cppflags += \
254         -DBUILDING_CAIRO__=1 \
255         -DBUILDING_GTK__=1 \
256         -DWTF_CHANGES
258 if !ENABLE_FAST_MALLOC
259 global_cppflags += \
260         -DUSE_SYSTEM_MALLOC
261 endif
263 if TARGET_X11
264 global_cppflags += -DXP_UNIX
265 endif
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
277 # Might be useful in the future
278 #       -DGDK_MULTIHEAD_SAFE \
279 #       -DGTK_MULTIHEAD_SAFE
280 endif
282 if !ENABLE_DATABASE
283 global_cppflags += -DENABLE_DATABASE=0
284 endif
286 if !ENABLE_ICONDATABASE
287 global_cppflags += -DENABLE_ICONDATABASE=0
288 endif
290 if ENABLE_COVERAGE
291 global_cppflags += \
292         -DGCC_GENERATE_TEST_COVERAGE_FILES \
293         -DGCC_INSTRUMENT_PROGRAM_FLOW_ARCS
294 endif
296 if ENABLE_VIDEO
297 webcore_libadd += -lgstinterfaces-0.10 -lgstvideo-0.10
298 endif
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
311 webkitgtk_built_sources += \
312         DerivedSources/webkitenumtypes.cpp \
313         DerivedSources/webkitmarshal.cpp \
314         DerivedSources/webkitmarshal.h \
315         WebKit/gtk/webkit/webkitenumtypes.h
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
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
349 webkitgtk_cleanfiles += \
350         $(top_builddir)/Programs/GtkLauncher \
351         $(top_builddir)/WebKit/gtk/webkit-1.0.pc
353 pkgconfigdir = $(libdir)/pkgconfig
354 pkgconfig_DATA = WebKit/gtk/webkit-1.0.pc
356 stamp_files := \
357         stamp-webkitmarshal.cpp \
358         stamp-webkitmarshal.h \
359         stamp-webkitenumtypes.cpp \
360         stamp-webkitenumtypes.h
362 WEBKIT_MARSHAL = $(GENSOURCES)/webkitmarshal
363 WEBKIT_MARSHAL_LIST = $(WEBKIT_MARSHAL).list
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
376 $(WEBKIT_MARSHAL).cpp: stamp-webkitmarshal.cpp
377         @true
379 $(WEBKIT_MARSHAL).h: stamp-webkitmarshal.h
380         @true
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)
387 stamp-webkitmarshal.h: $(WEBKIT_MARSHAL_LIST)
388         $(GLIB_GENMARSHAL) --prefix=webkit_marshal $(WEBKIT_MARSHAL_LIST) --header > $(WEBKIT_MARSHAL).h && \
389         echo timestamp > $(@F)
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)
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
438 # END WEBKIT GTK+
440 # Files that will be distributed
441 EXTRA_DIST = \
442         $(javascriptcore_dist) \
443         $(webcore_dist) \
444         symbols.filter
446 # Files that will be cleaned
447 MAINTAINERCLEANFILES := $(stamp_files) $(BUILT_SOURCES)
448 DISTCLEANFILES := $(stamp_files) $(BUILT_SOURCES)
449 CLEANFILES := $(stamp_files) $(BUILT_SOURCES)
451 # Include module makefiles
452 include JavaScriptCore/GNUmakefile.am
453 include WebCore/GNUmakefile.am
454 include WebKitTools/GNUmakefile.am
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)
465 # Project-wide clean rules
466 CLEANFILES += \
467         $(webkitgtk_cleanfiles)
469 MAINTAINERCLEANFILES += \
470         $(srcdir)/aconfig.h.in \
471         configure \
472         config.* \
473         GNUmakefile.in \
474         INSTALL \
475         README
477 # remove built sources and program directories
478 clean-local:
479         -rm -rf $(GENSOURCES) $(GENPROGRAMS)