1 #*************************************************************************
3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 # Copyright 2008 by Sun Microsystems, Inc.
7 # OpenOffice.org - a multi-platform office productivity suite
9 # $RCSfile: makefile.mk,v $
13 # This file is part of OpenOffice.org.
15 # OpenOffice.org is free software: you can redistribute it and/or modify
16 # it under the terms of the GNU Lesser General Public License version 3
17 # only, as published by the Free Software Foundation.
19 # OpenOffice.org is distributed in the hope that it will be useful,
20 # but WITHOUT ANY WARRANTY; without even the implied warranty of
21 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 # GNU Lesser General Public License version 3 for more details
23 # (a copy is included in the LICENSE file that accompanied this code).
25 # You should have received a copy of the GNU Lesser General Public License
26 # version 3 along with OpenOffice.org. If not, see
27 # <http://www.openoffice.org/license.html>
28 # for a copy of the LGPLv3 License.
30 #*************************************************************************
37 # --- Settings -----------------------------------------------------
39 .INCLUDE
: settings.mk
41 # --- Files --------------------------------------------------------
42 # ----- pkg-config start -------
43 .INCLUDE .IGNORE
: pkgroot.mk
44 .IF
"$(PKGCONFIG_ROOT)"!=""
45 PKG_CONFIG
:=$(PKGCONFIG_ROOT
)$/bin
$/pkg-config
46 PKG_CONFIG_PATH
:=$(PKGCONFIG_ROOT
)$/lib
$/pkgconfig
47 .IF
"$(LD_LIBRARY_PATH)"=="" # assume empty implies unset
48 LD_LIBRARY_PATH
!:=$(PKGCONFIG_ROOT
)$/lib
50 LD_LIBRARY_PATH
!:=$(LD_LIBRARY_PATH
)$(PATH_SEPERATOR
)$(PKGCONFIG_ROOT
)$/lib
52 .EXPORT
: PKG_CONFIG_PATH PKG_CONFIG LD_LIBRARY_PATH
53 .ENDIF
# "$(PKGCONFIG_ROOT)"!=""
55 # reduce prerequisites by disabling mozilla binary
56 DISABLE_MOZ_EXECUTABLE
=TRUE
57 .EXPORT
: DISABLE_MOZ_EXECUTABLE
59 .IF
"$(SYSBASE)"!="" && "$(OS)" == "LINUX"
60 ## hmm... rather gcc specific switches...
61 CFLAGS
:=-isystem
$(SYSBASE
)/usr
/include -B
$(SYSBASE
)/usr
/lib
62 LDFLAGS
:= -Wl
,--unresolved-symbols
=ignore-in-shared-libs
-L
$(SYSBASE
)/lib
-L
$(SYSBASE
)/usr
/lib
-L
$(SYSBASE
)/usr
/X11R6
/lib
63 SYSBASE_X11
:=--x-includes
=$(SYSBASE
)/usr
/include/X11
--x-libraries
=$(SYSBASE
)/usr
/X11R6
/lib
64 MOZ_ENABLE_COREXFONTS
=1
65 MOZILLA_CONFIGURE_FLAGS
+=--disable-xft
66 .EXPORT
: CFLAGS LDFLAGS MOZ_ENABLE_COREXFONTS
67 .ENDIF
# "$(SYSBASE)"!="" && "$(OS)" == "LINUX"
69 .IF
"$(SYSBASE)"!="" && "$(OS)" == "MACOSX"
70 PKGCONFIG_ROOT
!:=$(ENV_ROOT
)$/macports-1.7
.0
71 PKG_CONFIG
:=$(PKGCONFIG_ROOT
)$/bin
$/pkg-config
72 PKG_CONFIG_PATH
:=$(PKGCONFIG_ROOT
)$/lib
$/pkgconfig
73 .EXPORT
: PKG_CONFIG_PATH PKG_CONFIG
74 # hmm... rather gcc specific switches...
75 CFLAGS
:=-isystem
$(SYSBASE
)/usr
/include -B
$(SYSBASE
)/usr
/lib
-B
$(SYSBASE
)/usr
/lib
/system
-L
$(ENV_ROOT
)/macports-1.7
.0/lib
-lmathCommon
76 LDFLAGS
:=-L
$(SYSBASE
)/lib
-L
$(SYSBASE
)/usr
/lib
-L
$(SYSBASE
)/usr
/lib
/system
77 XLDOPTS
:= -B
$(SYSBASE
)/usr
/lib
-B
$(SYSBASE
)/usr
/lib
/system
-lmathCommon
78 .EXPORT
: CFLAGS LDFLAGS XLDOPTS
79 .ENDIF
# "$(SYSBASE)"!="" && "$(OS)" == "MACOSX"
81 # ----- pkg-config end -------
83 MOZILLA_VERSION
=1.1.14
84 TARFILE_NAME
=seamonkey-
$(MOZILLA_VERSION
).source
86 TARFILE_ROOTDIR
=mozilla
87 PATCH_FILES
=seamonkey-source-
$(MOZILLA_VERSION
).patch
89 # This file is needed for the W32 build when BUILD_MOZAB is set
90 # (currently only vc8/vs2005 is supported when BUILD_MOZAB is set)
92 LIBIDL_VC71_ZIPFILE_NAME
*=vc71-libIDL-0.6
.8-bin.zip
93 LIBGLIB_VC71_ZIPFILE_NAME
*=vc71-glib-1.2
.10-bin.zip
94 MOZTOOLS_ZIPFILE_NAME
*=wintools.zip
96 MOZTOOLS_ZIPFILE_NAME
*=vc8-moztools.zip
99 ADDITIONAL_FILES
=mailnews
$/addrbook
$/src
$/nsAbMD5sum.
cpp
102 .IF
"$(GUIBASE)"!="aqua"
103 MOZILLA_CONFIGURE_FLAGS
+= $(SYSBASE_X11
)
106 MOZILLA_CONFIGURE_FLAGS
+= --disable-tests \
107 --enable-application
=suite \
112 --disable-profilelocking \
114 --disable-activex-scripting \
118 --disable-postscript \
119 --without-system-zlib \
120 --disable-installer \
121 --disable-accessibility \
122 --disable-xpfe-components \
125 --disable-profilesharing \
129 --disable-freetype2 \
131 --disable-image-encoders \
134 --enable-extensions
="pref"
137 #MOZILLA_CONFIGURE_FLAGS += --enable-system-cairo
140 #disable profilelocking to share profile with mozilla
141 #disable activex and activex-scripting to remove the dependence of Microsoft_SDK\src\mfc\atlbase.h
142 #disable gnomevfs to remove the needed of gnome develop files
143 #disable others to save build times
146 .IF
"$(GUIBASE)"=="aqua"
147 MACDEVSDK
*=/Developer
/SDKs
/MacOSX10.4u.sdk
148 MOZILLA_CONFIGURE_FLAGS
+= \
149 --with-macos-sdk
=$(MACDEVSDK
) \
151 --enable-macos-target
=10.4 \
153 DEFAULT_MOZILLA_TOOLKIT
=mac
155 #We do not need mozilla ui, but libIDL version are decided by default toolkit.
156 #default-toolkit=xlib need libIDL < 0.68
157 #default-toolkit=gtk2 need libIDL > 0.8 (know as libIDL2)
158 DEFAULT_MOZILLA_TOOLKIT
*=gtk2
159 .ENDIF
# "$(GUIBASE)"=="aqua"
160 MOZILLA_CONFIGURE_FLAGS
+= --enable-default-toolkit
=$(DEFAULT_MOZILLA_TOOLKIT
)
163 # create a objdir build = build files in a seperate directory, not in the sourcetree directly
164 CONFIGURE_DIR
=$(CPU
)_objdir
165 BUILD_DIR
=$(CONFIGURE_DIR
)
166 MOZ_CROSSCOMPILE
=CROSS_COMPILE
=1 CC
="gcc -arch $(MOZ_ARCH)" CXX
="g++ -arch $(MOZ_ARCH)" AR
=ar
168 CONFIGURE_ACTION
=$(null
,$(MOZ_ARCH
) $(NULL
) $(MOZ_CROSSCOMPILE
)) ..
/configure
$(MOZILLA_CONFIGURE_FLAGS
)
170 .IF
"$(USE_SHELL)"!="4nt"
171 BUILD_ACTION
:=$(GNUMAKE
) -j
$(EXTMAXPROCESS
)
173 # This construct is needed because unitools.mk defines GNUMAKE using $ENV_TOOLS.
174 # $ENV_TOOLS doesn't exist for OOo builds and the cygwin make is needed.
179 .IF
"$(COMNAME)"=="sunpro5"
180 CXXFLAGS
:=-features
=tmplife
185 .ENDIF
# "$(COMNAME)"=="sunpro5"
188 .IF
"$(OS)"=="SOLARIS" && "$(CPUNAME)"=="SPARC" && "$(CPU)"=="U"
189 PKG_CONFIG_PATH
=/usr
/lib
/64/pkgconfig
190 .EXPORT
: PKG_CONFIG_PATH
191 MAKE
=/usr
/sfw
/bin
/gmake
193 CFLAGS
=-I
/usr
/sfw
/include
196 .IF
"$(COM)"=="C52" && "$(CPUNAME)"=="SPARC" && "$(CPU)"=="U"
199 .EXPORT
: CFLAGS ASFLAGS
202 MOZDIR
=$(MISC
)$/build
$/seamonkey
203 MOZTARGET
=$(OS
)$(COM
)$(CPU
)
206 # "Our" build environment uses "NO" for the environment variable that
207 # indicate if system libraries should be used, the mozilla build uses
208 # "" in this case. This conflicts (at least for W32) with mozilla (1.7b)
209 # because it disables the library checks for msvc so that
210 # --without-system-* is not evaluated. To build the included libraries
211 # the affected variables have to be empty and not NO.
212 .IF
"$(SYSTEM_ZLIB)"=="NO"
214 .EXPORT
: SYSTEM_ZLIB
216 .IF
"$(SYSTEM_JPEG)"=="NO"
218 .EXPORT
: SYSTEM_JPEG
221 # For W32-tcsh CC and CXX must not contain the wrapper, and W32-4nt ( in
222 # some cases ) doesn't work with DOS path notation when building mozilla.
224 CC
:=$(CC
:s
/guw.exe
//:s
/ -mno-cygwin
//)
225 CXX
:=$(CXX
:s
/guw.exe
//:s
/ -mno-cygwin
//)
235 # Variables to install/use our own wintools
237 MOZTOOLSUNPACK
:=$(MISC
)$/build
$/moztoolsunpack
238 MOZTOOLSINST
:=$(MISC
)$/build
$/moztoolsinst
240 MOZTOOLS_EXTRACT
:=$(MISC
)$/build
$/moztools
242 .IF
"$(USE_SHELL)"!="4nt"
244 MOZ_TOOLS_DOS
:=$(shell @cygpath
-ad
"$(MISC)")\build\moztoolsinst
245 PATH
!:=$(PATH
):$(shell @cygpath
$(MOZ_TOOLS_DOS
))/bin
:$(shell @cygpath
$(MOZ_TOOLS_DOS
))/vc71
/bin
246 SET_MOZ_TOOLS_INSTALL_BAT
:=export "MOZ_TOOLS=$(MOZ_TOOLS_DOS)"
248 MOZ_TOOLS_DOS
:=$(shell @cygpath
-ad
"$(MISC)")\build\moztools
\vc
8-moztools
249 PATH
!:=$(shell @cygpath
$(MOZ_TOOLS_DOS
))/bin
:$(PATH
)
251 .ELSE
# "$(USE_SHELL)"!="4nt"
252 # MOZ_TOOLS must contain an absolute path
253 MOZ_TOOLS_DOS
:=$(shell @echo
%@SFN
[$(MISC
)])\build\moztools
\vc
8-moztools
254 PATH
!:=$(MOZ_TOOLS_DOS
)\bin
;$(PATH
)
255 .ENDIF
# "$(USE_SHELL)"!="4nt"
257 MOZ_TOOLS
:=$(subst,\
,/ $(MOZ_TOOLS_DOS
))
259 GLIB_PREFIX
:=$(MOZ_TOOLS
)/vc71
260 LIBIDL_PREFIX
:=$(MOZ_TOOLS
)/vc71
261 .EXPORT
: GLIB_PREFIX LIBIDL_PREFIX
264 .EXPORT
: PATH MOZ_TOOLS
265 .ENDIF
# "$(GUI)"=="WNT"
267 # --- Targets ------------------------------------------------------
269 .IF
"$(BUILD_MOZAB)"==""
271 @echo
"Never Build Mozilla."
274 .INCLUDE
: set_ext.mk
279 NEEDWINTOOLSFLAGFILE
:=$(MISC
)$/build
$/moztools.complete
280 .ENDIF
# "$(GUI)"=="WNT"
282 ALLTAR
: $(NEEDWINTOOLSFLAGFILE
) \
283 $(MISC
)$/remove_build.flag \
286 $(PACKAGE_DIR
)$/$(UNTAR_FLAG_FILE
) : $(MISC
)$/remove_build.flag
288 # Since you never know what will be in a patch (for example, it may already
289 # patch at configure level), we remove the entire package directory if a patch
291 $(MISC
)$/remove_build.flag
: $(PATCH_FILES
)
292 $(REMOVE_PACKAGE_COMMAND
)
293 $(TOUCH
) $(MISC
)$/remove_build.flag
295 # Unpack/setup Windows build tools
297 $(PACKAGE_DIR
)$/$(UNTAR_FLAG_FILE
) : $(MISC
)$/build
$/moztools.complete
300 $(MISC
)$/build
$/moztools.unpack
: $(PRJ
)$/download
$/$(MOZTOOLS_ZIPFILE_NAME
)
301 -$(RENAME
) $(MOZTOOLSUNPACK
) $(MOZTOOLSUNPACK
)_removeme
302 -$(RENAME
) $(MOZTOOLSINST
) $(MOZTOOLSINST
)_removeme
303 -rm -rf
$(MOZTOOLSUNPACK
)_removeme
$(MOZTOOLSINST
)_removeme
304 @
-$(MKDIRHIER
) $(MOZTOOLSUNPACK
)
305 unzip
$(PRJ
)$/download
$/$(MOZTOOLS_ZIPFILE_NAME
) -d
$(MOZTOOLSUNPACK
)
306 $(TOUCH
) $(MISC
)$/build
$/moztools.unpack
308 $(MISC
)$/build
$/moztools.
install : $(MISC
)$/build
$/moztools.unpack
309 cd
$(MOZTOOLSUNPACK
)$/buildtools
$/windows
&& $(SET_MOZ_TOOLS_INSTALL_BAT
) && cmd
/c
install.bat
310 $(TOUCH
) $(MISC
)$/build
$/moztools.
install
312 $(MISC
)$/build
$/moztools.complete
: \
313 $(MISC
)$/build
$/moztools.
install \
314 $(PRJ
)$/download
$/$(LIBIDL_VC71_ZIPFILE_NAME
) \
315 $(PRJ
)$/download
$/$(LIBGLIB_VC71_ZIPFILE_NAME
)
316 unzip
$(PRJ
)$/download
$/$(LIBIDL_VC71_ZIPFILE_NAME
) -d
$(MOZTOOLSINST
)
317 unzip
$(PRJ
)$/download
$/$(LIBGLIB_VC71_ZIPFILE_NAME
) -d
$(MOZTOOLSINST
)
318 # chmod is also needed for W32-4nt build (when cygwin unzip is used)
319 -chmod
-R
+x
$(MOZTOOLSINST
)$/vc71
$/bin
320 $(TOUCH
) $(MISC
)$/build
$/moztools.complete
322 $(MISC
)$/build
$/moztools.unpack
: $(PRJ
)$/download
$/$(MOZTOOLS_ZIPFILE_NAME
)
323 -$(RENAME
) $(MOZTOOLS_EXTRACT
) $(MOZTOOLS_EXTRACT
)_removeme
324 -rm -rf
$(MOZTOOLS_EXTRACT
)_removeme
325 @
-$(MKDIRHIER
) $(MOZTOOLS_EXTRACT
)
326 unzip
$(PRJ
)$/download
$/$(MOZTOOLS_ZIPFILE_NAME
) -d
$(MOZTOOLS_EXTRACT
)
327 # chmod is also needed for W32-4nt build (when cygwin unzip is used)
328 -chmod
-R
+x
$(MOZTOOLS_EXTRACT
)$/vc8-moztools
$/bin
329 $(TOUCH
) $(MISC
)$/build
$/moztools.unpack
331 $(MISC
)$/build
$/moztools.complete
: $(MISC
)$/build
$/moztools.unpack
332 $(TOUCH
) $(MISC
)$/build
$/moztools.complete
334 .ENDIF
# "$(GUI)"=="WNT"
337 $(MISC
)$/CREATETARBALL
339 .IF
"$(GUIBASE)"=="aqua"
340 MOZ_ARCH
=$(eq
,$(CPU
),I i386 ppc
)
341 MOZILLA_CONFIGURE_FLAGS
+=$(eq
,$(CPU
),I
--target
=i386-apple-darwin8
--target
=powerpc-apple-darwin8
)
344 @
$(IFEXIST
) $(PACKAGE_DIR
)$/$(PREDELIVER_FLAG_FILE
) $(THEN
) echo
'ERROR: get rid of your outputdir first (or refactor the makefiles to allow incremental creation of prebuilt zips). Remember to copy already created zips to a safe place '; exit
1 $(FI
)
346 zip_intel .SEQUENTIAL
: force_clean
$(MISC
)$/CREATETARBALL
348 zip_ppc .SEQUENTIAL
: force_clean
$(MISC
)$/CREATETARBALL
350 # target-conditionals, when building target -> Macro is set
351 zip_intel ?
= MOZ_ARCH
=i386
352 zip_intel ?
= MOZILLA_CONFIGURE_FLAGS
+=--target
=i386-apple-darwin8
355 zip_ppc ?
= MOZ_ARCH
=ppc
356 zip_ppc ?
= MOZILLA_CONFIGURE_FLAGS
+=--target
=powerpc-apple-darwin8
359 zip_universal
: $(OUT
)$/zipped
$/$(OS
)$(COM
)UBinc.zip
$(OUT
)$/zipped
$/$(OS
)$(COM
)UBlib.zip
$(OUT
)$/zipped
$/$(OS
)$(COM
)UBruntime.zip
360 @echo
"All zips created successfully - copy from $(OUT)$/zipped to \$$SRC_ROOT/moz/zipped and use --disable-build-mozilla to use them"
362 $(OUT
)$/zipped
$/$(OS
)$(COM
)UBinc.zip
: zipped
$/$(OS
)$(COM
)Pinc.zip zipped
$/$(OS
)$(COM
)Iinc.zip
363 @echo
"setting up for $@"
364 @
rm -rf
$(MISC
)$/UB_inc
365 @
$(MKDIRHIER
) $(MISC
)$/UB_inc
$/intel
366 @
$(MKDIR
) $(MISC
)$/UB_inc
$/ppc
367 @
$(MKDIR
) $(MISC
)$/UB_inc
$/uni
368 @unzip
-q zipped
$/$(OS
)$(COM
)Pinc.zip
-d
$(MISC
)$/UB_inc
$/ppc
369 @unzip
-q zipped
$/$(OS
)$(COM
)Iinc.zip
-d
$(MISC
)$/UB_inc
$/intel
370 # use one of the two as basis for the universal one - (saves manually creating directories/copying identical files)
371 @unzip
-q zipped
$/$(OS
)$(COM
)Pinc.zip
-d
$(MISC
)$/UB_inc
$/uni
372 # add safety-warning to host-autogenerated headers (aren't used anywhere in OOo currently, but doesn't hurt to be safe
373 # bail out on everything that differs and is not a *.h file
374 @echo
"flagging endian-specific headers with #error.."
375 @diff
--brief
-r
$(MISC
)$/UB_inc
$/ppc
$(MISC
)$/UB_inc
$/intel | awk \
376 '/^Only in/ {{print; print "ERROR - file sets differ!"; exit 1}} \
377 /^Files .*\.h differ$$/ {{target="$(MISC)$/UB_inc$/uni$/" substr($$2,length("$(MISC)$/UB_inc$/ppc")+2); \
378 system("echo \"#error use native moz-zips, this header is endian-specific!\" | cat - " $$2 " > " target); next}} \
379 {{print; print "ERROR - unexpected files encountered!"; exit 2}}'
380 @cd
$(MISC
)$/UB_inc
$/uni
; zip
-q
-r ..
$/$(@
:f
) *
382 @
$(MV
) $(MISC
)$/UB_inc
$/$(@
:f
) $@
383 @echo
"successfully created $@"
385 $(OUT
)$/zipped
$/$(OS
)$(COM
)UBlib.zip
: zipped
$/$(OS
)$(COM
)Plib.zip zipped
$/$(OS
)$(COM
)Ilib.zip
386 @echo
"setting up for $@"
387 @
rm -rf
$(MISC
)$/UB_lib
388 @
$(MKDIRHIER
) $(MISC
)$/UB_lib
$/intel
389 @
$(MKDIR
) $(MISC
)$/UB_lib
$/ppc
390 @
$(MKDIR
) $(MISC
)$/UB_lib
$/uni
391 @unzip
-q zipped
$/$(OS
)$(COM
)Plib.zip
-d
$(MISC
)$/UB_lib
$/ppc
392 @unzip
-q zipped
$/$(OS
)$(COM
)Ilib.zip
-d
$(MISC
)$/UB_lib
$/intel
393 # use lipo on .a and .dylib files - bail out on anything else
394 @echo
"creating universal binaries from libs..."
395 @diff
--brief
-s
-r
$(MISC
)$/UB_lib
$/ppc
$(MISC
)$/UB_lib
$/intel | awk \
396 '/^Only in/ {{print "ERROR - file sets differ!"; print; exit 1}} \
397 /^Files .*\.(a|dylib) differ$$/ {{target="$(MISC)$/UB_lib$/uni$/" substr($$2,length("$(MISC)$/UB_lib$/ppc")+2); \
398 if(0!=system("lipo -create -arch ppc "$$2" -arch i386 "$$4" -output " target)) exit 11; next}} \
399 {{print; print "ERROR - unexpected files encountered!"; exit 2}}'
400 @cd
$(MISC
)$/UB_lib
$/uni
; zip
-q
-r ..
$/$(@
:f
) *
402 @
$(MV
) $(MISC
)$/UB_lib
$/$(@
:f
) $@
403 @echo
"successfully created $@"
405 $(OUT
)$/zipped
$/$(OS
)$(COM
)UBruntime.zip
: zipped
$/$(OS
)$(COM
)Pruntime.zip zipped
$/$(OS
)$(COM
)Iruntime.zip
406 @echo
"setting up for $@"
407 @
rm -rf
$(MISC
)$/UB_runtime
408 @
$(MKDIRHIER
) $(MISC
)$/UB_runtime
$/intel
409 @
$(MKDIR
) $(MISC
)$/UB_runtime
$/ppc
410 @
$(MKDIR
) $(MISC
)$/UB_runtime
$/uni
411 @unzip
-q zipped
$/$(OS
)$(COM
)Pruntime.zip
-d
$(MISC
)$/UB_runtime
$/ppc
412 @unzip
-q zipped
$/$(OS
)$(COM
)Iruntime.zip
-d
$(MISC
)$/UB_runtime
$/intel
413 # use one of the two as basis for the universal one - (saves manually creating directories/copying identical files)
414 @unzip
-q zipped
$/$(OS
)$(COM
)Pruntime.zip
-d
$(MISC
)$/UB_runtime
$/uni
415 # @line -comments in autogenerated files: contains path of source-file, ignore different objdirs
416 @echo
"creating universal binaries from libs..."
417 @diff
--brief
-I
"^//@line [0-9][0-9]*" -r
$(MISC
)$/UB_runtime
$/ppc
$(MISC
)$/UB_runtime
$/intel | awk \
418 '/^Only in/ {{print; print "ERROR - file sets differ!"; exit 1}} \
419 /^Files .*\.dylib differ$$/ {{target="$(MISC)$/UB_runtime$/uni$/" substr($$2,length("$(MISC)$/UB_runtime$/ppc")+2); \
420 if(0!=system("lipo -create -arch ppc "$$2" -arch i386 "$$4" -output " target)) exit 11; next}} \
421 {{print; print "ERROR - unexpected files encountered!"; exit 2}}'
422 @cd
$(MISC
)$/UB_lib
$/uni
; zip
-q
-r ..
$/$(@
:f
) *
424 @
$(MV
) $(MISC
)$/UB_lib
$/$(@
:f
) $@
425 @echo
"successfully created $@"
427 .ENDIF
# $(GUIBASE)=="aqua"
429 .INCLUDE
: extractfiles.mk