gecko/toolkit/library/Makefile.in
2013-11-28 14:24:05 +09:00

443 lines
10 KiB
Makefile

# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
# You can obtain one at http://mozilla.org/MPL/2.0/.
MOZILLA_INTERNAL_API = 1
ifeq ($(MOZ_WIDGET_TOOLKIT),cocoa)
# This is going to be a framework named "XUL", not an ordinary library named
# "libxul.dylib"
SHARED_LIBRARY_NAME=XUL
# Setting MAKE_FRAMEWORK makes DLL_PREFIX and DLL_SUFFIX be ignored when
# setting SHARED_LIBRARY; we need to leave DLL_PREFIX and DLL_SUFFIX
# as-is so that dependencies of the form -ltracemalloc still work.
MAKE_FRAMEWORK=1
endif
VPATH += $(topsrcdir)/build/
ifdef MOZ_CONTENT_SANDBOX
ifeq ($(OS_ARCH),WINNT)
LOCAL_INCLUDES += -I$(srcdir)/../sandboxbroker
SHARED_LIBRARY_LIBS += ../../security/sandbox/win/src/sandboxbroker/$(LIB_PREFIX)sandboxbroker.$(LIB_SUFFIX)
endif
endif
# COMPONENT_LIBS is mosly useless since bug 935881, but is kept for
# MOZ_APP_COMPONENT_LIBS, used by comm-central, and gtest linking.
SHARED_LIBRARY_LIBS += \
$(foreach component,$(COMPONENT_LIBS),$(DEPTH)/staticlib/$(LIB_PREFIX)$(component).$(LIB_SUFFIX)) \
$(NULL)
ifeq ($(OS_ARCH)_$(GNU_CC),WINNT_)
RCINCLUDE = xulrunner.rc
LOCAL_INCLUDES += -I$(topsrcdir)/widget/windows
LOCAL_INCLUDES += -I$(topsrcdir)/xpcom/base
endif
ifeq ($(OS_ARCH),OS2)
RESFILE = xulrunos2.res
RCFLAGS += -i $(topsrcdir)/widget/os2
LOCAL_INCLUDES += -I$(topsrcdir)/widget/os2
LOCAL_INCLUDES += -I$(topsrcdir)/xpcom/base
endif
# dependent libraries
ifdef MOZ_B2G_BT_BLUEZ #{
ifeq (gonk,$(MOZ_WIDGET_TOOLKIT))
OS_LIBS += -ldbus
endif
endif #}
ifdef MOZ_B2G_CAMERA #{
OS_LIBS += -lstagefright -lstagefright_omx
endif #}
ifeq (Linux,$(OS_ARCH))
ifneq (Android,$(OS_TARGET))
OS_LIBS += -lrt
EXTRA_DSO_LDOPTS += -Wl,-version-script,symverscript
symverscript: symverscript.in
$(call py_action,preprocessor, \
-DVERSION="$(LIBRARY_NAME)$(MOZILLA_SYMBOLVERSION)" $< -o $@)
EXTRA_DEPS += symverscript
endif
endif
# component libraries
ifdef MOZ_JSDEBUGGER
DEFINES += -DMOZ_JSDEBUGGER
endif
ifdef MOZ_PREF_EXTENSIONS
DEFINES += -DMOZ_PREF_EXTENSIONS
endif
ifdef MOZ_AUTH_EXTENSION
DEFINES += -DMOZ_AUTH_EXTENSION
endif
ifdef MOZ_PERMISSIONS
DEFINES += -DMOZ_PERMISSIONS
endif
ifdef MOZ_UNIVERSALCHARDET
DEFINES += -DMOZ_UNIVERSALCHARDET
endif
ifeq (,$(filter android gonk qt os2 cocoa windows,$(MOZ_WIDGET_TOOLKIT)))
ifdef MOZ_XUL
DEFINES += -DMOZ_FILEVIEW
endif
endif
# Platform-specific icon channel stuff - supported mostly-everywhere
ifneq (,$(filter windows os2 mac cocoa gtk2 gtk3 qt android,$(MOZ_WIDGET_TOOLKIT)))
DEFINES += -DICON_DECODER
endif
ifdef MOZ_SPELLCHECK
DEFINES += -DMOZ_SPELLCHECK
endif
ifdef MOZ_ZIPWRITER
DEFINES += -DMOZ_ZIPWRITER
endif
ifdef MOZ_GIO_COMPONENT
DEFINES += -DMOZ_GIO_COMPONENT
endif
ifdef MOZ_APP_COMPONENT_LIBS
COMPONENT_LIBS += $(MOZ_APP_COMPONENT_LIBS)
endif
ifeq ($(MOZ_WIDGET_TOOLKIT),cocoa)
OS_LIBS += -framework OpenGL -lcups
endif
EXTRA_DSO_LDOPTS += \
$(LIBS_DIR) \
$(MOZ_JS_LIBS) \
$(NSS_LIBS) \
$(MOZ_CAIRO_OSLIBS) \
$(MOZ_APP_EXTRA_LIBS) \
$(SQLITE_LIBS) \
$(NULL)
ifdef MOZ_NATIVE_JPEG
EXTRA_DSO_LDOPTS += $(MOZ_JPEG_LIBS)
endif
ifdef MOZ_NATIVE_PNG
EXTRA_DSO_LDOPTS += $(MOZ_PNG_LIBS)
endif
ifneq (WINNT,$(OS_ARCH))
EXTRA_DSO_LDOPTS += $(MOZ_ZLIB_LIBS)
endif
ifdef MOZ_NATIVE_HUNSPELL
EXTRA_DSO_LDOPTS += $(MOZ_HUNSPELL_LIBS)
endif
ifdef MOZ_NATIVE_LIBEVENT
EXTRA_DSO_LDOPTS += $(MOZ_LIBEVENT_LIBS)
endif
ifdef MOZ_NATIVE_LIBVPX
EXTRA_DSO_LDOPTS += $(MOZ_LIBVPX_LIBS)
endif
ifndef MOZ_TREE_PIXMAN
EXTRA_DSO_LDOPTS += $(MOZ_PIXMAN_LIBS)
endif
ifdef MOZ_DMD
EXTRA_DSO_LDOPTS += $(call EXPAND_LIBNAME_PATH,dmd,$(DIST)/lib)
endif
EXTRA_DSO_LDOPTS += $(call EXPAND_LIBNAME_PATH,gkmedias,$(DIST)/lib)
ifdef MOZ_WEBRTC
ifdef MOZ_WEBRTC_SIGNALING
SHARED_LIBRARY_LIBS += \
$(DEPTH)/media/webrtc/signaling/signaling_ecc/$(LIB_PREFIX)ecc.$(LIB_SUFFIX) \
$(DEPTH)/media/webrtc/signaling/signaling_sipcc/$(LIB_PREFIX)sipcc.$(LIB_SUFFIX) \
$(NULL)
endif
ifeq (WINNT,$(OS_TARGET))
EXTRA_DSO_LDOPTS += \
-LIBPATH:"$(MOZ_DIRECTX_SDK_PATH)/lib/$(MOZ_DIRECTX_SDK_CPU_SUFFIX)" \
$(NULL)
OS_LIBS += $(call EXPAND_LIBNAME,secur32 crypt32 iphlpapi strmiids dmoguids wmcodecdspuuid amstrmid msdmo wininet)
endif
endif
ifdef MOZ_CUBEB
ifdef MOZ_ALSA
EXTRA_DSO_LDOPTS += $(MOZ_ALSA_LIBS)
endif
endif
ifdef HAVE_CLOCK_MONOTONIC
EXTRA_DSO_LDOPTS += $(REALTIME_LIBS)
endif
ifeq (android,$(MOZ_WIDGET_TOOLKIT))
OS_LIBS += -lGLESv2
endif
ifeq (gonk,$(MOZ_WIDGET_TOOLKIT))
OS_LIBS += \
-lui \
-lmedia \
-lhardware_legacy \
-lhardware \
-lutils \
-lcutils \
-lsysutils \
-lcamera_client \
-lsensorservice \
-lstagefright \
-lstagefright_foundation \
-lstagefright_omx \
-lbinder \
-lgui \
$(NULL)
endif
ifneq (,$(filter rtsp,$(NECKO_PROTOCOLS)))
OS_LIBS += -lstagefright_foundation
endif
ifdef MOZ_WMF
OS_LIBS += $(call EXPAND_LIBNAME,mfuuid wmcodecdspuuid strmiids)
endif
ifdef MOZ_DIRECTSHOW
OS_LIBS += $(call EXPAND_LIBNAME,dmoguids wmcodecdspuuid strmiids msdmo)
endif
ifneq (,$(filter OS2 WINNT,$(OS_ARCH)))
SDK_LIBRARY = $(IMPORT_LIBRARY)
else
SDK_LIBRARY = $(SHARED_LIBRARY)
endif
EXTRA_DSO_LDOPTS += $(LIBS_DIR)
EXTRA_DSO_LDOPTS += $(NSPR_LIBS) $(MOZALLOC_LIB)
ifeq ($(MOZ_WIDGET_TOOLKIT),cocoa)
CXXFLAGS += $(TK_CFLAGS)
OS_LIBS += \
-framework SystemConfiguration \
-framework QTKit \
-framework IOKit \
-F$(MACOS_PRIVATE_FRAMEWORKS_DIR) -framework CoreUI \
$(TK_LIBS) \
$(NULL)
endif
ifeq (OpenBSD,$(OS_ARCH))
ifdef MOZ_CUBEB
EXTRA_DSO_LDOPTS += -lsndio
endif
endif
ifdef MOZ_ENABLE_DBUS
EXTRA_DSO_LDOPTS += $(MOZ_DBUS_GLIB_LIBS)
endif
ifdef MOZ_WIDGET_GTK
EXTRA_DSO_LDOPTS += $(TK_LIBS)
EXTRA_DSO_LDOPTS += $(XLDFLAGS) $(XLIBS) $(XEXT_LIBS) $(XCOMPOSITE_LIBS) $(MOZ_PANGO_LIBS) $(XT_LIBS) -lgthread-2.0
EXTRA_DSO_LDOPTS += $(FT2_LIBS)
endif
ifeq (qt,$(MOZ_WIDGET_TOOLKIT))
EXTRA_DSO_LDOPTS += $(XLDFLAGS) $(XLIBS) $(XT_LIBS) $(MOZ_QT_LIBS)
EXTRA_DSO_LDOPTS += $(FT2_LIBS) $(MOZ_PANGO_LIBS)
endif
ifdef MOZ_TREE_FREETYPE
EXTRA_DSO_LDOPTS += $(FT2_LIBS)
endif
ifdef MOZ_ENABLE_STARTUP_NOTIFICATION
EXTRA_DSO_LDOPTS += $(MOZ_STARTUP_NOTIFICATION_LIBS)
endif
ifdef MOZ_ENABLE_LIBPROXY
EXTRA_DSO_LDOPTS += $(MOZ_LIBPROXY_LIBS)
endif
ifeq ($(OS_ARCH),SunOS)
ifdef GNU_CC
EXTRA_DSO_LDOPTS += -lelf
else
EXTRA_DSO_LDOPTS += -lelf -ldemangle
endif
endif
ifneq (,$(filter DragonFly FreeBSD NetBSD OpenBSD,$(OS_ARCH)))
OS_LIBS += $(call EXPAND_LIBNAME,kvm)
# keep `environ' unresolved, see bug 14426 for binutils
EXTRA_DSO_LDOPTS += -Wl,--warn-unresolved-symbols
endif
ifeq ($(OS_ARCH),WINNT)
OS_LIBS += $(call EXPAND_LIBNAME,shell32 ole32 version winspool comdlg32 imm32 msimg32 shlwapi psapi ws2_32 dbghelp rasapi32 rasdlg iphlpapi uxtheme setupapi secur32 sensorsapi portabledeviceguids windowscodecs wininet wbemuuid)
ifdef ACCESSIBILITY
OS_LIBS += $(call EXPAND_LIBNAME,oleacc)
endif
ifdef MOZ_METRO
OS_LIBS += $(call EXPAND_LIBNAME,uiautomationcore runtimeobject)
endif
ifdef _MSC_VER
OS_LIBS += $(call EXPAND_LIBNAME,delayimp)
EXTRA_DSO_LDOPTS += \
-DELAYLOAD:psapi.dll \
-DELAYLOAD:dbghelp.dll \
-DELAYLOAD:rasapi32.dll \
-DELAYLOAD:rasdlg.dll \
-DELAYLOAD:comdlg32.dll \
-DELAYLOAD:winspool.drv \
-DELAYLOAD:secur32.dll \
-DELAYLOAD:wininet.dll \
$(NULL)
# See nsDllMain for an explanation
ifdef MOZ_METRO
ifdef MOZ_DEBUG
EXTRA_DSO_LDOPTS += -DELAYLOAD:VCCORLIB$(CRTDLLVERSION)D.DLL
else
EXTRA_DSO_LDOPTS += -DELAYLOAD:VCCORLIB$(CRTDLLVERSION).DLL
endif
EXTRA_DSO_LDOPTS += -DELAYLOAD:API-MS-WIN-CORE-WINRT-L$(CRTEXPDLLVERSION).DLL
EXTRA_DSO_LDOPTS += -DELAYLOAD:API-MS-WIN-CORE-WINRT-STRING-L$(CRTEXPDLLVERSION).DLL
EXTRA_DSO_LDOPTS += -DELAYLOAD:uiautomationcore.dll
endif
ifdef ACCESSIBILITY
EXTRA_DSO_LDOPTS += -DELAYLOAD:oleacc.dll
endif
ifdef MOZ_WEBRTC
EXTRA_DSO_LDOPTS += -DELAYLOAD:msdmo.dll
endif
endif
ifdef MOZ_GAMEPAD
ifndef GNU_CC
DXSDK := $(subst \,/,$(MOZ_DIRECTX_SDK_PATH))/Lib/$(MOZ_DIRECTX_SDK_CPU_SUFFIX)
OS_LIBS += \
"$(DXSDK)/dxguid.lib" \
"$(DXSDK)/dinput8.lib" \
$(NULL)
else
OS_LIBS += $(call EXPAND_LIBNAME,dxguid dinput8)
endif
endif
endif # WINNT
ifdef MOZ_JPROF
EXTRA_DSO_LDOPTS += -ljprof
endif
ifdef MOZ_ENABLE_QT
EXTRA_DSO_LDOPTS += $(MOZ_QT_LDFLAGS) $(XEXT_LIBS)
endif
ifeq (cocoa,$(MOZ_WIDGET_TOOLKIT))
ifdef MOZ_GSTREAMER
EXTRA_DSO_LDOPTS += $(GSTREAMER_LIBS)
endif
endif
# Generate GDB pretty printer-autoload files only on Linux. OSX's GDB is
# too old to support Python pretty-printers; if this changes, we could make
# this 'ifdef GNU_CC'.
ifeq (Linux,$(OS_ARCH))
# Create a GDB Python auto-load file alongside the libxul shared library in
# the build directory.
PP_TARGETS += LIBXUL_AUTOLOAD
LIBXUL_AUTOLOAD = libxul.so-gdb.py.in
LIBXUL_AUTOLOAD_FLAGS := -Dtopsrcdir=$(abspath $(topsrcdir))
endif
ifdef MAKE_FRAMEWORK
EFFECTIVE_LIB_PREFIX=
EFFECTIVE_LIB_SUFFIX=
else
EFFECTIVE_LIB_PREFIX=$(DLL_PREFIX)
EFFECTIVE_LIB_SUFFIX=$(DLL_SUFFIX)
endif
GTEST_LIB = $(EFFECTIVE_LIB_PREFIX)gtest/$(EFFECTIVE_LIB_PREFIX)$(SHARED_LIBRARY_NAME)$(EFFECTIVE_LIB_SUFFIX)
EXTRA_MDDEPEND_FILES = $(GTEST_LIB).pp
include $(topsrcdir)/config/rules.mk
# need widget/windows for resource.h (included from widget.rc)
LOCAL_INCLUDES += \
-I$(topsrcdir)/config \
-I$(topsrcdir)/widget/windows \
$(NULL)
OS_LIBS += $(LIBICONV)
ifeq ($(MOZ_WIDGET_TOOLKIT),windows)
OS_LIBS += $(call EXPAND_LIBNAME,usp10 oleaut32)
endif
ifdef MOZ_DEBUG
ifdef ENABLE_TESTS
DEFINES += -DENABLE_LAYOUTDEBUG
endif
endif
ifeq (WINNT_1,$(OS_TARGET)_$(MOZ_PROFILE_USE))
# Wrap linker to measure peak virtual memory usage.
LD := $(PYTHON) $(topsrcdir)/build/link.py $(CURDIR)/linker-vsize $(LD)
endif
ifndef LINK_GTEST
ifdef COMPILE_ENVIRONMENT
libs:: $(FINAL_TARGET)/dependentlibs.list
endif
endif
.PHONY: gtestxul
$(FINAL_TARGET)/dependentlibs.list.gtest: $(FINAL_TARGET)/dependentlibs.list
sed -e "s|$(SHARED_LIBRARY)|gtest/$(SHARED_LIBRARY)|" $< > $@
# Remove this target when actually linking gtest to prevent redefining
# the implicit rules.mk target
ifndef LINK_GTEST
gtestxul: $(GTEST_LIB)
$(GTEST_LIB): $(FINAL_TARGET)/dependentlibs.list.gtest
$(MKDIR) -p $(EFFECTIVE_LIB_PREFIX)gtest
$(MAKE) libs SHARED_LIBRARY_NAME=gtest/$(EFFECTIVE_LIB_PREFIX)$(LIBRARY_NAME) FINAL_TARGET=$(FINAL_TARGET)/gtest SDK_LIBRARY= IMPORT_LIB_DEST=$(IMPORT_LIB_DEST)/gtest LINK_GTEST=true
endif
ifdef LINK_GTEST
COMPONENT_LIBS += \
gtest \
gfxtest \
ssltest \
$(NULL)
endif
$(FINAL_TARGET)/dependentlibs.list: dependentlibs.py $(SHARED_LIBRARY) $(wildcard $(if $(wildcard $(FINAL_TARGET)/dependentlibs.list),$(addprefix $(FINAL_TARGET)/,$(shell cat $(FINAL_TARGET)/dependentlibs.list))))
$(PYTHON) $< $(SHARED_LIBRARY) -L $(FINAL_TARGET) $(if $(TOOLCHAIN_PREFIX),$(addprefix -p ,$(TOOLCHAIN_PREFIX))) > $@