Bug 787184 - Use generic install/copy rule in target_libs.mk. r=ted
authorMike Hommey <mh+mozilla@glandium.org>
Thu, 20 Sep 2012 09:52:12 +0200
changeset 107724 0fab33837886a195b702b01da8ef5ad00eb8aa9e
parent 107723 35ab0d75e5ef6339602efe7353b82596d18a0bca
child 107725 60db83025921c2bbe85b9603255072ca85ddbc22
push id82
push usershu@rfrn.org
push dateFri, 05 Oct 2012 13:20:22 +0000
reviewersted
bugs787184
milestone18.0a1
Bug 787184 - Use generic install/copy rule in target_libs.mk. r=ted
config/makefiles/target_libs.mk
config/rules.mk
js/src/config/makefiles/target_libs.mk
js/src/config/rules.mk
--- a/config/makefiles/target_libs.mk
+++ b/config/makefiles/target_libs.mk
@@ -39,67 +39,96 @@ else
 EXPORT_LIBRARY = $(DEPTH)/staticlib
 endif
 else
 # If EXPORT_LIBRARY has a value, we'll be installing there. We also need to cleanup there
 GARBAGE += $(foreach lib,$(LIBRARY),$(EXPORT_LIBRARY)/$(lib))
 endif
 endif # EXPORT_LIBRARY
 
-libs:: $(SUBMAKEFILES) $(MAKE_DIRS) $(HOST_LIBRARY) $(LIBRARY) $(SHARED_LIBRARY) $(IMPORT_LIBRARY) $(HOST_PROGRAM) $(PROGRAM) $(HOST_SIMPLE_PROGRAMS) $(SIMPLE_PROGRAMS) $(JAVA_LIBRARY)
+libs:: $(SUBMAKEFILES) $(MAKE_DIRS) $(HOST_LIBRARY) $(LIBRARY) $(SHARED_LIBRARY) $(IMPORT_LIBRARY) $(HOST_PROGRAM) $(HOST_SIMPLE_PROGRAMS) $(SIMPLE_PROGRAMS) $(JAVA_LIBRARY)
 ifndef NO_DIST_INSTALL
-ifdef LIBRARY
-ifdef EXPORT_LIBRARY # Stage libs that will be linked into a static build
-	$(INSTALL) $(IFLAGS1) $(LIBRARY) $(EXPORT_LIBRARY)
-endif # EXPORT_LIBRARY
-ifdef DIST_INSTALL
-ifdef IS_COMPONENT
-	$(error Shipping static component libs makes no sense.)
-else
-	$(INSTALL) $(IFLAGS1) $(LIBRARY) $(DIST)/lib
-endif
-endif # DIST_INSTALL
-endif # LIBRARY
 ifdef SHARED_LIBRARY
 ifdef IS_COMPONENT
 	$(INSTALL) $(IFLAGS2) $(SHARED_LIBRARY) $(FINAL_TARGET)/components
 	$(ELF_DYNSTR_GC) $(FINAL_TARGET)/components/$(SHARED_LIBRARY)
 ifndef NO_COMPONENTS_MANIFEST
 	@$(PYTHON) $(MOZILLA_DIR)/config/buildlist.py $(FINAL_TARGET)/chrome.manifest "manifest components/components.manifest"
 	@$(PYTHON) $(MOZILLA_DIR)/config/buildlist.py $(FINAL_TARGET)/components/components.manifest "binary-component $(SHARED_LIBRARY)"
 endif
-else # ! IS_COMPONENT
-ifneq (,$(filter OS2 WINNT,$(OS_ARCH)))
-ifndef NO_INSTALL_IMPORT_LIBRARY
-	$(INSTALL) $(IFLAGS2) $(IMPORT_LIBRARY) $(DIST)/lib
-endif
-else
-	$(INSTALL) $(IFLAGS2) $(SHARED_LIBRARY) $(DIST)/lib
-endif
-	$(INSTALL) $(IFLAGS2) $(SHARED_LIBRARY) $(FINAL_TARGET)
 endif # IS_COMPONENT
 endif # SHARED_LIBRARY
-ifdef PROGRAM
-	$(INSTALL) $(IFLAGS2) $(PROGRAM) $(FINAL_TARGET)
-endif
-ifdef SIMPLE_PROGRAMS
-	$(INSTALL) $(IFLAGS2) $(SIMPLE_PROGRAMS) $(FINAL_TARGET)
-endif
-ifdef HOST_PROGRAM
-	$(INSTALL) $(IFLAGS2) $(HOST_PROGRAM) $(DIST)/host/bin
-endif
-ifdef HOST_SIMPLE_PROGRAMS
-	$(INSTALL) $(IFLAGS2) $(HOST_SIMPLE_PROGRAMS) $(DIST)/host/bin
-endif
-ifdef HOST_LIBRARY
-	$(INSTALL) $(IFLAGS1) $(HOST_LIBRARY) $(DIST)/host/lib
-endif
-ifdef JAVA_LIBRARY
-ifdef IS_COMPONENT
-	$(INSTALL) $(IFLAGS1) $(JAVA_LIBRARY) $(FINAL_TARGET)/components
-else
-	$(INSTALL) $(IFLAGS1) $(JAVA_LIBRARY) $(FINAL_TARGET)
-endif
-endif # JAVA_LIBRARY
 endif # !NO_DIST_INSTALL
 	$(LOOP_OVER_DIRS)
 
+ifndef NO_DIST_INSTALL
+
+ifneq (,$(strip $(PROGRAM)$(SIMPLE_PROGRAMS)))
+PROGRAMS_EXECUTABLES = $(SIMPLE_PROGRAMS) $(PROGRAM)
+PROGRAMS_DEST ?= $(FINAL_TARGET)
+INSTALL_TARGETS += PROGRAMS
+endif
+
+ifdef LIBRARY
+ifdef EXPORT_LIBRARY
+LIBRARY_FILES = $(LIBRARY)
+LIBRARY_DEST ?= $(EXPORT_LIBRARY)
+INSTALL_TARGETS += LIBRARY
+endif
+ifdef DIST_INSTALL
+ifdef IS_COMPONENT
+$(error Shipping static component libs makes no sense.)
+else
+DIST_LIBRARY_FILES = $(LIBRARY)
+DIST_LIBRARY_DEST ?= $(DIST)/lib
+INSTALL_TARGETS += DIST_LIBRARY
+endif
+endif # DIST_INSTALL
+endif # LIBRARY
+
+
+ifdef SHARED_LIBRARY
+ifndef IS_COMPONENT
+SHARED_LIBRARY_FILES = $(SHARED_LIBRARY)
+SHARED_LIBRARY_DEST ?= $(FINAL_TARGET)
+INSTALL_TARGETS += SHARED_LIBRARY
+
+ifneq (,$(filter OS2 WINNT,$(OS_ARCH)))
+ifndef NO_INSTALL_IMPORT_LIBRARY
+IMPORT_LIB_FILES = $(IMPORT_LIBRARY)
+endif # NO_INSTALL_IMPORT_LIBRARY
+else
+IMPORT_LIB_FILES = $(SHARED_LIBRARY)
+endif
+
+IMPORT_LIB_DEST ?= $(DIST)/lib
+ifdef IMPORT_LIB_FILES
+INSTALL_TARGETS += IMPORT_LIB
+endif
+
+endif # ! IS_COMPONENT
+endif # SHARED_LIBRARY
+
+ifneq (,$(strip $(HOST_SIMPLE_PROGRAMS)$(HOST_PROGRAM)))
+HOST_PROGRAMS_EXECUTABLES = $(HOST_SIMPLE_PROGRAMS) $(HOST_PROGRAM)
+HOST_PROGRAMS_DEST ?= $(DIST)/host/bin
+INSTALL_TARGETS += HOST_PROGRAMS
+endif
+
+ifdef HOST_LIBRARY
+HOST_LIBRARY_FILES = $(HOST_LIBRARY)
+HOST_LIBRARY_DEST ?= $(DIST)/host/lib
+INSTALL_TARGETS += HOST_LIBRARY
+endif
+
+ifdef JAVA_LIBRARY
+JAVA_LIBRARY_FILES = $(JAVA_LIBRARY)
+ifdef IS_COMPONENT
+JAVA_LIBRARY_DEST ?= $(FINAL_TARGET)/components
+else
+JAVA_LIBRARY_DEST ?= $(FINAL_TARGET)
+endif
+INSTALL_TARGETS += JAVA_LIBRARY
+endif
+
+endif # !NO_DIST_INSTALL
+
 # EOF
--- a/config/rules.mk
+++ b/config/rules.mk
@@ -57,22 +57,16 @@ else
   ELOG :=
 endif # -s
 else
   ELOG :=
 endif # ifndef .PYMAKE
 
 _VPATH_SRCS = $(abspath $<)
 
-# Add $(DIST)/lib to VPATH so that -lfoo dependencies are followed
-VPATH += $(DIST)/lib
-ifdef LIBXUL_SDK
-VPATH += $(LIBXUL_SDK)/lib
-endif
-
 ifdef EXTRA_DSO_LIBS
 EXTRA_DSO_LIBS	:= $(call EXPAND_MOZLIBNAME,$(EXTRA_DSO_LIBS))
 endif
 
 ################################################################################
 # Testing frameworks support
 ################################################################################
 
@@ -1604,19 +1598,16 @@ endif
 .PHONY: all alltags boot checkout chrome realchrome clean clobber clobber_all export install libs makefiles realclean run_apprunner tools $(DIRS) $(TOOL_DIRS) FORCE
 
 # Used as a dependency to force targets to rebuild
 FORCE:
 
 # Delete target if error occurs when building target
 .DELETE_ON_ERROR:
 
-# Properly set LIBPATTERNS for the platform
-.LIBPATTERNS = $(if $(IMPORT_LIB_SUFFIX),$(LIB_PREFIX)%.$(IMPORT_LIB_SUFFIX)) $(LIB_PREFIX)%.$(LIB_SUFFIX) $(DLL_PREFIX)%$(DLL_SUFFIX)
-
 tags: TAGS
 
 TAGS: $(SUBMAKEFILES) $(CSRCS) $(CPPSRCS) $(wildcard *.h)
 	-etags $(CSRCS) $(CPPSRCS) $(wildcard *.h)
 	$(LOOP_OVER_PARALLEL_DIRS)
 	$(LOOP_OVER_DIRS)
 
 ifndef INCLUDED_DEBUGMAKE_MK #{
--- a/js/src/config/makefiles/target_libs.mk
+++ b/js/src/config/makefiles/target_libs.mk
@@ -39,67 +39,96 @@ else
 EXPORT_LIBRARY = $(DEPTH)/staticlib
 endif
 else
 # If EXPORT_LIBRARY has a value, we'll be installing there. We also need to cleanup there
 GARBAGE += $(foreach lib,$(LIBRARY),$(EXPORT_LIBRARY)/$(lib))
 endif
 endif # EXPORT_LIBRARY
 
-libs:: $(SUBMAKEFILES) $(MAKE_DIRS) $(HOST_LIBRARY) $(LIBRARY) $(SHARED_LIBRARY) $(IMPORT_LIBRARY) $(HOST_PROGRAM) $(PROGRAM) $(HOST_SIMPLE_PROGRAMS) $(SIMPLE_PROGRAMS) $(JAVA_LIBRARY)
+libs:: $(SUBMAKEFILES) $(MAKE_DIRS) $(HOST_LIBRARY) $(LIBRARY) $(SHARED_LIBRARY) $(IMPORT_LIBRARY) $(HOST_PROGRAM) $(HOST_SIMPLE_PROGRAMS) $(SIMPLE_PROGRAMS) $(JAVA_LIBRARY)
 ifndef NO_DIST_INSTALL
-ifdef LIBRARY
-ifdef EXPORT_LIBRARY # Stage libs that will be linked into a static build
-	$(INSTALL) $(IFLAGS1) $(LIBRARY) $(EXPORT_LIBRARY)
-endif # EXPORT_LIBRARY
-ifdef DIST_INSTALL
-ifdef IS_COMPONENT
-	$(error Shipping static component libs makes no sense.)
-else
-	$(INSTALL) $(IFLAGS1) $(LIBRARY) $(DIST)/lib
-endif
-endif # DIST_INSTALL
-endif # LIBRARY
 ifdef SHARED_LIBRARY
 ifdef IS_COMPONENT
 	$(INSTALL) $(IFLAGS2) $(SHARED_LIBRARY) $(FINAL_TARGET)/components
 	$(ELF_DYNSTR_GC) $(FINAL_TARGET)/components/$(SHARED_LIBRARY)
 ifndef NO_COMPONENTS_MANIFEST
 	@$(PYTHON) $(MOZILLA_DIR)/config/buildlist.py $(FINAL_TARGET)/chrome.manifest "manifest components/components.manifest"
 	@$(PYTHON) $(MOZILLA_DIR)/config/buildlist.py $(FINAL_TARGET)/components/components.manifest "binary-component $(SHARED_LIBRARY)"
 endif
-else # ! IS_COMPONENT
-ifneq (,$(filter OS2 WINNT,$(OS_ARCH)))
-ifndef NO_INSTALL_IMPORT_LIBRARY
-	$(INSTALL) $(IFLAGS2) $(IMPORT_LIBRARY) $(DIST)/lib
-endif
-else
-	$(INSTALL) $(IFLAGS2) $(SHARED_LIBRARY) $(DIST)/lib
-endif
-	$(INSTALL) $(IFLAGS2) $(SHARED_LIBRARY) $(FINAL_TARGET)
 endif # IS_COMPONENT
 endif # SHARED_LIBRARY
-ifdef PROGRAM
-	$(INSTALL) $(IFLAGS2) $(PROGRAM) $(FINAL_TARGET)
-endif
-ifdef SIMPLE_PROGRAMS
-	$(INSTALL) $(IFLAGS2) $(SIMPLE_PROGRAMS) $(FINAL_TARGET)
-endif
-ifdef HOST_PROGRAM
-	$(INSTALL) $(IFLAGS2) $(HOST_PROGRAM) $(DIST)/host/bin
-endif
-ifdef HOST_SIMPLE_PROGRAMS
-	$(INSTALL) $(IFLAGS2) $(HOST_SIMPLE_PROGRAMS) $(DIST)/host/bin
-endif
-ifdef HOST_LIBRARY
-	$(INSTALL) $(IFLAGS1) $(HOST_LIBRARY) $(DIST)/host/lib
-endif
-ifdef JAVA_LIBRARY
-ifdef IS_COMPONENT
-	$(INSTALL) $(IFLAGS1) $(JAVA_LIBRARY) $(FINAL_TARGET)/components
-else
-	$(INSTALL) $(IFLAGS1) $(JAVA_LIBRARY) $(FINAL_TARGET)
-endif
-endif # JAVA_LIBRARY
 endif # !NO_DIST_INSTALL
 	$(LOOP_OVER_DIRS)
 
+ifndef NO_DIST_INSTALL
+
+ifneq (,$(strip $(PROGRAM)$(SIMPLE_PROGRAMS)))
+PROGRAMS_EXECUTABLES = $(SIMPLE_PROGRAMS) $(PROGRAM)
+PROGRAMS_DEST ?= $(FINAL_TARGET)
+INSTALL_TARGETS += PROGRAMS
+endif
+
+ifdef LIBRARY
+ifdef EXPORT_LIBRARY
+LIBRARY_FILES = $(LIBRARY)
+LIBRARY_DEST ?= $(EXPORT_LIBRARY)
+INSTALL_TARGETS += LIBRARY
+endif
+ifdef DIST_INSTALL
+ifdef IS_COMPONENT
+$(error Shipping static component libs makes no sense.)
+else
+DIST_LIBRARY_FILES = $(LIBRARY)
+DIST_LIBRARY_DEST ?= $(DIST)/lib
+INSTALL_TARGETS += DIST_LIBRARY
+endif
+endif # DIST_INSTALL
+endif # LIBRARY
+
+
+ifdef SHARED_LIBRARY
+ifndef IS_COMPONENT
+SHARED_LIBRARY_FILES = $(SHARED_LIBRARY)
+SHARED_LIBRARY_DEST ?= $(FINAL_TARGET)
+INSTALL_TARGETS += SHARED_LIBRARY
+
+ifneq (,$(filter OS2 WINNT,$(OS_ARCH)))
+ifndef NO_INSTALL_IMPORT_LIBRARY
+IMPORT_LIB_FILES = $(IMPORT_LIBRARY)
+endif # NO_INSTALL_IMPORT_LIBRARY
+else
+IMPORT_LIB_FILES = $(SHARED_LIBRARY)
+endif
+
+IMPORT_LIB_DEST ?= $(DIST)/lib
+ifdef IMPORT_LIB_FILES
+INSTALL_TARGETS += IMPORT_LIB
+endif
+
+endif # ! IS_COMPONENT
+endif # SHARED_LIBRARY
+
+ifneq (,$(strip $(HOST_SIMPLE_PROGRAMS)$(HOST_PROGRAM)))
+HOST_PROGRAMS_EXECUTABLES = $(HOST_SIMPLE_PROGRAMS) $(HOST_PROGRAM)
+HOST_PROGRAMS_DEST ?= $(DIST)/host/bin
+INSTALL_TARGETS += HOST_PROGRAMS
+endif
+
+ifdef HOST_LIBRARY
+HOST_LIBRARY_FILES = $(HOST_LIBRARY)
+HOST_LIBRARY_DEST ?= $(DIST)/host/lib
+INSTALL_TARGETS += HOST_LIBRARY
+endif
+
+ifdef JAVA_LIBRARY
+JAVA_LIBRARY_FILES = $(JAVA_LIBRARY)
+ifdef IS_COMPONENT
+JAVA_LIBRARY_DEST ?= $(FINAL_TARGET)/components
+else
+JAVA_LIBRARY_DEST ?= $(FINAL_TARGET)
+endif
+INSTALL_TARGETS += JAVA_LIBRARY
+endif
+
+endif # !NO_DIST_INSTALL
+
 # EOF
--- a/js/src/config/rules.mk
+++ b/js/src/config/rules.mk
@@ -57,22 +57,16 @@ else
   ELOG :=
 endif # -s
 else
   ELOG :=
 endif # ifndef .PYMAKE
 
 _VPATH_SRCS = $(abspath $<)
 
-# Add $(DIST)/lib to VPATH so that -lfoo dependencies are followed
-VPATH += $(DIST)/lib
-ifdef LIBXUL_SDK
-VPATH += $(LIBXUL_SDK)/lib
-endif
-
 ifdef EXTRA_DSO_LIBS
 EXTRA_DSO_LIBS	:= $(call EXPAND_MOZLIBNAME,$(EXTRA_DSO_LIBS))
 endif
 
 ################################################################################
 # Testing frameworks support
 ################################################################################
 
@@ -1604,19 +1598,16 @@ endif
 .PHONY: all alltags boot checkout chrome realchrome clean clobber clobber_all export install libs makefiles realclean run_apprunner tools $(DIRS) $(TOOL_DIRS) FORCE
 
 # Used as a dependency to force targets to rebuild
 FORCE:
 
 # Delete target if error occurs when building target
 .DELETE_ON_ERROR:
 
-# Properly set LIBPATTERNS for the platform
-.LIBPATTERNS = $(if $(IMPORT_LIB_SUFFIX),$(LIB_PREFIX)%.$(IMPORT_LIB_SUFFIX)) $(LIB_PREFIX)%.$(LIB_SUFFIX) $(DLL_PREFIX)%$(DLL_SUFFIX)
-
 tags: TAGS
 
 TAGS: $(SUBMAKEFILES) $(CSRCS) $(CPPSRCS) $(wildcard *.h)
 	-etags $(CSRCS) $(CPPSRCS) $(wildcard *.h)
 	$(LOOP_OVER_PARALLEL_DIRS)
 	$(LOOP_OVER_DIRS)
 
 ifndef INCLUDED_DEBUGMAKE_MK #{