Bug 470455 - test_database_sync_embed_visits.js leaks, r=sdwilsh
[wine-gecko.git] / embedding / componentlib / Makefile.in
blob18e5f56afe8d63ec6177985599bab9d1bb685ca0
2 # ***** BEGIN LICENSE BLOCK *****
3 # Version: MPL 1.1/GPL 2.0/LGPL 2.1
5 # The contents of this file are subject to the Mozilla Public License Version
6 # 1.1 (the "License"); you may not use this file except in compliance with
7 # the License. You may obtain a copy of the License at
8 # http://www.mozilla.org/MPL/
10 # Software distributed under the License is distributed on an "AS IS" basis,
11 # WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12 # for the specific language governing rights and limitations under the
13 # License.
15 # The Original Code is mozilla.org code.
17 # The Initial Developer of the Original Code is
18 # Netscape Communications Corporation.
19 # Portions created by the Initial Developer are Copyright (C) 1998
20 # the Initial Developer. All Rights Reserved.
22 # Contributor(s):
24 # Alternatively, the contents of this file may be used under the terms of
25 # either the GNU General Public License Version 2 or later (the "GPL"), or
26 # the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
27 # in which case the provisions of the GPL or the LGPL are applicable instead
28 # of those above. If you wish to allow use of your version of this file only
29 # under the terms of either the GPL or the LGPL, and not to allow others to
30 # use your version of this file under the terms of the MPL, indicate your
31 # decision by deleting the provisions above and replace them with the notice
32 # and other provisions required by the GPL or the LGPL. If you do not delete
33 # the provisions above, a recipient may use your version of this file under
34 # the terms of any one of the MPL, the GPL or the LGPL.
36 # ***** END LICENSE BLOCK *****
38 DEPTH = ../..
39 topsrcdir = @top_srcdir@
40 srcdir = @srcdir@
41 VPATH = @srcdir@
43 include $(DEPTH)/config/autoconf.mk
45 REQUIRES = xpcom \
46 $(NULL)
48 LOCAL_INCLUDES = -I$(srcdir)
50 include $(topsrcdir)/config/config.mk
52 _FINAL_COMPONENT_NAMES := $(shell cat $(FINAL_LINK_COMP_NAMES))
53 _FINAL_COMPONENT_LIBS := $(shell cat $(FINAL_LINK_COMPS))
54 _FINAL_LINK_LIBS := $(shell cat $(FINAL_LINK_LIBS))
55 _META_COMPONENT_NAMES := _FINAL_COMPONENT_NAMES
56 _META_COMPONENT_LIBS := _FINAL_COMPONENT_LIBS
57 _META_DEP_LIBS := _FINAL_LINK_LIBS
59 LIBRARY_NAME = mozcomps
60 CPPSRCS = nsMetaModule_mozcomps.cpp
62 include $(topsrcdir)/config/static-config.mk
64 EXTRA_DSO_LIBS = $(STATIC_EXTRA_DSO_LIBS)
66 # See explanation below.
67 ifeq ($(OS_ARCH),Darwin)
68 EXTRA_DEPS = force_data_segment.o exported_symbols
69 endif
71 FORCE_SHARED_LIB = 1
73 include $(topsrcdir)/config/rules.mk
74 include $(topsrcdir)/config/static-rules.mk
76 # Force XPCOM_TRANSLATE_NSGM_ENTRY_POINT to be defined so the macros
77 # in nsIGenericFactory.h will come out in the wash.
78 DEFINES += -DMETA_MODULE=\"$(LIBRARY_NAME)\" -DXPCOM_TRANSLATE_NSGM_ENTRY_POINT
80 # We don't want to link mozcomps against NSS if not necessary
81 ifneq (,$(findstring crypto,$(MOZ_META_COMPONENTS)))
82 STATIC_EXTRA_LIBS := $(filter-out $(NSS_LIBS),$(STATIC_EXTRA_LIBS))
83 endif
85 EXTRA_DSO_LDOPTS += \
86 $(LIBS_DIR) \
87 $(EXTRA_DSO_LIBS) \
88 $(STATIC_EXTRA_LIBS) \
89 $(MOZ_JS_LIBS) \
90 $(MOZ_UNICHARUTIL_LIBS) \
91 $(MOZ_COMPONENT_LIBS) \
92 $(TK_LIBS) \
93 $(NULL)
95 ifeq ($(MOZ_WIDGET_TOOLKIT),cocoa)
96 OS_LIBS += -framework QuickTime
97 endif
99 ifeq ($(OS_ARCH),Darwin)
101 # A limitation exists in the Mach-O format which causes "scattered" relocation
102 # entries in shared libraries to be limited to a 24-bit address space (16 MB).
103 # The high 8 bits of the address are dropped. This can cause problems in
104 # a mozcomps build, particularly non-optimized builds. To avoid the problem,
105 # we move the data segment before the code segment in the libraray. The data
106 # segment is relatively small, and all of the relocations in question
107 # (which are pointers to construction vtables) reside in the
108 # (__DATA,__const) section.
110 # See also the 5th item in the TODO section of:
111 # http://www.opensource.apple.com/darwinsource/10.2.6/cctools/ld/notes
112 # (free APSL registration required)
115 # Generate a .o file with only a data segment, which we'll link as the first
116 # object file in the library. That will cause the data segment to be first.
118 force_data_segment.o:
119 ld -sectcreate __DATA __const /dev/null -noseglinkedit -arch ppc -o $@
121 exported_symbols:
122 echo _nsMetaModule_nsGetModule > $@
124 # We have to invoke ld directly so that force_data_segment.o can be linked
125 # before dylib1.o
126 MKSHLIB = $(LD) $(DSO_LDOPTS) -o $@
128 # force it to be first
129 SHLIB_LDSTARTFILE = force_data_segment.o -ldylib1.o
131 # translate gcc link options to corresponding ld options
132 EXTRA_DSO_LDOPTS := $(subst -dynamiclib,-dylib,$(EXTRA_DSO_LDOPTS))
133 EXTRA_DSO_LDOPTS := $(subst install_name,dylib_install_name,$(EXTRA_DSO_LDOPTS))
134 EXTRA_DSO_LDOPTS := $(subst compatibility_version,dylib_compatibility_version,$(EXTRA_DSO_LDOPTS))
135 EXTRA_DSO_LDOPTS := $(subst current_version,dylib_current_version,$(EXTRA_DSO_LDOPTS))
137 # It would be nice to limit the exported symbols here, but doing so exposes a
138 # bug in the linker that causes some C++ static initializers not to run after
139 # prebinding is updated at runtime (reported as Radar bug 3268595).
140 #EXTRA_DSO_LDOPTS += -exported_symbols_list exported_symbols
142 OS_LIBS := -lstdc++ $(OS_LIBS)
143 SHLIB_LDENDFILE = -lgcc
145 endif # darwin
147 ifeq ($(OS_ARCH),WINNT)
148 OS_LIBS += ole32.lib shell32.lib
149 endif
151 ifeq ($(OS_ARCH),BeOS)
152 OS_LIBS += -ltracker
153 endif
155 GARBAGE += $(CPPSRCS)
157 ifdef _NO_AUTO_VARS
158 _TARGET = $(srcdir)/$(@F)
159 GARBAGE += $(addprefix $(srcdir)/,$(CPPSRCS))
160 else
161 _TARGET = $@
162 endif
164 nsMetaModule_%.cpp: nsMetaModule.cpp.in $(GLOBAL_DEPS) $(topsrcdir)/config/config.mk
165 rm -f $@
166 cat $< | \
167 sed -e "s|%DECLARE_SUBMODULE_INFOS%|$(foreach m, $($(_META_COMPONENT_NAMES)), extern nsModuleInfo NSMODULEINFO($(m));)|" | \
168 sed -e "s|%SUBMODULE_INFOS%|$(foreach m, $($(_META_COMPONENT_NAMES)), \\& NSMODULEINFO($(m)),)|" \
169 > $(_TARGET)