1# 2# ***** BEGIN LICENSE BLOCK ***** 3# Version: MPL 1.1/GPL 2.0/LGPL 2.1 4# 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/ 9# 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. 14# 15# The Original Code is mozilla.org code. 16# 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. 21# 22# Contributor(s): 23# 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. 35# 36# ***** END LICENSE BLOCK ***** 37 38DEPTH = . 39topsrcdir = @top_srcdir@ 40srcdir = @srcdir@ 41VPATH = @srcdir@ 42 43include $(DEPTH)/config/autoconf.mk 44 45include $(topsrcdir)/build/unix/modules.mk 46 47ifeq ($(BUILD_MODULES),all) 48# 49# And now for something completely different... 50# Divide the default build into tiers. 51# Tiers must be defined on module boundaries 52# 53SUPPRESS_DEFAULT_RULES = 1 54 55default alldep all:: $(SUBMAKEFILES) 56 $(RM) -rf $(DIST)/sdk 57 $(RM) -rf $(DIST)/include 58 $(MAKE) -C config export 59 $(MAKE) nspr 60 $(MAKE) ldap 61 $(MAKE) tier_0 62 $(MAKE) tier_1 63 $(MAKE) tier_2 64 $(MAKE) tier_9 65 $(MAKE) tier_50 66 $(MAKE) tier_99 67 68# Make sure that the existing rulesets work 69DIRS = \ 70 $(tier_0_dirs) \ 71 $(tier_1_dirs) \ 72 $(tier_2_dirs) \ 73 $(tier_9_dirs) \ 74 $(tier_50_dirs) \ 75 $(NULL) 76 77ifdef GC_LEAK_DETECTOR 78DIRS += gc/boehm 79endif 80 81DIRS += $(tier_99_dirs) 82 83# 84# tier 0 - base build config dirs 85# 86tier_0_dirs = \ 87 config \ 88 build \ 89 $(NULL) 90 91# 92# tier 1 - 3rd party individual libraries 93# 94tier_1_dirs += dbm 95 96ifndef MOZ_NATIVE_JPEG 97tier_1_dirs += jpeg 98endif 99 100ifndef MOZ_NATIVE_ZLIB 101tier_1_dirs += modules/zlib 102endif 103 104# Installer needs standalone libjar, hence standalone zlib 105ifdef MOZ_INSTALLER 106tier_1_dirs += modules/zlib/standalone 107endif 108 109ifdef MOZ_UPDATER 110tier_1_dirs += modules/libbz2 111tier_1_dirs += modules/libmar 112endif 113 114ifdef MOZ_SVG_RENDERER_LIBART 115tier_1_dirs += other-licenses/libart_lgpl 116endif 117 118# 119# tier 2 - base libraries 120# 121tier_2_dirs = \ 122 js \ 123 xpcom \ 124 $(NULL) 125 126ifndef MOZ_NO_XPCOM_OBSOLETE 127tier_2_dirs += modules/libreg xpcom/obsolete 128endif 129 130ifdef NS_TRACE_MALLOC 131tier_2_dirs += tools/trace-malloc/lib 132endif 133 134# 135# tier 9 - core components (necko,gecko) 136# 137 138tier_9_dirs += \ 139 js/src/xpconnect \ 140 intl \ 141 db \ 142 $(NULL) 143 144ifdef MOZ_STORAGE 145tier_9_dirs += storage 146endif 147 148ifdef MOZ_ENABLE_XLIB 149tier_9_dirs += gfx/src/xlibrgb widget/src/xlibxtbin 150endif 151 152ifdef MOZ_ENABLE_GTK 153tier_9_dirs += widget/src/gtksuperwin widget/src/gtkxtbin 154endif 155 156ifdef MOZ_ENABLE_GTK2 157tier_9_dirs += widget/src/gtkxtbin 158endif 159 160ifdef MOZ_IPCD 161tier_9_dirs += ipc/ipcd 162endif 163 164ifdef MOZ_JSDEBUGGER 165tier_9_dirs += js/jsd 166endif 167 168tier_9_dirs += \ 169 modules/libutil \ 170 netwerk \ 171 modules/libjar \ 172 uriloader \ 173 modules/libpref \ 174 modules/libimg \ 175 caps \ 176 rdf \ 177 parser/expat \ 178 parser/xml \ 179 parser/htmlparser \ 180 gfx \ 181 modules/libpr0n \ 182 sun-java \ 183 modules/plugin \ 184 dom \ 185 view \ 186 widget \ 187 content \ 188 layout \ 189 xpfe/components/shistory \ 190 docshell \ 191 webshell \ 192 embedding \ 193 editor \ 194 xpfe/appshell \ 195 $(NULL) 196 197ifdef MOZ_OJI 198tier_9_dirs += \ 199 js/src/liveconnect \ 200 modules/oji \ 201 $(NULL) 202endif 203 204ifdef ACCESSIBILITY 205tier_9_dirs += accessible 206endif 207 208# 209# tier 50 - xpfe & toolkit 210# 211 212ifdef MOZ_XUL 213ifdef MOZ_XUL_APP 214tier_50_dirs += chrome 215else 216tier_50_dirs += rdf/chrome 217endif 218else 219tier_50_dirs += embedding/minimo/chromelite 220endif 221 222tier_50_dirs += profile 223 224# This must preceed xpfe 225ifdef MOZ_JPROF 226tier_50_dirs += tools/jprof 227endif 228 229ifneq (,$(filter mac cocoa,$(MOZ_WIDGET_TOOLKIT))) 230tier_50_dirs += xpfe/bootstrap/appleevents 231endif 232 233tier_50_dirs += \ 234 xpfe \ 235 toolkit/components \ 236 $(NULL) 237 238ifndef MOZ_XUL_APP 239tier_50_dirs += themes 240endif 241 242ifdef MOZ_ENABLE_XREMOTE 243tier_50_dirs += widget/src/xremoteclient 244endif 245 246ifdef MOZ_XUL_APP 247tier_50_dirs += toolkit 248endif 249 250ifdef MOZ_PHOENIX 251#XXXBlake this shell path is a temp hack; toolkit shouldn't depend on browser 252tier_50_dirs += browser/components/shell/public 253endif 254 255ifdef MOZ_XPINSTALL 256tier_50_dirs += xpinstall 257endif 258 259# JavaXPCOM JNI code is compiled into libXUL 260ifdef MOZ_JAVAXPCOM 261tier_50_dirs += extensions/java/xpcom/src 262endif 263 264ifdef MOZ_ENABLE_LIBXUL 265tier_50_dirs += \ 266 toolkit/library \ 267 xpcom/stub \ 268 $(NULL) 269endif 270 271ifdef NS_TRACE_MALLOC 272tier_50_dirs += tools/trace-malloc 273endif 274 275ifdef MOZ_PSM 276tier_50_dirs += security/manager 277else 278tier_50_dirs += security/manager/boot/public security/manager/ssl/public 279endif 280 281ifdef MOZ_LDAP_XPCOM 282tier_50_dirs += directory/xpcom 283endif 284 285ifndef MINIMO 286ifdef MOZ_XUL_APP 287ifdef MOZ_ENABLE_GTK2 288tier_50_dirs += toolkit/components/gnome 289endif 290endif 291endif 292 293ifdef MOZ_LEAKY 294tier_50_dirs += tools/leaky 295endif 296 297ifdef MOZ_MAPINFO 298tier_50_dirs += tools/codesighs 299endif 300 301# 302# tier 99 - application features 303# 304 305ifdef MOZ_MAIL_NEWS 306tier_99_dirs += mailnews 307endif 308 309ifdef MOZ_CALENDAR 310tier_99_dirs += calendar 311endif 312 313ifdef MOZ_EXTENSIONS 314tier_99_dirs += extensions 315endif 316 317ifdef MOZ_JAVAXPCOM 318tier_99_dirs += extensions/java 319endif 320 321# axcontrol 322ifeq ($(OS_ARCH),WINNT) 323ifndef MOZ_NO_ACTIVEX_SUPPORT 324tier_99_dirs += \ 325 embedding/browser/activex/src/control \ 326 embedding/browser/activex/src/control_kicker \ 327 $(NULL) 328endif 329endif 330 331# Java Embedding Plugin 332ifneq (,$(filter mac cocoa,$(MOZ_WIDGET_TOOLKIT))) 333tier_99_dirs += plugin/oji/JEP 334endif 335 336ifneq (,$(filter browser suite,$(MOZ_BUILD_APP))) 337tier_99_dirs += xpfe/components/search 338endif 339 340ifdef MOZ_BRANDING_DIRECTORY 341tier_99_dirs += $(MOZ_BRANDING_DIRECTORY) 342endif 343 344ifdef MOZ_PHOENIX 345tier_99_dirs += browser xpfe/bootstrap/init.d 346endif 347 348ifdef MOZ_XULRUNNER 349tier_99_dirs += xulrunner 350endif 351 352ifdef MOZ_COMPOSER 353tier_99_dirs += editor/ui 354endif 355 356ifdef MOZ_THUNDERBIRD 357tier_99_dirs += mail xpfe/bootstrap/init.d 358endif 359 360ifdef MOZ_STANDALONE_COMPOSER 361tier_99_dirs += composer 362endif 363 364ifdef MOZ_SUNBIRD 365tier_99_dirs += calendar/sunbird 366endif 367 368ifdef MOZ_SUITE 369tier_99_dirs += suite 370endif 371 372ifdef MINIMO 373tier_99_dirs += minimo 374endif 375 376ifdef MOZ_XUL_APP 377ifdef MOZ_INSTALLER 378tier_99_dirs += toolkit/mozapps/installer 379endif 380else 381ifneq (,$(MOZ_XPFE_COMPONENTS)$(MOZ_XUL)) 382ifndef MINIMO 383tier_99_dirs += xpfe/bootstrap 384endif 385endif 386endif 387 388ifneq (,$(MOZ_ENABLE_GTK)$(MOZ_ENABLE_GTK2)) 389tier_99_dirs += embedding/browser/gtk 390endif 391 392# viewer 393ifneq (,$(ENABLE_TESTS)) 394ifndef MOZ_ENABLE_LIBXUL 395tier_99_dirs += webshell/tests 396endif 397endif 398 399# winembed, mfcembed 400ifeq ($(OS_ARCH),WINNT) 401ifneq (,$(ENABLE_TESTS)$(MOZILLA_OFFICIAL)) 402tier_99_dirs += embedding/tests 403endif 404endif 405 406# os2embed 407ifeq ($(OS_ARCH),OS2) 408ifneq (,$(ENABLE_TESTS)$(MOZILLA_OFFICIAL)) 409tier_99_dirs += embedding/tests 410endif 411endif 412 413ifeq ($(MOZ_BUILD_APP),macbrowser) 414tier_99_dirs += \ 415 embedding/config \ 416 camino \ 417 $(NULL) 418endif 419 420# test harnesses 421ifdef ENABLE_TESTS 422tier_99_dirs += tools/test-harness 423endif 424 425else 426 427# Standalone build 428 429DIRS = $(BUILD_MODULE_DIRS) 430 431# Hack to generate xpidl Makefile 432ifneq ($(BUILD_MODULES),all) 433ifneq (,$(findstring xpcom, $(BUILD_MODULE_DIRS))) 434DIRS := xpcom/typelib $(DIRS) 435SUBMAKEFILES := xpcom/typelib/Makefile 436endif 437endif 438 439default:: $(SUBMAKEFILES) 440 $(MAKE) export 441 $(MAKE) libs 442 443endif # BUILD_MODULES == all 444 445STATIC_MAKEFILES := nsprpub directory/c-sdk security/nss 446 447GARBAGE_DIRS += dist 448DIST_GARBAGE = config.cache config.log config.status config-defs.h \ 449 dependencies.beos config/autoconf.mk config/myrules.mk config/myconfig.mk \ 450 unallmakefiles mozilla-config.h \ 451 $(topsrcdir)/.mozconfig.mk $(topsrcdir)/.mozconfig.out 452 453# Build pseudo-external modules first when export is explicitly called 454export:: 455 $(RM) -rf $(DIST)/sdk 456 $(MAKE) -C config export 457 $(MAKE) nspr 458 $(MAKE) ldap 459ifneq ($(BUILD_MODULES),all) 460ifneq (,$(findstring xpcom, $(BUILD_MODULE_DIRS))) 461 $(MAKE) -C xpcom/typelib 462 $(MAKE) export-idl 463endif 464endif 465 466install:: 467ifndef MOZ_NATIVE_NSPR 468 $(MAKE) -C nsprpub real_install DESTDIR=$(DESTDIR) libdir=$(mozappdir) includedir=$(includedir)/nspr 469 $(RM) -f $(addprefix $(DESTDIR)$(mozappdir)/$(LIB_PREFIX), $(addsuffix .$(LIB_SUFFIX), nspr4 plds4 plc4)) 470 $(RM) -f $(addprefix $(DESTDIR)$(bindir)/,nspr-config compile-et.pl prerr.properties) 471endif 472ifdef MOZ_LDAP_XPCOM 473 $(MAKE) -C directory/c-sdk real_install DESTDIR=$(DESTDIR) libdir=$(mozappdir) includedir=$(includedir)/ldap 474endif 475 476include $(topsrcdir)/config/rules.mk 477 478# Clean up after pseudo-external modules 479clean clobber realclean clobber_all distclean:: 480ifndef MOZ_NATIVE_NSPR 481 $(MAKE) -C nsprpub $@ 482endif 483ifdef MOZ_LDAP_XPCOM 484 $(MAKE) -C directory/c-sdk $@ 485endif 486 487# Map mozilla targets to standard automake target 488ifdef MOZ_ENABLE_LIBXUL 489tier_50: $(addsuffix /Makefile, $(filter-out $(STATIC_MAKEFILES), $($@_dirs))) 490 @echo "tier_50: $(tier_50_dirs)" 491 @$(EXIT_ON_ERROR) \ 492 for d in $(tier_50_dirs); do \ 493 $(UPDATE_TITLE) \ 494 if test ! -f $$d/Makefile; then \ 495 $(PERL) $(AUTOCONF_TOOLS)/make-makefile -t $(topsrcdir) -d $(DEPTH) $(CYGWIN_TOPSRCDIR) $$d/Makefile; \ 496 fi; \ 497 $(MAKE) -C $$d export; \ 498 done ; \ 499 for d in $(tier_50_dirs); do \ 500 $(UPDATE_TITLE) \ 501 $(MAKE) -C $$d libs; \ 502 done 503 @echo "Building tools from tier 2/9/50" 504 @$(EXIT_ON_ERROR) \ 505 for d in $(tier_2_dirs) $(tier_9_dirs) $(tier_50_dirs); do \ 506 $(UPDATE_TITLE) \ 507 $(MAKE) -C $$d tools; \ 508 done; 509endif 510 511tier_%: 512 @echo "$@: $($@_dirs)" 513 @$(EXIT_ON_ERROR) \ 514 for d in $($@_dirs); do \ 515 $(UPDATE_TITLE) \ 516 if test ! -f $$d/Makefile; then \ 517 $(PERL) $(AUTOCONF_TOOLS)/make-makefile -t $(topsrcdir) -d $(DEPTH) $(CYGWIN_TOPSRCDIR) $$d/Makefile; \ 518 fi; \ 519 $(MAKE) -C $$d export; \ 520 done ; \ 521 for d in $($@_dirs); do $(UPDATE_TITLE) \ 522 $(MAKE) -C $$d libs; \ 523 done 524 525# 526# Individual modules 527# 528boehm: 529ifdef GC_LEAK_DETECTOR 530 $(MAKE) -C gc/boehm 531endif 532 533nspr: boehm 534ifndef MOZ_NATIVE_NSPR 535 $(MAKE) -C nsprpub 536endif 537 538ldap: 539ifdef MOZ_LDAP_XPCOM 540 $(MAKE) -C directory/c-sdk 541endif 542 543distclean:: 544 cat unallmakefiles | $(XARGS) rm -f 545 rm -f unallmakefiles $(DIST_GARBAGE) 546 547ifeq ($(OS_ARCH),WINNT) 548rebase: 549ifdef MOZILLA_OFFICIAL 550 echo rebasing $(DIST) 551 /bin/find $(DIST) -name "*.dll" > rebase.lst 552 rebase -b 60000000 -R . -G rebase.lst 553 rm rebase.lst 554endif 555 556splitsymbols: 557ifdef MOZILLA_OFFICIAL 558ifdef MOZ_DEBUG_SYMBOLS 559 echo finding pdb files 560 mkdir -p $(DIST)/$(BUILDID) 561 -cp `/bin/find . -path "./dist" -prune -o -name "*.dll" | sed "s/\.dll$$/\.pdb/" | xargs` $(DIST)/$(BUILDID) 562 -cp `/bin/find . -path "./dist" -prune -o -name "*.exe" | sed "s/\.exe$$/\.pdb/" | xargs` $(DIST)/$(BUILDID) 563 -cp `/bin/find . -path "./dist" -prune -o -name "*.EXE" | sed "s/\.EXE$$/\.pdb/" | xargs` $(DIST)/$(BUILDID) 564endif # MOZ_DEBUG_SYMBOLS 565ifdef MOZ_PROFILE 566 echo splitting symbols out of binaries 567 /bin/find $(DIST) -name "*.dll" -exec splitsym {} \; 568 /bin/find $(DIST) -name "*.exe" -exec splitsym {} \; 569 /bin/find $(DIST) -name "*.EXE" -exec splitsym {} \; 570 mkdir -p $(DIST)/$(BUILDID) 571 /bin/find $(DIST) -name "*.dbg" -exec mv {} $(DIST)/$(BUILDID) \; 572endif # MOZ_PROFILE 573endif # MOZILLA_OFFICIAL 574 575signnss: 576ifdef MOZILLA_OFFICIAL 577 echo signing NSS libs 578 cd $(DIST)/bin; ./shlibsign.exe -v -i softokn3.dll 579 cd $(DIST)/bin; ./shlibsign.exe -v -i freebl3.dll 580endif # MOZILLA_OFFICIAL 581 582BUILDID = $(shell cat $(DEPTH)/config/build_number) 583deliver: splitsymbols rebase signnss 584 585endif # WINNT 586 587