Bug 568276: Check for strange-variable-combination regression. (r=brendan)
[mozilla-central.git] / browser / app / Makefile.in
blob43eab50cf34fc26359853302fb589bc7485c50f0
1 # ***** BEGIN LICENSE BLOCK *****
2 # Version: MPL 1.1/GPL 2.0/LGPL 2.1
4 # The contents of this file are subject to the Mozilla Public License Version
5 # 1.1 (the "License"); you may not use this file except in compliance with
6 # the License. You may obtain a copy of the License at
7 # http://www.mozilla.org/MPL/
9 # Software distributed under the License is distributed on an "AS IS" basis,
10 # WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
11 # for the specific language governing rights and limitations under the
12 # License.
14 # The Original Code is mozilla.org code.
16 # The Initial Developer of the Original Code is
17 # Netscape Communications.
18 # Portions created by the Initial Developer are Copyright (C) 2001
19 # the Initial Developer. All Rights Reserved.
21 # Contributor(s):
22 # Brian Ryner <bryner@brianryner.com>
23 # Jonathan Wilson <jonwil@tpgi.com.au>
24 # Dan Mosedale <dmose@mozilla.org>
25 # Benjamin Smedberg <benjamin@smedbergs.us>
27 # Alternatively, the contents of this file may be used under the terms of
28 # either the GNU General Public License Version 2 or later (the "GPL"), or
29 # the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
30 # in which case the provisions of the GPL or the LGPL are applicable instead
31 # of those above. If you wish to allow use of your version of this file only
32 # under the terms of either the GPL or the LGPL, and not to allow others to
33 # use your version of this file under the terms of the MPL, indicate your
34 # decision by deleting the provisions above and replace them with the notice
35 # and other provisions required by the GPL or the LGPL. If you do not delete
36 # the provisions above, a recipient may use your version of this file under
37 # the terms of any one of the MPL, the GPL or the LGPL.
39 # ***** END LICENSE BLOCK *****
41 DEPTH = ../..
42 topsrcdir = @top_srcdir@
43 srcdir = @srcdir@
44 VPATH = @srcdir@
46 include $(DEPTH)/config/autoconf.mk
48 DIRS = profile/extensions
50 PREF_JS_EXPORTS = $(srcdir)/profile/firefox.js \
51 $(srcdir)/profile/channel-prefs.js \
52 $(NULL)
55 # hardcode en-US for the moment
56 AB_CD = en-US
58 DEFINES += -DAB_CD=$(AB_CD)
60 APP_VERSION = $(shell cat $(srcdir)/../config/version.txt)
61 DEFINES += -DAPP_VERSION="$(APP_VERSION)"
63 DIST_FILES = application.ini
65 GRE_MILESTONE = $(shell $(PYTHON) $(topsrcdir)/config/printconfigsetting.py $(LIBXUL_DIST)/bin/platform.ini Build Milestone)
66 GRE_BUILDID = $(shell $(PYTHON) $(topsrcdir)/config/printconfigsetting.py $(LIBXUL_DIST)/bin/platform.ini Build BuildID)
68 DEFINES += -DGRE_MILESTONE=$(GRE_MILESTONE) -DGRE_BUILDID=$(GRE_BUILDID)
70 MOZ_SOURCE_STAMP ?= $(shell hg -R $(topsrcdir) parent --template="{node|short}\n" 2>/dev/null)
71 ifdef MOZ_SOURCE_STAMP
72 DEFINES += -DMOZ_SOURCE_STAMP="$(MOZ_SOURCE_STAMP)"
73 endif
75 SOURCE_REPO := $(shell hg -R $(topsrcdir) showconfig paths.default 2>/dev/null | sed -e "s/^ssh:/http:/")
76 ifdef SOURCE_REPO
77 DEFINES += -DMOZ_SOURCE_REPO="$(SOURCE_REPO)"
78 endif
80 LIBS += $(JEMALLOC_LIBS)
82 ifdef LIBXUL_SDK
83 include $(topsrcdir)/config/rules.mk
84 else
85 # Build a binary bootstrapping with XRE_main
87 ifneq (,$(filter OS2 WINCE WINNT,$(OS_ARCH)))
88 PROGRAM = $(MOZ_APP_NAME)$(BIN_SUFFIX)
89 else
90 PROGRAM = $(MOZ_APP_NAME)-bin$(BIN_SUFFIX)
91 endif
93 CPPSRCS = nsBrowserApp.cpp
95 LOCAL_INCLUDES += -I$(topsrcdir)/toolkit/xre
97 ifdef BUILD_STATIC_LIBS
98 ifdef _MSC_VER
99 STATIC_COMPONENTS_LINKER_PATH = -LIBPATH:$(DEPTH)/staticlib
100 else
101 STATIC_COMPONENTS_LINKER_PATH = -L$(DEPTH)/staticlib
102 endif
103 LIBS += $(DEPTH)/toolkit/xre/$(LIB_PREFIX)xulapp_s.$(LIB_SUFFIX)
104 else
105 ifeq (cocoa,$(MOZ_WIDGET_TOOLKIT))
106 LIBS += $(DIST)/bin/XUL
107 else
108 EXTRA_DSO_LIBS += xul
109 endif
110 endif
112 ifeq (cocoa,$(MOZ_WIDGET_TOOLKIT))
113 TK_LIBS := $(TK_LIBS)
114 endif
116 ifdef MOZ_ENABLE_LIBXUL
117 APP_XPCOM_LIBS = $(XPCOM_GLUE_LDOPTS)
118 else
119 MOZILLA_INTERNAL_API = 1
120 APP_XPCOM_LIBS = $(XPCOM_LIBS)
121 endif
123 LIBS += \
124 $(STATIC_COMPONENTS_LINKER_PATH) \
125 $(EXTRA_DSO_LIBS) \
126 $(MOZ_JS_LIBS) \
127 $(APP_XPCOM_LIBS) \
128 $(NSPR_LIBS) \
129 $(TK_LIBS) \
130 $(NULL)
132 # Add explicit X11 dependency when building against X11 toolkits
133 ifneq (,$(filter gtk2,$(MOZ_WIDGET_TOOLKIT)))
134 LIBS += $(XLDFLAGS) $(XLIBS) $(ZLIB_LIBS)
135 endif
137 ifdef MOZ_JPROF
138 LIBS += -ljprof
139 endif
141 ifndef MOZ_WINCONSOLE
142 ifdef MOZ_DEBUG
143 MOZ_WINCONSOLE = 1
144 else
145 MOZ_WINCONSOLE = 0
146 endif
147 endif
149 # This switches $(INSTALL) to copy mode, like $(SYSINSTALL), so things that
150 # shouldn't get 755 perms need $(IFLAGS1) for either way of calling nsinstall.
151 NSDISTMODE = copy
153 include $(topsrcdir)/config/config.mk
155 ifdef _MSC_VER
156 # Always enter a Windows program through wmain, whether or not we're
157 # a console application.
158 ifdef WINCE
159 WIN32_EXE_LDFLAGS += -ENTRY:mainWCRTStartup
160 else
161 WIN32_EXE_LDFLAGS += -ENTRY:wmainCRTStartup
162 endif
163 endif
165 ifdef WINCE
166 EXTRA_DSO_LDOPTS += $(call EXPAND_LIBNAME,corelibc)
167 endif
169 ifdef BUILD_STATIC_LIBS
170 include $(topsrcdir)/config/static-config.mk
172 EXTRA_DEPS += \
173 $(STATIC_EXTRA_DEPS) \
174 $(NULL)
175 DEFINES += $(STATIC_DEFINES)
176 CPPSRCS += $(STATIC_CPPSRCS)
177 EXTRA_DSO_LIBS += $(STATIC_EXTRA_DSO_LIBS)
178 EXTRA_LIBS += $(STATIC_EXTRA_LIBS)
179 endif
181 ifeq ($(OS_ARCH),WINNT)
182 OS_LIBS += $(call EXPAND_LIBNAME,comctl32 comdlg32 uuid shell32 ole32 oleaut32 version winspool)
183 OS_LIBS += $(call EXPAND_LIBNAME,usp10 msimg32)
184 endif
186 ifneq (,$(filter WINNT WINCE,$(OS_ARCH)))
187 RCINCLUDE = splash.rc
188 ifndef GNU_CC
189 RCFLAGS += -DMOZ_PHOENIX -I$(srcdir)
190 else
191 RCFLAGS += -DMOZ_PHOENIX --include-dir $(srcdir)
192 endif
193 ifdef BUILD_STATIC_LIBS
194 RCFLAGS += -DMOZ_STATIC_BUILD
195 endif
196 ifdef DEBUG
197 RCFLAGS += -DDEBUG
198 endif
199 endif
201 ifeq ($(OS_ARCH),BeOS)
202 BEOS_PROGRAM_RESOURCE = $(srcdir)/apprunner-beos.rsrc
203 ifdef BUILD_STATIC_LIBS
204 OS_LIBS += -ltracker -lgame
205 endif
206 endif
208 ifeq ($(OS_ARCH),OS2)
209 RESFILE=splashos2.res
210 RCFLAGS += -DMOZ_PHOENIX
211 ifdef BUILD_STATIC_LIBS
212 RCFLAGS += -DMOZ_STATIC_BUILD -i $(DIST)/include
213 endif
214 ifdef DEBUG
215 RCFLAGS += -DDEBUG
216 endif
217 RCFLAGS += -DFIREFOX_ICO=\"$(DIST)/branding/firefox-os2.ico\" -DDOCUMENT_ICO=\"$(DIST)/branding/document-os2.ico\"
218 endif
220 include $(topsrcdir)/config/rules.mk
222 ifdef BUILD_STATIC_LIBS
223 include $(topsrcdir)/config/static-rules.mk
225 DEFINES += -DIMPL_XREAPI
226 endif
228 ifeq ($(MOZ_WIDGET_TOOLKIT),photon)
229 LIBS += -lphexlib
230 endif
232 ifeq ($(OS_ARCH),WINNT)
234 # Control the default heap size.
235 # This is the heap returned by GetProcessHeap().
236 # As we use the CRT heap, the default size is too large and wastes VM.
238 # The default heap size is 1MB on Win32.
239 # The heap will grow if need be.
241 # Set it to 256k. See bug 127069.
243 ifndef GNU_CC
244 LDFLAGS += /HEAP:0x40000
245 ifeq ($(OS_TEST),x86_64)
246 # set stack to 2MB on x64 build. See bug 582910
247 LDFLAGS += -STACK:2097152
248 endif
249 endif
250 endif
252 $(PROGRAM): $(DEPTH)/toolkit/xre/$(LIB_PREFIX)xulapp_s.$(LIB_SUFFIX)
254 ifneq (,$(filter-out OS2 WINNT WINCE,$(OS_ARCH)))
256 $(MOZ_APP_NAME):: $(topsrcdir)/build/unix/mozilla.in $(GLOBAL_DEPS)
257 cat $< | sed -e "s|%MOZAPPDIR%|$(installdir)|" \
258 -e "s|%MOZ_APP_DISPLAYNAME%|$(MOZ_APP_DISPLAYNAME)|" > $@
259 chmod +x $@
261 libs:: $(MOZ_APP_NAME)
262 $(INSTALL) $< $(DIST)/bin
264 install:: $(MOZ_APP_NAME)
265 $(SYSINSTALL) $< $(DESTDIR)$(bindir)
267 GARBAGE += $(MOZ_APP_NAME)
268 GARBAGE += $(addprefix $(DIST)/bin/defaults/pref/, firefox.js)
270 endif
272 endif # LIBXUL_SDK
274 DEFINES += -DFIREFOX_ICO=\"$(DIST)/branding/firefox.ico\" -DDOCUMENT_ICO=\"$(DIST)/branding/document.ico\"
276 ifdef MOZILLA_OFFICIAL
277 DEFINES += -DMOZILLA_OFFICIAL
278 endif
280 ifeq ($(MOZ_WIDGET_TOOLKIT),gtk2)
281 libs::
282 $(INSTALL) $(IFLAGS1) $(DIST)/branding/mozicon128.png $(DIST)/bin/icons
283 $(INSTALL) $(IFLAGS1) $(DIST)/branding/document.png $(DIST)/bin/icons
284 $(INSTALL) $(IFLAGS1) $(DIST)/branding/default16.png $(DIST)/bin/chrome/icons/default
285 $(INSTALL) $(IFLAGS1) $(DIST)/branding/default32.png $(DIST)/bin/chrome/icons/default
286 $(INSTALL) $(IFLAGS1) $(DIST)/branding/default48.png $(DIST)/bin/chrome/icons/default
287 endif
289 ifdef MOZ_SPLASHSCREEN
290 ifeq ($(MOZ_WIDGET_TOOLKIT),windows)
291 libs::
292 $(INSTALL) $(IFLAGS1) $(DIST)/branding/splash.bmp $(DIST)/bin
293 endif
294 endif
296 ifdef WINCE
297 ifdef MOZ_FASTSTART
298 libs::
299 cp -f $(DIST)/bin/faststartstub.exe $(DIST)/bin/$(MOZ_APP_NAME)faststart.exe
300 endif
301 endif
303 libs:: $(srcdir)/profile/prefs.js
304 $(INSTALL) $(IFLAGS1) $^ $(DIST)/bin/defaults/profile
306 libs:: $(srcdir)/blocklist.xml
307 $(INSTALL) $(IFLAGS1) $^ $(DIST)/bin
309 ifeq (cocoa,$(MOZ_WIDGET_TOOLKIT))
311 APP_NAME = $(MOZ_APP_DISPLAYNAME)
313 ifdef MOZ_DEBUG
314 APP_NAME := $(APP_NAME)Debug
315 endif
317 LOWER_APP_NAME = $(shell echo $(APP_NAME) | tr '[A-Z]' '[a-z]')
319 AB_CD = $(MOZ_UI_LOCALE)
321 AB := $(firstword $(subst -, ,$(AB_CD)))
323 clean clobber repackage::
324 rm -rf $(DIST)/$(APP_NAME).app
326 ifdef LIBXUL_SDK
327 APPFILES = Resources
328 else
329 APPFILES = MacOS
330 endif
332 libs repackage:: $(PROGRAM) application.ini
333 mkdir -p $(DIST)/$(APP_NAME).app/Contents/MacOS
334 rsync -a --exclude CVS --exclude "*.in" $(srcdir)/macbuild/Contents $(DIST)/$(APP_NAME).app --exclude English.lproj
335 mkdir -p $(DIST)/$(APP_NAME).app/Contents/Resources/$(AB).lproj
336 rsync -a --exclude CVS --exclude "*.in" $(srcdir)/macbuild/Contents/Resources/English.lproj/ $(DIST)/$(APP_NAME).app/Contents/Resources/$(AB).lproj
337 sed -e "s/%APP_VERSION%/$(APP_VERSION)/" -e "s/%APP_NAME%/$(APP_NAME)/" -e "s/%LOWER_APP_NAME%/$(LOWER_APP_NAME)/" $(srcdir)/macbuild/Contents/Info.plist.in > $(DIST)/$(APP_NAME).app/Contents/Info.plist
338 sed -e "s/%APP_NAME%/$(APP_NAME)/" $(srcdir)/macbuild/Contents/Resources/English.lproj/InfoPlist.strings.in | iconv -f UTF-8 -t UTF-16 > $(DIST)/$(APP_NAME).app/Contents/Resources/$(AB).lproj/InfoPlist.strings
339 rsync -a $(DIST)/bin/ $(DIST)/$(APP_NAME).app/Contents/$(APPFILES)
340 $(RM) $(DIST)/$(APP_NAME).app/Contents/$(APPFILES)/mangle $(DIST)/$(APP_NAME).app/Contents/$(APPFILES)/shlibsign
341 ifdef LIBXUL_SDK
342 cp $(LIBXUL_DIST)/bin/$(XR_STUB_NAME) $(DIST)/$(APP_NAME).app/Contents/MacOS/firefox-bin
343 else
344 rm -f $(DIST)/$(APP_NAME).app/Contents/MacOS/$(PROGRAM)
345 rsync -aL $(PROGRAM) $(DIST)/$(APP_NAME).app/Contents/MacOS
346 endif
347 -cp -L $(DIST)/bin/mangle $(DIST)/bin/shlibsign $(DIST)/$(APP_NAME).app/Contents/$(APPFILES)
348 cp -RL $(DIST)/branding/firefox.icns $(DIST)/$(APP_NAME).app/Contents/Resources/firefox.icns
349 cp -RL $(DIST)/branding/document.icns $(DIST)/$(APP_NAME).app/Contents/Resources/document.icns
350 printf APPLMOZB > $(DIST)/$(APP_NAME).app/Contents/PkgInfo
351 # remove CVS dirs from packaged app
352 find $(DIST)/$(APP_NAME).app -type d -name "CVS" -prune -exec rm -rf {} \;
354 else
355 ifdef LIBXUL_SDK
356 libs::
357 cp $(LIBXUL_DIST)/bin/$(XULRUNNER_STUB_NAME)$(BIN_SUFFIX) $(DIST)/bin/firefox$(BIN_SUFFIX)
358 endif
359 endif
361 ifdef LIBXUL_SDK
362 ifndef SKIP_COPY_XULRUNNER
363 libs::
364 ifeq (cocoa,$(MOZ_WIDGET_TOOLKIT))
365 rsync -a --copy-unsafe-links $(LIBXUL_DIST)/XUL.framework $(DIST)/$(APP_NAME).app/Contents/Frameworks
366 else
367 $(NSINSTALL) -D $(DIST)/bin/xulrunner
368 (cd $(LIBXUL_SDK)/bin && tar $(TAR_CREATE_FLAGS) - .) | (cd $(DIST)/bin/xulrunner && tar -xf -)
369 endif # cocoa
370 endif # SKIP_COPY_XULRUNNER
371 endif # LIBXUL_SDK