2009-02-12 Simon Fraser <simon.fraser@apple.com>
[WebKit-https.git] / GNUmakefile.am
index 95eb1fb..c74e1fa 100644 (file)
@@ -5,7 +5,6 @@
 # _h_api            = API headers that will be installed and included in the distribution
 # _cppflags         = flags that will be passed to the C/CXX Preprocessor
 # _sources          = sources that will be compiled and included in the distribution
-# _headers          = header files that will be part of the distribution
 # _built_sources    = files that will be autogenerated by the build system and
 #                     will be part of the _SOURCES primary
 # _built_nosources  = files that are autogenerated but are not part of the
 #
 # Sources, headers, flags, etc... should be added to the respective variables
 # with the above suffix, e.g, webcore-specific sources should go to
-# webcore_sources, gtk port-specific flags should go to webkitgtk_cppflags,
-# etc... The only exceptions are the global variables. See Global Variables below.
+# webcore_sources, gtk port API and WebCoreSupport parts to webkitgtk_sources,
+# etc... The only exceptions are the global variables. See Global Variables
+# below.
 #
 # Global Variables
 #
 # global_cppflags   = CPPFLAGS that apply to JSC, WebCore, and to any
 #                     specific port
-# global_cflags     = CFLAGS and CXXFLAGS that apply to JSC, WebCore, and to
+# global_cflags     = CFLAGS that apply to JSC, WebCore, and to
 #                     any specific port
+# global_cxxflags   = CXXFLAGS that apply to JSC, WebCore, and to any
+#                     specific port
 
 srcdir = @srcdir@
 VPATH = @srcdir@
 
 # Directory for autogenerated sources
 GENSOURCES := $(top_builddir)/DerivedSources
+GENPROGRAMS := $(top_builddir)/Programs
 
 # Script for creating hash tables
-CREATE_HASH_TABLE = $(srcdir)/JavaScriptCore/kjs/create_hash_table
+CREATE_HASH_TABLE = $(srcdir)/JavaScriptCore/create_hash_table
 
 # Libraries and support components
-noinst_LTLIBRARIES :=
-
-noinst_HEADERS :=
+bin_PROGRAMS :=
 
 noinst_PROGRAMS :=
 
+noinst_HEADERS :=
+
 lib_LIBRARIES :=
 
 IDL_BINDINGS :=
 
-# Files that will be distributed
-EXTRA_DIST :=
-
-#
 # Global flags to CPP
-global_cppflags := 
+global_cppflags :=
 
 global_cppflags += \
-       -I $(srcdir)/JavaScriptCore \
-       -I $(srcdir)/JavaScriptCore/ForwardingHeaders \
-       -I $(srcdir)/JavaScriptCore/wtf \
-       -I $(srcdir)/JavaScriptCore/kjs \
-       -I $(top_builddir)/DerivedSources
+       -DWTF_USE_ICU_UNICODE=1
 
 # Default compiler flags
 global_cflags := \
        -Wall -W -Wcast-align -Wchar-subscripts -Wreturn-type \
        -Wformat -Wformat-security -Wno-format-y2k -Wundef \
        -Wmissing-format-attribute -Wpointer-arith -Wwrite-strings \
-       -Wno-unused-parameter -fno-exceptions -fno-strict-aliasing
+       -Wno-unused-parameter -Wno-parentheses \
+       -fno-exceptions
+
+global_cxxflags := \
+       $(SYMBOL_VISIBILITY_INLINES) \
+       -fno-rtti
 
-# Libraries
-lib_LTLIBRARIES = libJavaScriptCore.la libWebKitGtk.la
+if !ENABLE_DEBUG
+global_cflags += \
+       $(SYMBOL_VISIBILITY)
+endif
+
+# -no-undefined required for building DLLs on Windows
+# It breaks the build on other platforms, so we use it conditionally
+if OS_WIN32
+no_undefined = -no-undefined
+endif
+
+if OS_GNU
+version_script = -Wl,--version-script,$(srcdir)/autotools/symbols.filter
+endif
+
+# Shared libraries
+lib_LTLIBRARIES = \
+       libwebkit-1.0.la
+
+# Convenience libraries
+noinst_LTLIBRARIES = \
+       libJavaScriptCore.la \
+       libWebCore.la
 
 #
 # JavaScriptCore
 javascriptcore_h_api :=
 javascriptcore_cppflags:=
 javascriptcore_sources :=
-javascriptcore_built_sources := 
+javascriptcore_built_sources :=
 javascriptcore_built_nosources :=
+javascriptcore_dist :=
+
+javascriptcore_cppflags += \
+       -I$(srcdir)/JavaScriptCore \
+       -I$(srcdir)/JavaScriptCore/ForwardingHeaders \
+       -I$(srcdir)/JavaScriptCore/parser \
+       -I$(srcdir)/JavaScriptCore/wtf \
+       -I$(top_builddir)/DerivedSources
 
 # The variables above are already included below so no need to touch
 # these variables unless you really have to
-libJavaScriptCore_ladir = $(prefix)/include/WebKit/JavaScriptCore
-libJavaScriptCore_la_HEADERS := $(javascriptcore_h_api)
+nodist_EXTRA_libJavaScriptCore_la_SOURCES = \
+       $(javascriptcore_built_nosources)
 
-libJavaScriptCore_la_SOURCES := \
-       $(javascriptcore_built_sources) \
+nodist_libJavaScriptCore_la_SOURCES = \
+       $(javascriptcore_built_sources)
+
+libJavaScriptCore_ladir = $(prefix)/include/webkit-1.0/JavaScriptCore
+libJavaScriptCore_la_HEADERS = $(javascriptcore_h_api)
+
+libJavaScriptCore_la_SOURCES = \
        $(javascriptcore_sources)
 
-libJavaScriptCore_la_LDFLAGS := -lpthread
+libJavaScriptCore_la_LIBADD = \
+       $(UNICODE_LIBS) \
+       $(GLIB_LIBS) \
+       -lpthread
 
-libJavaScriptCore_la_CXXFLAGS := $(global_cflags)
+libJavaScriptCore_la_CXXFLAGS = \
+       $(global_cxxflags) \
+       $(libJavaScriptCore_la_CFLAGS)
 
-libJavaScriptCore_la_CFLAGS := $(global_cflags)
+libJavaScriptCore_la_CFLAGS = \
+       -fstrict-aliasing \
+       -O3 \
+       $(global_cflags) \
+       $(GLIB_CFLAGS) \
+       $(UNICODE_CFLAGS)
 
-libJavaScriptCore_la_CPPFLAGS := $(global_cppflags) $(javascriptcore_cppflags)
+libJavaScriptCore_la_CPPFLAGS = \
+       $(global_cppflags) \
+       $(javascriptcore_cppflags)
 
 #
 # WebCore
 webcore_cppflags :=
 webcore_sources :=
-webcore_headers :=
+webcore_libadd :=
 webcore_built_sources :=
 webcore_built_nosources :=
+webcore_dist :=
+webcoregtk_cppflags :=
+webcoregtk_sources :=
 
-# WebKitGtk
-webkitgtk_h_api :=
-webkitgtk_headers :=
-webkitgtk_sources :=
-webkitgtk_cppflags :=
-webkitgtk_ldflags :=
-webkitgtk_built_sources :=
-webkitgtk_built_nosources :=
-webkitgtk_cleanfiles :=
+nodist_EXTRA_libWebCore_la_SOURCES = \
+       $(webcore_built_nosources)
 
-# No need to touch the following variables unless you have to. If you need to change the values
-# for the following variables, use the "webkitgtk_" variables above
-libWebKitGtk_ladir := $(prefix)/include/WebKit
+nodist_libWebCore_la_SOURCES = \
+       $(webcore_built_sources)
 
-libWebKitGtk_la_HEADERS := $(webkitgtk_h_api)
-
-libWebKitGtk_la_SOURCES := \
-       $(webcore_built_sources) \
-       $(webcore_headers) \
+libWebCore_la_SOURCES = \
        $(webcore_sources) \
-       $(webkitgtk_built_sources) \
-       $(webkitgtk_headers) \
-       $(webkitgtk_sources)
+       $(webcoregtk_sources)
 
-libWebKitGtk_la_CXXFLAGS := \
-       -fno-rtti \
-       $(global_cflags) \
-       $(DEPENDENCIES_CFLAGS) \
-       $(SQLITE3_CFLAGS) \
-       $(GSTREAMER_CFLAGS) \
-       $(LIBXSLT_CFLAGS) \
-       $(COVERAGE_CFLAGS)
+libWebCore_la_CXXFLAGS = \
+       $(global_cxxflags) \
+       $(libWebCore_la_CFLAGS)
 
-libWebKitGtk_la_CFLAGS := \
+libWebCore_la_CFLAGS = \
+       -fno-strict-aliasing \
        $(global_cflags) \
-       $(DEPENDENCIES_CFLAGS) \
+       $(GLIB_CFLAGS) \
+       $(UNICODE_CFLAGS) \
+       $(LIBXML_CFLAGS) \
+       $(CAIRO_CFLAGS) \
+       $(PANGO_CFLAGS) \
+       $(GTK_CFLAGS) \
+       $(XT_CFLAGS) \
+       $(LIBCURL_CFLAGS) \
+       $(LIBSOUP_CFLAGS) \
+       $(FREETYPE_CFLAGS) \
        $(SQLITE3_CFLAGS) \
        $(GSTREAMER_CFLAGS) \
        $(LIBXSLT_CFLAGS) \
-       $(COVERAGE_CFLAGS)
+       $(COVERAGE_CFLAGS) \
+       $(HILDON_CFLAGS) \
+       $(GEOCLUE_CFLAGS)
 
-libWebKitGtk_la_CPPFLAGS := \
+libWebCore_la_CPPFLAGS = \
        $(global_cppflags) \
        $(webcore_cppflags) \
-       $(webkitgtk_cppflags)
-
-libWebKitGtk_la_LIBADD := @LTLIBOBJS@ libJavaScriptCore.la
-
-libWebKitGtk_la_LDFLAGS := \
-       $(webkitgtk_ldflags) \
-       $(DEPENDENCIES_LIBS) \
-       $(ICU_LIBS) \
+       $(javascriptcore_cppflags) \
+       $(webcoregtk_cppflags) \
+       $(HILDON_CPPFLAGS)
+
+libWebCore_la_LIBADD = \
+       libJavaScriptCore.la \
+       libWebCoreJS.la \
+       $(webcore_libadd) \
+       $(GLIB_LIBS) \
+       $(LIBXML_LIBS) \
+       $(CAIRO_LIBS) \
+       $(PANGO_LIBS) \
+       $(GTK_LIBS) \
+       $(XT_LIBS) \
+       $(LIBCURL_LIBS) \
+       $(LIBSOUP_LIBS) \
+       $(FREETYPE_LIBS) \
+       $(UNICODE_LIBS) \
        $(SQLITE3_LIBS) \
        $(GSTREAMER_LIBS) \
        $(LIBXSLT_LIBS) \
+       $(HILDON_LIBS) \
+       $(JPEG_LIBS) \
+       $(PNG_LIBS) \
+       $(GEOCLUE_LIBS) \
+       -lpthread
+
+# WebKit
+webkitgtk_h_api :=
+webkitgtk_sources :=
+webkitgtk_cppflags :=
+webkitgtk_built_sources :=
+webkitgtk_built_nosources :=
+webkitgtk_cleanfiles :=
+
+nodist_libwebkit_1_0_la_SOURCES = \
+       $(webkitgtk_built_sources)
+
+libwebkit_1_0_ladir = $(prefix)/include/webkit-1.0/webkit
+libwebkit_1_0_la_HEADERS = \
+       $(webkitgtk_h_api) \
+       WebKit/gtk/webkit/webkitenumtypes.h
+
+libwebkit_1_0_la_SOURCES = \
+       $(webkitgtk_sources)
+
+libwebkit_1_0_la_CXXFLAGS = \
+       $(libWebCore_la_CXXFLAGS)
+
+libwebkit_1_0_la_CFLAGS = \
+       $(libWebCore_la_CFLAGS)
+
+libwebkit_1_0_la_CPPFLAGS = \
+       $(libWebCore_la_CPPFLAGS) \
+       $(webkitgtk_cppflags)
+
+libwebkit_1_0_la_LDFLAGS = \
        $(COVERAGE_LDFLAGS) \
-       -lpthread \
-       -ljpeg \
-       -version-info @LIBWEBKITGTK_VERSION@
+       -version-info @LIBWEBKITGTK_VERSION@ \
+       $(version_script) \
+       $(no_undefined)
+
+libwebkit_1_0_la_LIBADD = \
+       libWebCore.la
 
 #
 # Extra checks and flags
 global_cppflags += \
+       -DBUILDING_CAIRO__=1 \
        -DBUILDING_GTK__=1 \
        -DWTF_CHANGES
 
@@ -178,8 +270,8 @@ endif
 
 if !ENABLE_DEBUG
 global_cppflags += -DNDEBUG
-else 
-webkitgtk_cppflags += \
+else
+webcoregtk_cppflags += \
        -DG_DISABLE_DEPRECATED \
        -DGDK_PIXBUF_DISABLE_DEPRECATED \
        -DGDK_DISABLE_DEPRECATED \
@@ -206,86 +298,168 @@ global_cppflags += \
 endif
 
 if ENABLE_VIDEO
-webkitgtk_ldflags += -lgstinterfaces-0.10 -lgstvideo-0.10
+webcore_libadd += -lgstinterfaces-0.10 -lgstvideo-0.10
 endif
 
-#
-# WEBKIT GTK+
-webkitgtk_cppflags += \
--I $(top_builddir)/WebKit/gtk/WebView \
--DBUILDING_CAIRO__=1 \
--DBUILD_WEBKIT
-
 webkitgtk_h_api += \
-       WebKit/gtk/WebView/webkit.h \
-       WebKit/gtk/WebView/webkitdefines.h \
-       WebKit/gtk/WebView/webkitnetworkrequest.h \
-       WebKit/gtk/WebView/webkitwebframe.h \
-       WebKit/gtk/WebView/webkitwebview.h 
+       WebKit/gtk/webkit/webkit.h \
+       WebKit/gtk/webkit/webkitdefines.h \
+       WebKit/gtk/webkit/webkitnetworkrequest.h \
+       WebKit/gtk/webkit/webkitversion.h \
+       WebKit/gtk/webkit/webkitwebbackforwardlist.h \
+       WebKit/gtk/webkit/webkitwebframe.h \
+       WebKit/gtk/webkit/webkitwebhistoryitem.h \
+       WebKit/gtk/webkit/webkitwebinspector.h \
+       WebKit/gtk/webkit/webkitwebnavigationaction.h \
+       WebKit/gtk/webkit/webkitwebpolicydecision.h \
+       WebKit/gtk/webkit/webkitwebsettings.h \
+       WebKit/gtk/webkit/webkitwebwindowfeatures.h \
+       WebKit/gtk/webkit/webkitwebview.h
 
 webkitgtk_built_sources += \
-       WebKit/gtk/WebView/webkit-marshal.h \
-       WebKit/gtk/WebView/webkit-marshal.cpp
-
-webkitgtk_headers += \
-       WebKit/gtk/WebView/webkitprivate.h \
-       WebKit/gtk/WebView/webkitsettings.h \
-       WebKit/gtk/WebCoreSupport/ChromeClientGtk.h \
-       WebKit/gtk/WebCoreSupport/ContextMenuClientGtk.h \
-       WebKit/gtk/WebCoreSupport/DragClientGtk.h \
-       WebKit/gtk/WebCoreSupport/EditorClientGtk.h \
-       WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.h \
-       WebKit/gtk/WebCoreSupport/InspectorClientGtk.h \
-       WebKit/gtk/WebCoreSupport/PasteboardHelperGtk.h
+       DerivedSources/webkitenumtypes.cpp \
+       DerivedSources/webkitmarshal.cpp \
+       DerivedSources/webkitmarshal.h \
+       WebKit/gtk/webkit/webkitenumtypes.h
 
 webkitgtk_sources += \
-       WebKit/gtk/WebView/webkitnetworkrequest.cpp \
-       WebKit/gtk/WebView/webkitprivate.cpp \
-       WebKit/gtk/WebView/webkitsettings.cpp \
-       WebKit/gtk/WebView/webkitwebframe.cpp \
-       WebKit/gtk/WebView/webkitwebview.cpp \
        WebKit/gtk/WebCoreSupport/ChromeClientGtk.cpp \
+       WebKit/gtk/WebCoreSupport/ChromeClientGtk.h \
        WebKit/gtk/WebCoreSupport/ContextMenuClientGtk.cpp \
+       WebKit/gtk/WebCoreSupport/ContextMenuClientGtk.h \
        WebKit/gtk/WebCoreSupport/DragClientGtk.cpp \
+       WebKit/gtk/WebCoreSupport/DragClientGtk.h \
        WebKit/gtk/WebCoreSupport/EditorClientGtk.cpp \
+       WebKit/gtk/WebCoreSupport/EditorClientGtk.h \
        WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.cpp \
+       WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.h \
        WebKit/gtk/WebCoreSupport/InspectorClientGtk.cpp \
-       WebKit/gtk/WebCoreSupport/PasteboardHelperGtk.cpp 
+       WebKit/gtk/WebCoreSupport/InspectorClientGtk.h \
+       WebKit/gtk/WebCoreSupport/PasteboardHelperGtk.cpp \
+       WebKit/gtk/WebCoreSupport/PasteboardHelperGtk.h \
+       WebKit/gtk/webkit/webkitnetworkrequest.cpp \
+       WebKit/gtk/webkit/webkitprivate.cpp \
+       WebKit/gtk/webkit/webkitprivate.h \
+       WebKit/gtk/webkit/webkitversion.cpp \
+       WebKit/gtk/webkit/webkitwebbackforwardlist.cpp \
+       WebKit/gtk/webkit/webkitwebframe.cpp \
+       WebKit/gtk/webkit/webkitwebhistoryitem.cpp \
+       WebKit/gtk/webkit/webkitwebinspector.cpp \
+       WebKit/gtk/webkit/webkitwebnavigationaction.cpp \
+       WebKit/gtk/webkit/webkitwebpolicydecision.cpp \
+       WebKit/gtk/webkit/webkitwebsettings.cpp \
+       WebKit/gtk/webkit/webkitwebview.cpp \
+       WebKit/gtk/webkit/webkitwebwindowfeatures.cpp
+
+webkitgtk_cppflags += \
+       -DBUILDING_WEBKIT \
+       -I$(srcdir)/WebKit/gtk \
+       -I$(srcdir)/WebKit/gtk/WebCoreSupport \
+       -I$(srcdir)/WebKit/gtk/webkit \
+       -I$(top_builddir)/WebKit/gtk/webkit
 
 webkitgtk_cleanfiles += \
        $(top_builddir)/Programs/GtkLauncher \
-       $(top_builddir)/WebKit/gtk/WebKitGtk.pc
+       $(top_builddir)/WebKit/gtk/webkit-1.0.pc \
+       $(top_builddir)/WebKit/gtk/webkit/webkitenumtypes.h
 
 pkgconfigdir = $(libdir)/pkgconfig
-pkgconfig_DATA = WebKit/gtk/WebKitGtk.pc
-
-WEBKIT_MARSHAL = $(CURDIR)/WebKit/gtk/WebView/webkit-marshal
-WEBKIT_MARSHAL_LIST = $(srcdir)/WebKit/gtk/WebView/webkit-marshal.list
+pkgconfig_DATA = WebKit/gtk/webkit-1.0.pc
 
 stamp_files := \
-       stamp-webkit-marshal.cpp \
-       stamp-webkit-marshal.h
-
-WebKit/gtk/WebView/webkit-marshal.cpp: stamp-webkit-marshal.cpp
+       stamp-webkitmarshal.cpp \
+       stamp-webkitmarshal.h \
+       stamp-webkitenumtypes.cpp \
+       stamp-webkitenumtypes.h
+
+WEBKIT_MARSHAL = $(GENSOURCES)/webkitmarshal
+WEBKIT_MARSHAL_LIST = $(WEBKIT_MARSHAL).list
+
+$(WEBKIT_MARSHAL_LIST): $(webkitgtk_sources) GNUmakefile.am
+       ( cd $(top_srcdir) && \
+       sed -n -e 's/.*webkit_marshal_\([[:upper:][:digit:]]*__[[:upper:][:digit:]_]*\).*/\1/p' \
+       $(webkitgtk_sources) ) \
+       | sed -e 's/__/:/' -e 'y/_/,/' | sort -u > $@.tmp
+       if cmp -s $@.tmp $@; then \
+               rm $@.tmp; \
+       else \
+               mv $@.tmp $@; \
+       fi
+
+$(WEBKIT_MARSHAL).cpp: stamp-webkitmarshal.cpp
        @true
 
-WebKit/gtk/WebView/webkit-marshal.h: stamp-webkit-marshal.h
+$(WEBKIT_MARSHAL).h: stamp-webkitmarshal.h
        @true
 
-stamp-webkit-marshal.cpp: $(WEBKIT_MARSHAL_LIST)
+stamp-webkitmarshal.cpp: $(WEBKIT_MARSHAL_LIST)
        echo "extern \"C\" {" > $(WEBKIT_MARSHAL).cpp && \
        $(GLIB_GENMARSHAL) --prefix=webkit_marshal $(WEBKIT_MARSHAL_LIST) --body >> $(WEBKIT_MARSHAL).cpp && echo '}' >> $(WEBKIT_MARSHAL).cpp && \
        echo timestamp > $(@F)
 
-stamp-webkit-marshal.h: $(WEBKIT_MARSHAL_LIST)
+stamp-webkitmarshal.h: $(WEBKIT_MARSHAL_LIST)
        $(GLIB_GENMARSHAL) --prefix=webkit_marshal $(WEBKIT_MARSHAL_LIST) --header > $(WEBKIT_MARSHAL).h && \
        echo timestamp > $(@F)
 
+WebKit/gtk/webkit/webkitenumtypes.h: stamp-webkitenumtypes.h
+       @true
+stamp-webkitenumtypes.h: $(webkitgtk_h_api) GNUmakefile
+       (cd $(srcdir) \
+       && glib-mkenums \
+                       --fhead "#ifndef WEBKIT_ENUM_TYPES_H\n" \
+                       --fhead "#define WEBKIT_ENUM_TYPES_H\n\n" \
+                       --fhead "#include <glib-object.h>\n\n" \
+                       --fhead "#include <webkit/webkitdefines.h>\n\n" \
+                       --fhead "G_BEGIN_DECLS\n\n" \
+                       --ftail "G_END_DECLS\n\n" \
+                       --ftail "#endif\n" \
+                       --fprod "#include <@filename@>\n\n" \
+                       --eprod "#define WEBKIT_TYPE_@ENUMSHORT@ @enum_name@_get_type()\n\n" \
+                       --eprod "WEBKIT_API GType\n@enum_name@_get_type(void);\n\n" \
+               $(webkitgtk_h_api) | \
+               sed 's,WebKit/gtk/,,' | \
+               sed 's,web_kit,webkit,' | \
+               sed 's,WEBKIT_TYPE_KIT,WEBKIT_TYPE,' \
+               ) > xgen-gth \
+       && (cmp -s xgen-gth WebKit/gtk/webkit/webkitenumtypes.h || cp xgen-gth WebKit/gtk/webkit/webkitenumtypes.h) \
+       && rm -f xgen-gth \
+       && echo timestamp > $(@F)
+
+DerivedSources/webkitenumtypes.cpp: $(webkitgtk_h_api) GNUmakefile
+       (cd $(srcdir) \
+       && glib-mkenums \
+                       --fhead "#include <config.h>\n" \
+                       --fhead "#include <glib-object.h>\n" \
+                       --fhead "#include \"$(top_builddir)/WebKit/gtk/webkit/webkitenumtypes.h\"\n\n" \
+                       --fhead "extern \"C\" {\n\n" \
+                       --fprod "\n/* enumerations from \"@filename@\" */" \
+                       --vhead "static const G@Type@Value _@enum_name@_values[] = {" \
+                       --vprod "    { @VALUENAME@, \"@VALUENAME@\", \"@valuenick@\" }," \
+                       --vtail "    { 0, NULL, NULL }\n};\n\n" \
+                       --vtail "GType @enum_name@_get_type(void)\n{\n" \
+                       --vtail "    static GType type = 0;\n\n" \
+                       --vtail "    if (!type)\n" \
+                       --vtail "        type = g_@type@_register_static(\"@EnumName@\", _@enum_name@_values);\n\n" \
+                       --vtail "    return type;\n}\n\n" \
+                       --ftail "}\n" \
+               $(webkitgtk_h_api) | \
+               sed 's,web_kit,webkit,' \
+               ) > xgen-gtc \
+       && cp xgen-gtc $@ \
+       && rm -f xgen-gtc
+
 # END WEBKIT GTK+
+#
+# Files that will be distributed
+EXTRA_DIST = \
+       WebKit/LICENSE \
+       $(javascriptcore_dist) \
+       $(webcore_dist) \
+       symbols.filter
 
 # Files that will be cleaned
 MAINTAINERCLEANFILES := $(stamp_files) $(BUILT_SOURCES)
-DISTCLEANFILES := $(stamp_files) $(BUILT_SOURCES)
+DISTCLEANFILES := $(stamp_files) $(BUILT_SOURCES) doltcompile doltlibtool
 CLEANFILES := $(stamp_files) $(BUILT_SOURCES)
 
 # Include module makefiles
@@ -293,6 +467,27 @@ include JavaScriptCore/GNUmakefile.am
 include WebCore/GNUmakefile.am
 include WebKitTools/GNUmakefile.am
 
+# Build unit test
+noinst_PROGRAMS += Programs/UnitTests
+Programs_UnitTests_CPPFLAGS = \
+       -I$(srcdir)/WebKit/gtk \
+       -I$(top_builddir)/WebKit/gtk \
+       $(global_cppflags) \
+       $(javascriptcore_cppflags)
+
+Programs_UnitTests_SOURCES = \
+       WebKit/gtk/tests/main.c
+
+Programs_UnitTests_CFLAGS = \
+       -fno-strict-aliasing \
+       -O2 \
+       $(global_cflags) \
+       $(GLIB_CFLAGS) \
+       $(GTK_CFLAGS)
+
+Programs_UnitTests_LDADD = \
+       libwebkit-1.0.la \
+       $(GTK_LIBS)
 
 # Autogenerated sources
 BUILT_SOURCES := \
@@ -305,11 +500,7 @@ BUILT_SOURCES := \
 
 # Project-wide clean rules
 CLEANFILES += \
-       $(webkitgtk_cleanfiles) \
-       $(top_builddir)/Programs/DumpRenderTree \
-       $(top_builddir)/Programs/testkjs \
-       $(top_builddir)/Programs/dftables \
-       $(GENSOURCES)
+       $(webkitgtk_cleanfiles)
 
 MAINTAINERCLEANFILES += \
        $(srcdir)/aconfig.h.in \
@@ -318,3 +509,12 @@ MAINTAINERCLEANFILES += \
        GNUmakefile.in \
        INSTALL \
        README
+
+# Older automake versions (1.7) place Plo files in a different place so we need
+# to create the output directory manually.
+all-local:
+       mkdir -p $(top_builddir)/$(DEPDIR)/DerivedSources
+
+# remove built sources and program directories
+clean-local:
+       -rm -rf $(GENSOURCES) $(GENPROGRAMS)