Still fixing Windows build.
[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         $(no_undefined)
254
255 libwebkit_1_0_la_LIBADD = \
256         libWebCore.la
257
258 #
259 # Extra checks and flags
260 global_cppflags += \
261         -DBUILDING_CAIRO__=1 \
262         -DBUILDING_GTK__=1 \
263         -DWTF_CHANGES
264
265 if !ENABLE_FAST_MALLOC
266 global_cppflags += \
267         -DUSE_SYSTEM_MALLOC
268 endif
269
270 if TARGET_X11
271 global_cppflags += -DXP_UNIX
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/webkitenumtypes.cpp \
320         DerivedSources/webkitmarshal.cpp \
321         DerivedSources/webkitmarshal.h \
322         WebKit/gtk/webkit/webkitenumtypes.h
323
324 webkitgtk_sources += \
325         WebKit/gtk/WebCoreSupport/ChromeClientGtk.cpp \
326         WebKit/gtk/WebCoreSupport/ChromeClientGtk.h \
327         WebKit/gtk/WebCoreSupport/ContextMenuClientGtk.cpp \
328         WebKit/gtk/WebCoreSupport/ContextMenuClientGtk.h \
329         WebKit/gtk/WebCoreSupport/DragClientGtk.cpp \
330         WebKit/gtk/WebCoreSupport/DragClientGtk.h \
331         WebKit/gtk/WebCoreSupport/EditorClientGtk.cpp \
332         WebKit/gtk/WebCoreSupport/EditorClientGtk.h \
333         WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.cpp \
334         WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.h \
335         WebKit/gtk/WebCoreSupport/InspectorClientGtk.cpp \
336         WebKit/gtk/WebCoreSupport/InspectorClientGtk.h \
337         WebKit/gtk/WebCoreSupport/PasteboardHelperGtk.cpp \
338         WebKit/gtk/WebCoreSupport/PasteboardHelperGtk.h \
339         WebKit/gtk/webkit/webkitnetworkrequest.cpp \
340         WebKit/gtk/webkit/webkitprivate.cpp \
341         WebKit/gtk/webkit/webkitprivate.h \
342         WebKit/gtk/webkit/webkitversion.cpp \
343         WebKit/gtk/webkit/webkitwebbackforwardlist.cpp \
344         WebKit/gtk/webkit/webkitwebframe.cpp \
345         WebKit/gtk/webkit/webkitwebhistoryitem.cpp \
346         WebKit/gtk/webkit/webkitwebsettings.cpp \
347         WebKit/gtk/webkit/webkitwebview.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 stamp_files := \
364         stamp-webkitmarshal.cpp \
365         stamp-webkitmarshal.h \
366         stamp-webkitenumtypes.cpp \
367         stamp-webkitenumtypes.h
368
369 WEBKIT_MARSHAL = $(GENSOURCES)/webkitmarshal
370 WEBKIT_MARSHAL_LIST = $(WEBKIT_MARSHAL).list
371
372 $(WEBKIT_MARSHAL_LIST): $(webkitgtk_sources) GNUmakefile.am
373         ( cd $(top_srcdir) && \
374         sed -n -e 's/.*webkit_marshal_\([[:upper:][:digit:]]*__[[:upper:][:digit:]_]*\).*/\1/p' \
375         $(webkitgtk_sources) ) \
376         | sed -e 's/__/:/' -e 'y/_/,/' | sort -u > $@.tmp
377         if cmp -s $@.tmp $@; then \
378                 rm $@.tmp; \
379         else \
380                 mv $@.tmp $@; \
381         fi
382
383 $(WEBKIT_MARSHAL).cpp: stamp-webkitmarshal.cpp
384         @true
385
386 $(WEBKIT_MARSHAL).h: stamp-webkitmarshal.h
387         @true
388
389 stamp-webkitmarshal.cpp: $(WEBKIT_MARSHAL_LIST)
390         echo "extern \"C\" {" > $(WEBKIT_MARSHAL).cpp && \
391         $(GLIB_GENMARSHAL) --prefix=webkit_marshal $(WEBKIT_MARSHAL_LIST) --body >> $(WEBKIT_MARSHAL).cpp && echo '}' >> $(WEBKIT_MARSHAL).cpp && \
392         echo timestamp > $(@F)
393
394 stamp-webkitmarshal.h: $(WEBKIT_MARSHAL_LIST)
395         $(GLIB_GENMARSHAL) --prefix=webkit_marshal $(WEBKIT_MARSHAL_LIST) --header > $(WEBKIT_MARSHAL).h && \
396         echo timestamp > $(@F)
397
398 WebKit/gtk/webkit/webkitenumtypes.h: stamp-webkitenumtypes.h
399         @true
400 stamp-webkitenumtypes.h: $(webkitgtk_h_api) GNUmakefile
401         (cd $(srcdir) \
402         && glib-mkenums \
403                         --fhead "#ifndef WEBKIT_ENUM_TYPES_H\n" \
404                         --fhead "#define WEBKIT_ENUM_TYPES_H\n\n" \
405                         --fhead "#include <glib-object.h>\n\n" \
406                         --fhead "#include <webkit/webkitdefines.h>\n\n" \
407                         --fhead "G_BEGIN_DECLS\n\n" \
408                         --ftail "G_END_DECLS\n\n" \
409                         --ftail "#endif\n" \
410                         --fprod "#include <@filename@>\n\n" \
411                         --eprod "#define WEBKIT_TYPE_@ENUMSHORT@ @enum_name@_get_type()\n\n" \
412                         --eprod "WEBKIT_API GType\n@enum_name@_get_type(void);\n\n" \
413                 $(webkitgtk_h_api) | \
414                 sed 's,WebKit/gtk/,,' | \
415                 sed 's,web_kit,webkit,' | \
416                 sed 's,WEBKIT_TYPE_KIT,WEBKIT_TYPE,' \
417                 ) > xgen-gth \
418         && (cmp -s xgen-gth WebKit/gtk/webkit/webkitenumtypes.h || cp xgen-gth WebKit/gtk/webkit/webkitenumtypes.h) \
419         && rm -f xgen-gth \
420         && echo timestamp > $(@F)
421
422 DerivedSources/webkitenumtypes.cpp: $(webkitgtk_h_api) GNUmakefile
423         (cd $(srcdir) \
424         && glib-mkenums \
425                         --fhead "#include <config.h>\n" \
426                         --fhead "#include <glib-object.h>\n" \
427                         --fhead "#include \"$(top_builddir)/WebKit/gtk/webkit/webkitenumtypes.h\"\n\n" \
428                         --fhead "extern \"C\" {\n\n" \
429                         --fprod "\n/* enumerations from \"@filename@\" */" \
430                         --vhead "static const G@Type@Value _@enum_name@_values[] = {" \
431                         --vprod "    { @VALUENAME@, \"@VALUENAME@\", \"@valuenick@\" }," \
432                         --vtail "    { 0, NULL, NULL }\n};\n\n" \
433                         --vtail "GType @enum_name@_get_type(void)\n{\n" \
434                         --vtail "    static GType type = 0;\n\n" \
435                         --vtail "    if (!type)\n" \
436                         --vtail "        type = g_@type@_register_static(\"@EnumName@\", _@enum_name@_values);\n\n" \
437                         --vtail "    return type;\n}\n\n" \
438                         --ftail "}\n" \
439                 $(webkitgtk_h_api) | \
440                 sed 's,web_kit,webkit,' \
441                 ) > xgen-gtc \
442         && cp xgen-gtc $@ \
443         && rm -f xgen-gtc
444
445 # END WEBKIT GTK+
446 #
447 # Files that will be distributed
448 EXTRA_DIST = \
449         $(javascriptcore_dist) \
450         $(webcore_dist)
451
452 # Files that will be cleaned
453 MAINTAINERCLEANFILES := $(stamp_files) $(BUILT_SOURCES)
454 DISTCLEANFILES := $(stamp_files) $(BUILT_SOURCES)
455 CLEANFILES := $(stamp_files) $(BUILT_SOURCES)
456
457 # Include module makefiles
458 include JavaScriptCore/GNUmakefile.am
459 include WebCore/GNUmakefile.am
460 include WebKitTools/GNUmakefile.am
461
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)
470
471 # Project-wide clean rules
472 CLEANFILES += \
473         $(webkitgtk_cleanfiles)
474
475 MAINTAINERCLEANFILES += \
476         $(srcdir)/aconfig.h.in \
477         configure \
478         config.* \
479         GNUmakefile.in \
480         INSTALL \
481         README
482
483 # remove built sources and program directories
484 clean-local:
485         -rm -rf $(GENSOURCES) $(GENPROGRAMS)