Bug 736066 - Build NSS object files more like the rest of the tree, and simplify security/manager/Makefile.in. r=ted
☠☠ backed out by 4a8a5e8ef78b ☠ ☠
authorMike Hommey <mh+mozilla@glandium.org>
Sat, 31 Mar 2012 09:25:23 +0200
changeset 94089 369ad04efa1fe15d006ebc41dce6503c81850ad2
parent 94088 82c315c0bd1446798b74edc9a7be7b695a14de1e
child 94090 5a5a55d435ca2bc3ba65fa606d620e1033932b55
push id886
push userlsblakk@mozilla.com
push dateMon, 04 Jun 2012 19:57:52 +0000
treeherdermozilla-beta@bbd8d5efd6d1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersted
bugs736066
milestone14.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 736066 - Build NSS object files more like the rest of the tree, and simplify security/manager/Makefile.in. r=ted
security/manager/Makefile.in
--- a/security/manager/Makefile.in
+++ b/security/manager/Makefile.in
@@ -179,19 +179,20 @@ DEFAULT_GMAKE_FLAGS += NSINSTALL="$(NSIN
 ifndef MOZ_NATIVE_SQLITE
 DEFAULT_GMAKE_FLAGS += SQLITE_LIB_NAME=mozsqlite3
 DEFAULT_GMAKE_FLAGS += SQLITE_INCLUDE_DIR=$(ABS_DIST)/include
 endif
 ifdef NSS_DISABLE_DBM 
 DEFAULT_GMAKE_FLAGS += NSS_DISABLE_DBM=1
 endif
 ABS_topsrcdir   := $(call core_abspath,$(topsrcdir))
-ifneq ($(ABS_topsrcdir),$(MOZ_BUILD_ROOT))
-DEFAULT_GMAKE_FLAGS += BUILD_TREE=$(MOZ_BUILD_ROOT)
-endif
+# Hack to force NSS build system to use "normal" object directories
+DEFAULT_GMAKE_FLAGS += BUILD='$(MOZ_BUILD_ROOT)/security/$$(subst $(shell cd $(topsrcdir); pwd)/security/,,$$(CURDIR))'
+DEFAULT_GMAKE_FLAGS += BUILD_TREE='$$(BUILD)' OBJDIR='$$(BUILD)' DEPENDENCIES='$$(BUILD)/.deps' SINGLE_SHLIB_DIR='$$(BUILD)'
+DEFAULT_GMAKE_FLAGS += SOURCE_XP_DIR=$(ABS_DIST)
 ifndef MOZ_DEBUG
 DEFAULT_GMAKE_FLAGS += BUILD_OPT=1 OPT_CODE_SIZE=1
 endif
 ifdef GNU_CC
 DEFAULT_GMAKE_FLAGS += NS_USE_GCC=1
 else
 DEFAULT_GMAKE_FLAGS += NS_USE_GCC=
 endif
@@ -280,20 +281,16 @@ endif
 
 ifdef MOZ_NO_WLZDEFS
 DEFAULT_GMAKE_FLAGS += ZDEFS_FLAG=
 endif
 ifdef MOZ_CFLAGS_NSS
 DEFAULT_GMAKE_FLAGS += XCFLAGS="$(CFLAGS)"
 endif
 
-SUBMAKEFILES = boot/Makefile ssl/Makefile pki/Makefile locales/Makefile
-
-include $(topsrcdir)/config/rules.mk
-
 ifdef MOZ_NSS_PATCH
 # If we're applying a patch, we'll copy the NSS source to the objdir
 # and build it from there.
 NSS_SRCDIR = $(CURDIR)/nss
 
 # This will copy and patch the NSS source for every build.
 # Since we "cp -p", it won't force rebuilds for most files, just
 # for patched files, but that's easier than trying to track
@@ -305,123 +302,86 @@ export::
 	cp -Rp $(topsrcdir)/security/coreconf $(NSS_SRCDIR)/security
 	cp -Rp $(topsrcdir)/security/dbm $(NSS_SRCDIR)/security
 	cp -Rp $(topsrcdir)/dbm $(NSS_SRCDIR)
 	(cd $(NSS_SRCDIR) && patch -p1 < $(call core_abspath,$(MOZ_NSS_PATCH)))
 else
 NSS_SRCDIR = $(topsrcdir)
 endif
 
-dependclean export packages chrome::
-	$(MAKE) -C boot $@
-	$(MAKE) -C ssl $@
-	$(MAKE) -C locales $@
-ifdef MOZ_XUL
-	$(MAKE) -C pki $@
+NSS_DIRS =
+ifndef NSS_DISABLE_DBM
+NSS_DIRS += dbm
+endif
+NSS_DIRS += \
+  nss/lib \
+  nss/cmd/lib \
+  nss/cmd/shlibsign \
+  $(NULL)
+
+ifdef ENABLE_TESTS
+NSS_DIRS += \
+  nss/cmd/certutil \
+  nss/cmd/pk12util \
+  nss/cmd/modutil \
+  $(NULL)
 endif
 
+ifndef MOZ_NATIVE_NSS
+define build_rules
+libs::
+	$$(NSSMAKE) -C $$(NSS_SRCDIR)/security/$(1) $$(DEFAULT_GMAKE_FLAGS)
+
+clean clobber clobber_all realclean distclean depend::
+	$$(NSSMAKE) -C $$(NSS_SRCDIR)/security/$(1) $$(DEFAULT_GMAKE_FLAGS) clean
+endef
+$(foreach dir,$(NSS_DIRS),$(eval $(call build_rules,$(dir))))
+
+NSS_LIBS = \
+  $(LOADABLE_ROOT_MODULE) \
+  $(SOFTOKEN3_LIB) \
+  $(NSSDBM3_LIB) \
+  $(NSS3_LIB) \
+  $(NSSUTIL3_LIB) \
+  $(SSL3_LIB) \
+  $(SMIME3_LIB) \
+  $(FREEBL_LIB) \
+  $(FREEBL_32INT_LIB) \
+  $(FREEBL_32FPU_LIB) \
+  $(FREEBL_32INT64_LIB) \
+  $(FREEBL_64INT_LIB) \
+  $(FREEBL_64FPU_LIB) \
+  $(NULL)
+
+define install_rules
+libs::
+ifeq ($(OS_ARCH)_$(1), SunOS_$(SOFTOKEN3_LIB))
+# has to use copy mode on Solaris, see #665509
+	$$(NSINSTALL) -t -m 755 $$(DIST)/lib/$(1) $$(DIST)/bin
+else
+	$$(INSTALL) -m 755 $$(DIST)/lib/$(1) $$(DIST)/bin
+endif
+
+install::
+	$$(SYSINSTALL) -m 755 $$(DIST)/lib/$(1) $$(DESTDIR)$$(mozappdir)
+endef
+$(foreach lib,$(NSS_LIBS),$(eval $(call install_rules,$(lib))))
+
 libs::
-ifndef MOZ_NATIVE_NSS
-ifndef NSS_DISABLE_DBM
-	$(NSSMAKE) -C $(NSS_SRCDIR)/security/dbm $(DEFAULT_GMAKE_FLAGS) 
-endif
-	$(NSSMAKE) -C $(NSS_SRCDIR)/security/nss/lib $(DEFAULT_GMAKE_FLAGS)
-ifdef ENABLE_TESTS
-# Need certutil binary for mochitest certificates generation
-	$(NSSMAKE) -C $(NSS_SRCDIR)/security/nss/cmd/lib $(DEFAULT_GMAKE_FLAGS)
-	$(NSSMAKE) -C $(NSS_SRCDIR)/security/nss/cmd/certutil $(DEFAULT_GMAKE_FLAGS)
-	$(NSSMAKE) -C $(NSS_SRCDIR)/security/nss/cmd/pk12util $(DEFAULT_GMAKE_FLAGS)
-	$(NSSMAKE) -C $(NSS_SRCDIR)/security/nss/cmd/modutil $(DEFAULT_GMAKE_FLAGS)
-endif
-ifndef ENABLE_TESTS # Just avoid secondary compile
-	$(NSSMAKE) -C $(NSS_SRCDIR)/security/nss/cmd/lib $(DEFAULT_GMAKE_FLAGS)
-endif
-	$(NSSMAKE) -C $(NSS_SRCDIR)/security/nss/cmd/shlibsign $(DEFAULT_GMAKE_FLAGS)
-	$(INSTALL) -m 755 $(DIST)/lib/$(LOADABLE_ROOT_MODULE) $(DIST)/bin
-ifeq ($(OS_ARCH), SunOS)
-# has to use copy mode on Solaris, see #665509
-	$(NSINSTALL) -t -m 755 $(DIST)/lib/$(SOFTOKEN3_LIB) $(DIST)/bin
-else
-	$(INSTALL) -m 755 $(DIST)/lib/$(SOFTOKEN3_LIB) $(DIST)/bin
-endif
-ifndef NSS_DISABLE_DBM
-	$(INSTALL) -m 755 $(DIST)/lib/$(NSSDBM3_LIB) $(DIST)/bin
-endif
-	$(INSTALL) -m 755 $(DIST)/lib/$(NSS3_LIB) $(DIST)/bin
-	$(INSTALL) -m 755 $(DIST)/lib/$(NSSUTIL3_LIB) $(DIST)/bin
-	$(INSTALL) -m 755 $(DIST)/lib/$(SSL3_LIB) $(DIST)/bin
-	$(INSTALL) -m 755 $(DIST)/lib/$(SMIME3_LIB) $(DIST)/bin
 	$(INSTALL) -m 755 $(SDK_LIBS) $(DIST)/sdk/lib
-ifdef HAVE_FREEBL_LIBS
-	$(INSTALL) -m 755 $(DIST)/lib/$(FREEBL_LIB) $(DIST)/bin
-endif
-ifdef HAVE_FREEBL_LIBS_32
-	$(INSTALL) -m 755 $(DIST)/lib/$(FREEBL_32INT_LIB) $(DIST)/bin
-	$(INSTALL) -m 755 $(DIST)/lib/$(FREEBL_32FPU_LIB) $(DIST)/bin
-endif
-ifdef HAVE_FREEBL_LIBS_32INT64
-	$(INSTALL) -m 755 $(DIST)/lib/$(FREEBL_32INT64_LIB) $(DIST)/bin
-endif
-ifdef HAVE_FREEBL_LIBS_64
-	$(INSTALL) -m 755 $(DIST)/lib/$(FREEBL_64INT_LIB) $(DIST)/bin
-	$(INSTALL) -m 755 $(DIST)/lib/$(FREEBL_64FPU_LIB) $(DIST)/bin
-endif
-endif
-ifndef MOZ_NATIVE_NSS
 # NSS installs headers to dist/public and we want them in dist/include
 	$(NSINSTALL) -D $(DIST)/include/nss
 	(cd $(DIST)/public/nss && tar $(TAR_CREATE_FLAGS) - .) | \
 	  (cd $(DIST)/include && tar -xf -)
-endif
-	$(MAKE) -C boot $@
-	$(MAKE) -C ssl $@
-	$(MAKE) -C locales $@
+
+endif # MOZ_NATIVE_NSS
+
+DIRS = \
+  boot \
+  ssl \
+  locales \
+  $(NULL)
+
 ifdef MOZ_XUL
-	$(MAKE) -C pki $@
+DIRS += pki
 endif
 
-check::
-	$(MAKE) -C ssl $@
-
-install::
-ifndef MOZ_NATIVE_NSS
-	$(SYSINSTALL) -m 755 $(DIST)/lib/$(LOADABLE_ROOT_MODULE) $(DESTDIR)$(mozappdir)
-	$(SYSINSTALL) -m 755 $(DIST)/lib/$(SOFTOKEN3_LIB) $(DESTDIR)$(mozappdir)
-	$(SYSINSTALL) -m 755 $(DIST)/lib/$(NSSDBM3_LIB) $(DESTDIR)$(mozappdir)
-	$(SYSINSTALL) -m 755 $(DIST)/lib/$(NSS3_LIB) $(DESTDIR)$(mozappdir)
-	$(SYSINSTALL) -m 755 $(DIST)/lib/$(NSSUTIL3_LIB) $(DESTDIR)$(mozappdir)
-	$(SYSINSTALL) -m 755 $(DIST)/lib/$(SSL3_LIB) $(DESTDIR)$(mozappdir)
-	$(SYSINSTALL) -m 755 $(DIST)/lib/$(SMIME3_LIB) $(DESTDIR)$(mozappdir)
-ifdef HAVE_FREEBL_LIBS
-	$(SYSINSTALL) -m 755 $(DIST)/lib/$(FREEBL_LIB) $(DESTDIR)$(mozappdir)
-endif
-ifdef HAVE_FREEBL_LIBS_32
-	$(SYSINSTALL) -m 755 $(DIST)/lib/$(FREEBL_32INT_LIB) $(DESTDIR)$(mozappdir)
-	$(SYSINSTALL) -m 755 $(DIST)/lib/$(FREEBL_32FPU_LIB) $(DESTDIR)$(mozappdir)
-endif
-ifdef HAVE_FREEBL_LIBS_32INT64
-	$(SYSINSTALL) -m 755 $(DIST)/lib/$(FREEBL_32INT64_LIB) $(DESTDIR)$(mozappdir)
-endif
-ifdef HAVE_FREEBL_LIBS_64
-	$(SYSINSTALL) -m 755 $(DIST)/lib/$(FREEBL_64INT_LIB) $(DESTDIR)$(mozappdir)
-	$(SYSINSTALL) -m 755 $(DIST)/lib/$(FREEBL_64FPU_LIB) $(DESTDIR)$(mozappdir)
-endif
-endif
-	$(MAKE) -C boot $@
-	$(MAKE) -C ssl $@
-	$(MAKE) -C locales $@
-ifdef MOZ_XUL
-	$(MAKE) -C pki $@
-endif
-
-clean clobber clobber_all realclean distclean depend::
-	$(MAKE) -C boot $@
-	$(MAKE) -C ssl $@
-	$(MAKE) -C locales $@
-ifdef MOZ_XUL
-	$(MAKE) -C pki $@
-endif
-ifndef MOZ_NATIVE_NSS
-	$(NSSMAKE) -C $(NSS_SRCDIR)/security/coreconf $(DEFAULT_GMAKE_FLAGS) clean
-	$(NSSMAKE) -C $(NSS_SRCDIR)/security/nss/lib $(DEFAULT_GMAKE_FLAGS) clean
-	$(NSSMAKE) -C $(NSS_SRCDIR)/security/nss/cmd/lib $(DEFAULT_GMAKE_FLAGS) clean
-	$(NSSMAKE) -C $(NSS_SRCDIR)/security/nss/cmd/shlibsign $(DEFAULT_GMAKE_FLAGS) clean
-endif
+include $(topsrcdir)/config/rules.mk