2008-11-04 Cameron Zwarich <zwarich@apple.com>
[webkit/qt.git] / GNUmakefile.am
blobf71e7ad1271714c2a95b7402cef178a68a26a5a7
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 \
62         -fno-exceptions
64 global_cxxflags := \
65         $(SYMBOL_VISIBILITY_INLINES) \
66         -fno-rtti
68 if !ENABLE_DEBUG
69 global_cflags += \
70         $(SYMBOL_VISIBILITY)
71 endif
73 # -no-undefined required for building DLLs on Windows
74 # It breaks the build on other platforms, so we use it conditionally
75 if OS_WIN32
76 no_undefined = -no-undefined
77 endif
79 if OS_GNU
80 version_script = -Wl,--version-script,$(srcdir)/symbols.filter
81 endif
83 # Shared libraries
84 lib_LTLIBRARIES = \
85         libwebkit-1.0.la
87 # Convenience libraries
88 noinst_LTLIBRARIES = \
89         libJavaScriptCore.la \
90         libWebCore.la
93 # JavaScriptCore
94 javascriptcore_h_api :=
95 javascriptcore_cppflags:=
96 javascriptcore_sources :=
97 javascriptcore_built_sources :=
98 javascriptcore_built_nosources :=
99 javascriptcore_dist :=
101 javascriptcore_cppflags += \
102         -I$(srcdir)/JavaScriptCore \
103         -I$(srcdir)/JavaScriptCore/ForwardingHeaders \
104         -I$(srcdir)/JavaScriptCore/wtf \
105         -I$(srcdir)/JavaScriptCore/kjs \
106         -I$(top_builddir)/DerivedSources
108 # The variables above are already included below so no need to touch
109 # these variables unless you really have to
110 nodist_EXTRA_libJavaScriptCore_la_SOURCES = \
111         $(javascriptcore_built_nosources)
113 nodist_libJavaScriptCore_la_SOURCES = \
114         $(javascriptcore_built_sources)
116 libJavaScriptCore_ladir = $(prefix)/include/webkit-1.0/JavaScriptCore
117 libJavaScriptCore_la_HEADERS = $(javascriptcore_h_api)
119 libJavaScriptCore_la_SOURCES = \
120         $(javascriptcore_sources)
122 libJavaScriptCore_la_LIBADD = \
123         $(UNICODE_LIBS) \
124         $(GLOBALDEPS_LIBS) \
125         -lpthread
127 libJavaScriptCore_la_CXXFLAGS = \
128         $(global_cxxflags) \
129         $(libJavaScriptCore_la_CFLAGS)
131 libJavaScriptCore_la_CFLAGS = \
132         -fstrict-aliasing \
133         -O3 \
134         $(global_cflags) \
135         $(GLOBALDEPS_CFLAGS) \
136         $(UNICODE_CFLAGS)
138 libJavaScriptCore_la_CPPFLAGS = \
139         $(global_cppflags) \
140         $(javascriptcore_cppflags)
143 # WebCore
144 webcore_cppflags :=
145 webcore_sources :=
146 webcore_libadd :=
147 webcore_built_sources :=
148 webcore_built_nosources :=
149 webcore_dist :=
150 webcoregtk_cppflags :=
151 webcoregtk_sources :=
153 nodist_EXTRA_libWebCore_la_SOURCES = \
154         $(webcore_built_nosources)
156 nodist_libWebCore_la_SOURCES = \
157         $(webcore_built_sources)
159 libWebCore_la_SOURCES = \
160         $(webcore_sources) \
161         $(webcoregtk_sources)
163 libWebCore_la_CXXFLAGS = \
164         $(global_cxxflags) \
165         $(libWebCore_la_CFLAGS)
167 libWebCore_la_CFLAGS = \
168         -fno-strict-aliasing \
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         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         $(PNG_LIBS) \
213         -lpthread
215 # WebKit
216 webkitgtk_h_api :=
217 webkitgtk_sources :=
218 webkitgtk_cppflags :=
219 webkitgtk_built_sources :=
220 webkitgtk_built_nosources :=
221 webkitgtk_cleanfiles :=
223 nodist_libwebkit_1_0_la_SOURCES = \
224         $(webkitgtk_built_sources)
226 libwebkit_1_0_ladir = $(prefix)/include/webkit-1.0/webkit
227 libwebkit_1_0_la_HEADERS = \
228         $(webkitgtk_h_api) \
229         WebKit/gtk/webkit/webkitenumtypes.h
231 libwebkit_1_0_la_SOURCES = \
232         $(webkitgtk_sources)
234 libwebkit_1_0_la_CXXFLAGS = \
235         $(libWebCore_la_CXXFLAGS)
237 libwebkit_1_0_la_CFLAGS = \
238         $(libWebCore_la_CFLAGS)
240 libwebkit_1_0_la_CPPFLAGS = \
241         $(libWebCore_la_CPPFLAGS) \
242         $(webkitgtk_cppflags)
244 libwebkit_1_0_la_LDFLAGS = \
245         $(COVERAGE_LDFLAGS) \
246         -version-info @LIBWEBKITGTK_VERSION@ \
247         $(version_script) \
248         $(no_undefined)
250 libwebkit_1_0_la_LIBADD = \
251         libWebCore.la
254 # Extra checks and flags
255 global_cppflags += \
256         -DBUILDING_CAIRO__=1 \
257         -DBUILDING_GTK__=1 \
258         -DWTF_CHANGES
260 if !ENABLE_FAST_MALLOC
261 global_cppflags += \
262         -DUSE_SYSTEM_MALLOC
263 endif
265 if TARGET_X11
266 global_cppflags += -DXP_UNIX
267 endif
269 if !ENABLE_DEBUG
270 global_cppflags += -DNDEBUG
271 else
272 webcoregtk_cppflags += \
273         -DG_DISABLE_DEPRECATED \
274         -DGDK_PIXBUF_DISABLE_DEPRECATED \
275         -DGDK_DISABLE_DEPRECATED \
276         -DGTK_DISABLE_DEPRECATED \
277         -DPANGO_DISABLE_DEPRECATED
279 # Might be useful in the future
280 #       -DGDK_MULTIHEAD_SAFE \
281 #       -DGTK_MULTIHEAD_SAFE
282 endif
284 if !ENABLE_DATABASE
285 global_cppflags += -DENABLE_DATABASE=0
286 endif
288 if !ENABLE_ICONDATABASE
289 global_cppflags += -DENABLE_ICONDATABASE=0
290 endif
292 if ENABLE_COVERAGE
293 global_cppflags += \
294         -DGCC_GENERATE_TEST_COVERAGE_FILES \
295         -DGCC_INSTRUMENT_PROGRAM_FLOW_ARCS
296 endif
298 if ENABLE_VIDEO
299 webcore_libadd += -lgstinterfaces-0.10 -lgstvideo-0.10
300 endif
302 webkitgtk_h_api += \
303         WebKit/gtk/webkit/webkit.h \
304         WebKit/gtk/webkit/webkitdefines.h \
305         WebKit/gtk/webkit/webkitnetworkrequest.h \
306         WebKit/gtk/webkit/webkitversion.h \
307         WebKit/gtk/webkit/webkitwebbackforwardlist.h \
308         WebKit/gtk/webkit/webkitwebframe.h \
309         WebKit/gtk/webkit/webkitwebhistoryitem.h \
310         WebKit/gtk/webkit/webkitwebinspector.h \
311         WebKit/gtk/webkit/webkitwebsettings.h \
312         WebKit/gtk/webkit/webkitwebview.h
314 webkitgtk_built_sources += \
315         DerivedSources/webkitenumtypes.cpp \
316         DerivedSources/webkitmarshal.cpp \
317         DerivedSources/webkitmarshal.h \
318         WebKit/gtk/webkit/webkitenumtypes.h
320 webkitgtk_sources += \
321         WebKit/gtk/WebCoreSupport/ChromeClientGtk.cpp \
322         WebKit/gtk/WebCoreSupport/ChromeClientGtk.h \
323         WebKit/gtk/WebCoreSupport/ContextMenuClientGtk.cpp \
324         WebKit/gtk/WebCoreSupport/ContextMenuClientGtk.h \
325         WebKit/gtk/WebCoreSupport/DragClientGtk.cpp \
326         WebKit/gtk/WebCoreSupport/DragClientGtk.h \
327         WebKit/gtk/WebCoreSupport/EditorClientGtk.cpp \
328         WebKit/gtk/WebCoreSupport/EditorClientGtk.h \
329         WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.cpp \
330         WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.h \
331         WebKit/gtk/WebCoreSupport/InspectorClientGtk.cpp \
332         WebKit/gtk/WebCoreSupport/InspectorClientGtk.h \
333         WebKit/gtk/WebCoreSupport/PasteboardHelperGtk.cpp \
334         WebKit/gtk/WebCoreSupport/PasteboardHelperGtk.h \
335         WebKit/gtk/webkit/webkitnetworkrequest.cpp \
336         WebKit/gtk/webkit/webkitprivate.cpp \
337         WebKit/gtk/webkit/webkitprivate.h \
338         WebKit/gtk/webkit/webkitversion.cpp \
339         WebKit/gtk/webkit/webkitwebbackforwardlist.cpp \
340         WebKit/gtk/webkit/webkitwebframe.cpp \
341         WebKit/gtk/webkit/webkitwebhistoryitem.cpp \
342         WebKit/gtk/webkit/webkitwebinspector.cpp \
343         WebKit/gtk/webkit/webkitwebsettings.cpp \
344         WebKit/gtk/webkit/webkitwebview.cpp
346 webkitgtk_cppflags += \
347         -DBUILDING_WEBKIT \
348         -I$(srcdir)/WebKit/gtk \
349         -I$(srcdir)/WebKit/gtk/WebCoreSupport \
350         -I$(srcdir)/WebKit/gtk/webkit \
351         -I$(top_builddir)/WebKit/gtk/webkit
353 webkitgtk_cleanfiles += \
354         $(top_builddir)/Programs/GtkLauncher \
355         $(top_builddir)/WebKit/gtk/webkit-1.0.pc \
356         $(top_builddir)/WebKit/gtk/webkit/webkitenumtypes.h
358 pkgconfigdir = $(libdir)/pkgconfig
359 pkgconfig_DATA = WebKit/gtk/webkit-1.0.pc
361 stamp_files := \
362         stamp-webkitmarshal.cpp \
363         stamp-webkitmarshal.h \
364         stamp-webkitenumtypes.cpp \
365         stamp-webkitenumtypes.h
367 WEBKIT_MARSHAL = $(GENSOURCES)/webkitmarshal
368 WEBKIT_MARSHAL_LIST = $(WEBKIT_MARSHAL).list
370 $(WEBKIT_MARSHAL_LIST): $(webkitgtk_sources) GNUmakefile.am
371         ( cd $(top_srcdir) && \
372         sed -n -e 's/.*webkit_marshal_\([[:upper:][:digit:]]*__[[:upper:][:digit:]_]*\).*/\1/p' \
373         $(webkitgtk_sources) ) \
374         | sed -e 's/__/:/' -e 'y/_/,/' | sort -u > $@.tmp
375         if cmp -s $@.tmp $@; then \
376                 rm $@.tmp; \
377         else \
378                 mv $@.tmp $@; \
379         fi
381 $(WEBKIT_MARSHAL).cpp: stamp-webkitmarshal.cpp
382         @true
384 $(WEBKIT_MARSHAL).h: stamp-webkitmarshal.h
385         @true
387 stamp-webkitmarshal.cpp: $(WEBKIT_MARSHAL_LIST)
388         echo "extern \"C\" {" > $(WEBKIT_MARSHAL).cpp && \
389         $(GLIB_GENMARSHAL) --prefix=webkit_marshal $(WEBKIT_MARSHAL_LIST) --body >> $(WEBKIT_MARSHAL).cpp && echo '}' >> $(WEBKIT_MARSHAL).cpp && \
390         echo timestamp > $(@F)
392 stamp-webkitmarshal.h: $(WEBKIT_MARSHAL_LIST)
393         $(GLIB_GENMARSHAL) --prefix=webkit_marshal $(WEBKIT_MARSHAL_LIST) --header > $(WEBKIT_MARSHAL).h && \
394         echo timestamp > $(@F)
396 WebKit/gtk/webkit/webkitenumtypes.h: stamp-webkitenumtypes.h
397         @true
398 stamp-webkitenumtypes.h: $(webkitgtk_h_api) GNUmakefile
399         (cd $(srcdir) \
400         && glib-mkenums \
401                         --fhead "#ifndef WEBKIT_ENUM_TYPES_H\n" \
402                         --fhead "#define WEBKIT_ENUM_TYPES_H\n\n" \
403                         --fhead "#include <glib-object.h>\n\n" \
404                         --fhead "#include <webkit/webkitdefines.h>\n\n" \
405                         --fhead "G_BEGIN_DECLS\n\n" \
406                         --ftail "G_END_DECLS\n\n" \
407                         --ftail "#endif\n" \
408                         --fprod "#include <@filename@>\n\n" \
409                         --eprod "#define WEBKIT_TYPE_@ENUMSHORT@ @enum_name@_get_type()\n\n" \
410                         --eprod "WEBKIT_API GType\n@enum_name@_get_type(void);\n\n" \
411                 $(webkitgtk_h_api) | \
412                 sed 's,WebKit/gtk/,,' | \
413                 sed 's,web_kit,webkit,' | \
414                 sed 's,WEBKIT_TYPE_KIT,WEBKIT_TYPE,' \
415                 ) > xgen-gth \
416         && (cmp -s xgen-gth WebKit/gtk/webkit/webkitenumtypes.h || cp xgen-gth WebKit/gtk/webkit/webkitenumtypes.h) \
417         && rm -f xgen-gth \
418         && echo timestamp > $(@F)
420 DerivedSources/webkitenumtypes.cpp: $(webkitgtk_h_api) GNUmakefile
421         (cd $(srcdir) \
422         && glib-mkenums \
423                         --fhead "#include <config.h>\n" \
424                         --fhead "#include <glib-object.h>\n" \
425                         --fhead "#include \"$(top_builddir)/WebKit/gtk/webkit/webkitenumtypes.h\"\n\n" \
426                         --fhead "extern \"C\" {\n\n" \
427                         --fprod "\n/* enumerations from \"@filename@\" */" \
428                         --vhead "static const G@Type@Value _@enum_name@_values[] = {" \
429                         --vprod "    { @VALUENAME@, \"@VALUENAME@\", \"@valuenick@\" }," \
430                         --vtail "    { 0, NULL, NULL }\n};\n\n" \
431                         --vtail "GType @enum_name@_get_type(void)\n{\n" \
432                         --vtail "    static GType type = 0;\n\n" \
433                         --vtail "    if (!type)\n" \
434                         --vtail "        type = g_@type@_register_static(\"@EnumName@\", _@enum_name@_values);\n\n" \
435                         --vtail "    return type;\n}\n\n" \
436                         --ftail "}\n" \
437                 $(webkitgtk_h_api) | \
438                 sed 's,web_kit,webkit,' \
439                 ) > xgen-gtc \
440         && cp xgen-gtc $@ \
441         && rm -f xgen-gtc
443 # END WEBKIT GTK+
445 # Files that will be distributed
446 EXTRA_DIST = \
447         WebKit/LICENSE \
448         $(javascriptcore_dist) \
449         $(webcore_dist) \
450         symbols.filter
452 # Files that will be cleaned
453 MAINTAINERCLEANFILES := $(stamp_files) $(BUILT_SOURCES)
454 DISTCLEANFILES := $(stamp_files) $(BUILT_SOURCES) doltcompile doltlibtool
455 CLEANFILES := $(stamp_files) $(BUILT_SOURCES)
457 # Include module makefiles
458 include JavaScriptCore/GNUmakefile.am
459 include WebCore/GNUmakefile.am
460 include WebKitTools/GNUmakefile.am
462 # Autogenerated sources
463 BUILT_SOURCES := \
464         $(javascriptcore_built_sources) \
465         $(javascriptcore_built_nosources) \
466         $(webcore_built_sources) \
467         $(webcore_built_nosources) \
468         $(webkitgtk_built_sources) \
469         $(webkitgtk_built_nosources)
471 # Project-wide clean rules
472 CLEANFILES += \
473         $(webkitgtk_cleanfiles)
475 MAINTAINERCLEANFILES += \
476         $(srcdir)/aconfig.h.in \
477         configure \
478         config.* \
479         GNUmakefile.in \
480         INSTALL \
481         README
483 # Older automake versions (1.7) place Plo files in a different place so we need
484 # to create the output directory manually.
485 all-local:
486         mkdir -p $(top_builddir)/$(DEPDIR)/DerivedSources
488 # remove built sources and program directories
489 clean-local:
490         -rm -rf $(GENSOURCES) $(GENPROGRAMS)