OSDN Git Service

import source-tree based svn r84.
[bluegriffon/BlueGriffon.git] / app / Makefile.in
1 # ***** BEGIN LICENSE BLOCK *****
2 # Version: MPL 1.1/GPL 2.0/LGPL 2.1
3 #
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/
8 #
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.
13 #
14 # The Original Code is mozilla.org code.
15 #
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.
20 #
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>
26 #  Laurent Jouanneau <laurent.jouanneau@disruptive-innovations.com>
27 #
28 # Alternatively, the contents of this file may be used under the terms of
29 # either the GNU General Public License Version 2 or later (the "GPL"), or
30 # the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
31 # in which case the provisions of the GPL or the LGPL are applicable instead
32 # of those above. If you wish to allow use of your version of this file only
33 # under the terms of either the GPL or the LGPL, and not to allow others to
34 # use your version of this file under the terms of the MPL, indicate your
35 # decision by deleting the provisions above and replace them with the notice
36 # and other provisions required by the GPL or the LGPL. If you do not delete
37 # the provisions above, a recipient may use your version of this file under
38 # the terms of any one of the MPL, the GPL or the LGPL.
39 #
40 # ***** END LICENSE BLOCK *****
41
42 DEPTH           = ../..
43 topsrcdir       = @top_srcdir@
44 srcdir  = @srcdir@
45 VPATH           = @srcdir@
46
47 include $(DEPTH)/config/autoconf.mk
48
49 PREF_JS_EXPORTS = $(srcdir)/profile/bluegriffon-prefs.js \
50                   $(NULL)
51
52 # hardcoded en-US for the moment
53 AB_CD = en-US
54 #AB_CD = $(MOZ_UI_LOCALE)
55
56 APP_UA_NAME = $(shell echo $(MOZ_APP_DISPLAYNAME) | sed -e's/[^A-Za-z]//g')
57 APP_BINARY = $(MOZ_APP_NAME)$(BIN_SUFFIX)
58 APP_VERSION = $(shell cat $(srcdir)/../config/version.txt)
59
60 DIST_FILES = application.ini
61
62 GRE_MILESTONE = $(shell $(PYTHON) $(topsrcdir)/config/printconfigsetting.py $(LIBXUL_DIST)/bin/platform.ini Build Milestone)
63 GRE_BUILDID = $(shell $(PYTHON) $(topsrcdir)/config/printconfigsetting.py $(LIBXUL_DIST)/bin/platform.ini Build BuildID)
64
65
66 DEFINES += \
67         -DAPP_NAME=$(MOZ_APP_DISPLAYNAME) \
68         -DAPP_VERSION=$(APP_VERSION) \
69         -DAPP_UA_NAME="$(APP_UA_NAME)" \
70         -DGRE_BUILDID=$(GRE_BUILDID) \
71         -DGRE_MILESTONE=$(GRE_MILESTONE) \
72         -DMOZ_APP_NAME=$(MOZ_APP_NAME) \
73         -DAB_CD=$(AB_CD) \
74    $(NULL)
75
76 LIBS += $(JEMALLOC_LIBS)
77
78 ifdef LIBXUL_SDK
79 include $(topsrcdir)/config/rules.mk
80 else
81
82 # Build a binary bootstrapping with XRE_main
83
84 ifeq ($(USE_SHORT_LIBNAME), 1)
85 PROGRAM = $(MOZ_APP_NAME)$(BIN_SUFFIX)
86 else
87 PROGRAM = $(MOZ_APP_NAME)-bin$(BIN_SUFFIX)
88 endif
89
90 REQUIRES = \
91         xpcom \
92         string \
93         xulapp \
94         $(NULL)
95
96 CPPSRCS = nsEditorApp.cpp
97
98 LOCAL_INCLUDES += -I$(topsrcdir)/toolkit/xre
99
100 ifdef BUILD_STATIC_LIBS
101 ifdef _MSC_VER
102 STATIC_COMPONENTS_LINKER_PATH = -LIBPATH:$(DEPTH)/staticlib
103 else
104 STATIC_COMPONENTS_LINKER_PATH = -L$(DEPTH)/staticlib
105 endif
106 LIBS += $(MOZDEPTH)/toolkit/xre/$(LIB_PREFIX)xulapp_s.$(LIB_SUFFIX)
107 else
108 ifneq (,$(filter mac cocoa,$(MOZ_WIDGET_TOOLKIT)))
109 LIBS += $(DIST)/bin/XUL
110 else
111 EXTRA_DSO_LIBS += xul
112 endif
113 endif
114
115 ifneq (,$(filter mac cocoa,$(MOZ_WIDGET_TOOLKIT)))
116 TK_LIBS :=  -framework Cocoa  $(TK_LIBS)
117 endif
118
119 ifdef MOZ_ENABLE_LIBXUL
120 APP_XPCOM_LIBS = $(XPCOM_GLUE_LDOPTS)
121 else
122 MOZILLA_INTERNAL_API = 1
123 APP_XPCOM_LIBS = $(XPCOM_LIBS)
124 endif
125
126 LIBS += \
127         $(STATIC_COMPONENTS_LINKER_PATH) \
128         $(MOZ_JS_LIBS) \
129         $(EXTRA_DSO_LIBS) \
130         $(APP_XPCOM_LIBS) \
131         $(NSPR_LIBS) \
132         $(TK_LIBS) \
133         $(NULL)
134
135 # Add explicit X11 dependency when building against X11 toolkits
136 ifneq (,$(filter gtk gtk2 xlib,$(MOZ_WIDGET_TOOLKIT)))
137 LIBS += $(XLDFLAGS) $(XLIBS) $(ZLIB_LIBS)
138 endif
139
140 ifdef MOZ_JPROF
141 LIBS += -ljprof
142 endif
143
144 ifndef MOZ_WINCONSOLE
145 ifdef MOZ_DEBUG
146 MOZ_WINCONSOLE = 1
147 else
148 MOZ_WINCONSOLE = 0
149 endif
150 endif
151
152 NSDISTMODE = copy
153
154 include $(topsrcdir)/config/config.mk
155
156 ifdef _MSC_VER
157 # Always enter a Windows program through wmain, whether or not we're
158 # a console application.
159 WIN32_EXE_LDFLAGS += -ENTRY:wmainCRTStartup
160 endif
161
162 ifndef BUILD_STATIC_LIBS
163
164 ifdef NS_TRACE_MALLOC
165 EXTRA_DSO_LIBS += tracemalloc
166 endif
167
168 else
169 include $(topsrcdir)/config/static-config.mk
170
171 EXTRA_DEPS      += \
172         $(STATIC_EXTRA_DEPS) \
173         $(NULL)
174 DEFINES         += $(STATIC_DEFINES)
175 CPPSRCS         += $(STATIC_CPPSRCS)
176 EXTRA_DSO_LIBS  += $(STATIC_EXTRA_DSO_LIBS)
177 REQUIRES        += $(STATIC_REQUIRES)
178 EXTRA_LIBS      += $(STATIC_EXTRA_LIBS)
179 endif
180
181
182 ifeq ($(OS_ARCH),WINNT)
183 OS_LIBS += $(call EXPAND_LIBNAME,comctl32 comdlg32 uuid shell32 ole32 oleaut32 version winspool)
184 OS_LIBS += $(call EXPAND_LIBNAME,usp10 msimg32)
185 RCINCLUDE = splash.rc
186 ifndef GNU_CC
187 RCFLAGS += -I$(srcdir)
188 else
189 RCFLAGS += --include-dir $(srcdir)
190 endif
191 ifdef BUILD_STATIC_LIBS
192 RCFLAGS += -DMOZ_STATIC_BUILD
193 endif
194 ifdef DEBUG
195 RCFLAGS += -DDEBUG
196 endif
197 endif
198
199 ifeq ($(OS_ARCH),BeOS)
200 #BEOS_PROGRAM_RESOURCE = $(srcdir)/apprunner-beos.rsrc
201 ifdef BUILD_STATIC_LIBS
202 OS_LIBS += -ltracker -lgame
203 endif
204 endif
205
206 #ifeq ($(OS_ARCH),OS2)
207 #RESFILE=splashos2.res
208 #ifdef BUILD_STATIC_LIBS
209 #EXE_DEF_FILE = bluegriffon.def
210 #RCFLAGS += -DMOZ_STATIC_BUILD -i $(DIST)/include/widget
211 #endif
212 #ifdef DEBUG
213 #RCFLAGS += -DDEBUG
214 #endif
215 #RCFLAGS += -DCOMPOSER_ICO=\"$(srcdir)/icons/bluegriffon.ico\" -DDOCUMENT_ICO=\"$(srcdir)/icons/bluegriffon.ico\"
216 #endif
217
218 include $(topsrcdir)/config/rules.mk
219
220
221 DEFINES += -DCOMPOSER_ICO=\"$(srcdir)/icons/bluegriffon.ico\" -DDOCUMENT_ICO=\"$(srcdir)/icons/bluegriffon.ico\"
222
223 ifdef BUILD_STATIC_LIBS
224 include $(topsrcdir)/config/static-rules.mk
225
226 DEFINES += -DIMPL_XREAPI
227 endif
228
229 ifeq ($(MOZ_WIDGET_TOOLKIT),photon)
230 LIBS += -lphexlib
231 endif
232
233 ifeq ($(OS_ARCH),WINNT)
234 #
235 # Control the default heap size.
236 # This is the heap returned by GetProcessHeap().
237 # As we use the CRT heap, the default size is too large and wastes VM.
238 #
239 # The default heap size is 1MB on Win32.
240 # The heap will grow if need be.
241 #
242 # Set it to 256k.  See bug 127069.
243 #
244 ifndef GNU_CC
245 LDFLAGS += /HEAP:0x40000
246 endif
247 endif
248
249 $(PROGRAM): $(DEPTH)/toolkit/xre/$(LIB_PREFIX)xulapp_s.$(LIB_SUFFIX)
250
251 ifneq (,$(filter-out OS2 WINNT,$(OS_ARCH)))
252
253 $(MOZ_APP_NAME):: mozilla.in Makefile.in Makefile $(DEPTH)/config/autoconf.mk
254         cat $< | sed -e "s|%MOZAPPDIR%|$(installdir)|" \
255                 -e "s|%MREDIR%|$(mredir)|" \
256                 -e "s|%MOZILLA-BIN%|$(PROGRAM)|g" \
257                 -e "s|%MOZ_APP_DISPLAYNAME%|$(MOZ_APP_DISPLAYNAME)|" > $@
258         chmod +x $@
259
260 libs:: $(MOZ_APP_NAME)
261         $(INSTALL) $< $(DIST)/bin
262
263 install:: $(MOZ_APP_NAME)
264         $(SYSINSTALL) $< $(DESTDIR)$(bindir)
265
266 GARBAGE += $(MOZ_APP_NAME)
267 GARBAGE += $(addprefix $(DIST)/bin/defaults/pref/, bluegriffon-prefs.js)
268
269 endif
270
271 ifneq (,$(filter mac cocoa,$(MOZ_WIDGET_TOOLKIT)))
272 ifdef BUILD_STATIC_LIBS
273 LIBS    += -lcups -framework AddressBook
274 endif
275 endif
276
277 endif # LIBXUL_SDK
278
279
280
281 ifneq (,$(filter gtk gtk2,$(MOZ_WIDGET_TOOLKIT)))
282 ICON_FILES      = \
283                 $(srcdir)/icons/bluegriffon50.xpm \
284                 $(srcdir)/icons/bluegriffon50.png \
285                 $(srcdir)/icons/bluegriffon16.xpm \
286                 $(srcdir)/icons/bluegriffon16.png \
287                 $(NULL)
288 libs::
289         $(INSTALL) $(ICON_FILES) $(DIST)/bin/icons/
290
291 install::
292         $(SYSINSTALL) $(IFLAGS1) $(ICON_FILES) $(DESTDIR)$(mozappdir)/icons
293 endif
294
295 ifneq (,$(filter windows os2,$(MOZ_WIDGET_TOOLKIT)))
296 #libs:: $(DESKTOP_ICONS)
297 #       $(INSTALL) $^ $(DIST)/bin/chrome/icons/default
298 endif
299
300 libs::
301         touch $(DIST)/bin/.autoreg
302
303
304 ifneq (,$(filter mac cocoa,$(MOZ_WIDGET_TOOLKIT)))
305
306 APP_NAME = $(MOZ_APP_DISPLAYNAME)
307
308 ifdef MOZ_DEBUG
309 APP_NAME := $(APP_NAME)Debug
310 endif
311
312 AB := $(firstword $(subst -, ,$(AB_CD)))
313
314 clean clobber repackage::
315         rm -rf $(DIST)/$(APP_NAME).app
316
317 ifdef LIBXUL_SDK
318 APPFILES = Resources
319 else
320 APPFILES = MacOS
321 endif
322
323 libs repackage:: $(PROGRAM) application.ini
324         mkdir -p $(DIST)/$(APP_NAME).app/Contents/MacOS
325         rsync -a --exclude CVS --exclude "*.in" $(srcdir)/macbuild/Contents $(DIST)/$(APP_NAME).app --exclude English.lproj
326         mkdir -p $(DIST)/$(APP_NAME).app/Contents/Resources/$(AB).lproj
327         rsync -a --exclude CVS --exclude "*.in" $(srcdir)/macbuild/Contents/Resources/English.lproj/ $(DIST)/$(APP_NAME).app/Contents/Resources/$(AB).lproj
328         sed -e "s/%APP_VERSION%/$(APP_VERSION)/" -e "s/%APP_NAME%/$(APP_NAME)/" $(srcdir)/macbuild/Contents/Info.plist.in > $(DIST)/$(APP_NAME).app/Contents/Info.plist
329         sed -e "s/%APP_VERSION%/$(APP_VERSION)/" -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
330         rsync -a $(DIST)/bin/ $(DIST)/$(APP_NAME).app/Contents/$(APPFILES)
331         $(RM) $(DIST)/$(APP_NAME).app/Contents/$(APPFILES)/mangle $(DIST)/$(APP_NAME).app/Contents/$(APPFILES)/shlibsign
332 ifdef LIBXUL_SDK
333         cp $(LIBXUL_DIST)/bin/$(XR_STUB_NAME) $(DIST)/$(APP_NAME).app/Contents/MacOS/firefox-bin
334 else
335         rm -f $(DIST)/$(APP_NAME).app/Contents/MacOS/$(PROGRAM)
336         rsync -aL $(PROGRAM) $(DIST)/$(APP_NAME).app/Contents/MacOS
337 endif
338         mkdir -p $(DIST)/$(APP_NAME).app/Contents/Plug-Ins
339         rsync -a --copy-unsafe-links $(LIBXUL_DIST)/package/PrintPDE.plugin $(DIST)/$(APP_NAME).app/Contents/Plug-Ins
340 #       -cp -L $(DIST)/bin/mangle $(DIST)/bin/shlibsign $(DIST)/$(APP_NAME).app/Contents/$(APPFILES)
341         cp -RL $(srcdir)/macbuild/Contents/Resources/bluegriffon.icns $(DIST)/$(APP_NAME).app/Contents/Resources/bluegriffon.icns
342         echo -n APPLMOZB > $(DIST)/$(APP_NAME).app/Contents/PkgInfo
343 #       remove CVS dirs from packaged app
344         find $(DIST)/$(APP_NAME).app -type d -name "CVS" -prune -exec rm -rf {} \;
345         find $(DIST)/$(APP_NAME).app -type d -name ".svn" -prune -exec rm -rf {} \;
346 else
347 ifdef LIBXUL_SDK
348 libs::
349         cp $(LIBXUL_DIST)/bin/xulrunner-stub$(BIN_SUFFIX) $(DIST)/bin/firefox$(BIN_SUFFIX)
350 endif
351 endif
352
353 libs::
354 ifeq ($(OS_ARCH),WINNT)
355         $(PERL) -pe 's/(?<!\r)\n/\r\n/g;' < $(topsrcdir)/LICENSE > $(DIST)/bin/LICENSE
356 else
357         $(INSTALL) $(topsrcdir)/LICENSE $(DIST)/bin
358 endif
359
360 ifdef LIBXUL_SDK
361 ifndef SKIP_COPY_XULRUNNER
362 libs::
363 ifeq (cocoa,$(MOZ_WIDGET_TOOLKIT))
364         rsync -a --copy-unsafe-links $(LIBXUL_DIST)/XUL.framework $(DIST)/$(APP_NAME).app/Contents/Frameworks
365 else
366         $(NSINSTALL) -D $(DIST)/bin/xulrunner
367         (cd $(LIBXUL_SDK)/bin && tar $(TAR_CREATE_FLAGS) - .) | (cd $(DIST)/bin/xulrunner && tar -xf -)
368 endif # cocoa
369 endif # SKIP_COPY_XULRUNNER
370 endif # LIBXUL_SDK