diff --git a/accessible/src/Makefile.in b/accessible/src/Makefile.in index 39cf7a15b41..f1342b782bd 100644 --- a/accessible/src/Makefile.in +++ b/accessible/src/Makefile.in @@ -75,4 +75,4 @@ endif include $(topsrcdir)/config/rules.mk libs:: - $(INSTALL) $(PLATFORM_DIR)/$(LIB_PREFIX)accessibility_toolkit_s.$(LIB_SUFFIX) . + $(INSTALL) $(PLATFORM_DIR)/$(LIB_PREFIX)accessibility_toolkit_s.$(LIB_SUFFIX) $(wildcard $(PLATFORM_DIR)/$(LIB_PREFIX)accessibility_toolkit_s.$(LIB_SUFFIX).fake) . diff --git a/config/config.mk b/config/config.mk index d1cd7f1f547..3eac9f55764 100644 --- a/config/config.mk +++ b/config/config.mk @@ -80,6 +80,11 @@ $(foreach x,$(CHECK_VARS),$(check-variable)) core_abspath = $(if $(findstring :,$(1)),$(1),$(if $(filter /%,$(1)),$(1),$(CURDIR)/$(1))) +nullstr := +space :=$(nullstr) # EOL + +core_winabspath = $(firstword $(subst /, ,$(call core_abspath,$(1)))):$(subst $(space),,$(patsubst %,\\%,$(wordlist 2,$(words $(subst /, ,$(call core_abspath,$(1)))), $(strip $(subst /, ,$(call core_abspath,$(1))))))) + # FINAL_TARGET specifies the location into which we copy end-user-shipped # build products (typelibs, components, chrome). # @@ -318,6 +323,12 @@ STATIC_LIBRARY_NAME=$(LIBRARY_NAME) endif endif +# GNU make on Windows can't handle using fake libs, because the path +# munging gets confused when we pass response files like @file to the linker. +#ifneq (WINNT_,$(OS_ARCH)_$(.PYMAKE)) +MOZ_FAKELIBS = 1 +#endif + # This comes from configure ifdef MOZ_PROFILE_GUIDED_OPTIMIZE_DISABLE NO_PROFILE_GUIDED_OPTIMIZE = 1 @@ -719,7 +730,7 @@ DEFINES += -DOSARCH=$(OS_ARCH) ###################################################################### -GARBAGE += $(DEPENDENCIES) $(MKDEPENDENCIES) $(MKDEPENDENCIES).bak core $(wildcard core.[0-9]*) $(wildcard *.err) $(wildcard *.pure) $(wildcard *_pure_*.o) Templates.DB +GARBAGE += $(DEPENDENCIES) $(MKDEPENDENCIES) $(MKDEPENDENCIES).bak core $(wildcard core.[0-9]*) $(wildcard *.err) $(wildcard *.pure) $(wildcard *_pure_*.o) Templates.DB $(FAKE_LIBRARY) ifeq ($(OS_ARCH),Darwin) ifndef NSDISTMODE diff --git a/config/rules.mk b/config/rules.mk index ea55eaa0e52..5ed7af84451 100644 --- a/config/rules.mk +++ b/config/rules.mk @@ -121,6 +121,21 @@ EXPAND_LIBNAME_PATH = -L$(2) $(addprefix -l,$(1)) EXPAND_MOZLIBNAME = $(addprefix -l,$(1)) endif +ifdef MOZ_FAKELIBS +# If a lib.fake is present, replace it with @lib.fake, otherwise just pass +# the library name through unchanged. +EXPAND_FAKELIBS = $(foreach f,$(1),$(if $(wildcard $(f).fake),@$(wildcard $(f).fake),$(f))) + +# Also override EXPAND_LIBNAME_PATH and EXPAND_MOZLIBNAME on non-RELATIVE_PATH +# platforms, so we can shortcut linking -lfoo if we have foo.a.fake +ifndef _LIBNAME_RELATIVE_PATHS +EXPAND_LIBNAME_PATH = $(if $(wildcard $(2)/$(LIB_PREFIX)$(1).$(LIB_SUFFIX).fake),@$(2)/$(LIB_PREFIX)$(1).$(LIB_SUFFIX).fake,-L$(2) $(addprefix -l,$(1))) +EXPAND_MOZLIBNAME = $(if $(wildcard $(DIST)/lib/$(LIB_PREFIX)$(1).$(LIB_SUFFIX).fake),@$(DIST)/lib/$(LIB_PREFIX)$(1).$(LIB_SUFFIX).fake,$(addprefix -l,$(1))) +endif +else +EXPAND_FAKELIBS = $1 +endif + ifdef EXTRA_DSO_LIBS EXTRA_DSO_LIBS := $(call EXPAND_MOZLIBNAME,$(EXTRA_DSO_LIBS)) endif @@ -235,6 +250,11 @@ endif # ENABLE_TESTS ifndef LIBRARY ifdef STATIC_LIBRARY_NAME LIBRARY := $(LIB_PREFIX)$(STATIC_LIBRARY_NAME).$(LIB_SUFFIX) +ifdef MOZ_FAKELIBS +ifndef SUPPRESS_FAKELIB +FAKE_LIBRARY = $(LIBRARY).fake +endif # SUPPRESS_FAKELIB +endif # MOZ_FAKELIBS endif # STATIC_LIBRARY_NAME endif # LIBRARY @@ -543,7 +563,7 @@ endif # ifndef NO_LD_ARCHIVE_FLAGS ifdef SHARED_LIBRARY_LIBS -EXTRA_DSO_LDOPTS := $(MKSHLIB_FORCE_ALL) $(SHARED_LIBRARY_LIBS) $(MKSHLIB_UNFORCE_ALL) $(EXTRA_DSO_LDOPTS) +EXTRA_DSO_LDOPTS := $(MKSHLIB_FORCE_ALL) $(call EXPAND_FAKELIBS,$(SHARED_LIBRARY_LIBS)) $(MKSHLIB_UNFORCE_ALL) $(EXTRA_DSO_LDOPTS) endif endif @@ -870,16 +890,16 @@ ifndef NO_DIST_INSTALL ifdef LIBRARY ifdef EXPORT_LIBRARY # Stage libs that will be linked into a static build ifdef IS_COMPONENT - $(INSTALL) $(IFLAGS1) $(LIBRARY) $(DEPTH)/staticlib/components + $(INSTALL) $(IFLAGS1) $(LIBRARY) $(FAKE_LIBRARY) $(DEPTH)/staticlib/components else - $(INSTALL) $(IFLAGS1) $(LIBRARY) $(DEPTH)/staticlib + $(INSTALL) $(IFLAGS1) $(LIBRARY) $(FAKE_LIBRARY) $(DEPTH)/staticlib endif endif # EXPORT_LIBRARY ifdef DIST_INSTALL ifdef IS_COMPONENT $(error Shipping static component libs makes no sense.) else - $(INSTALL) $(IFLAGS1) $(LIBRARY) $(DIST)/lib + $(INSTALL) $(IFLAGS1) $(LIBRARY) $(FAKE_LIBRARY) $(DIST)/lib endif endif # DIST_INSTALL endif # LIBRARY @@ -998,10 +1018,10 @@ alltags: $(PROGRAM): $(PROGOBJS) $(LIBS_DEPS) $(EXTRA_DEPS) $(EXE_DEF_FILE) $(RESFILE) $(GLOBAL_DEPS) @rm -f $@.manifest ifeq (WINCE,$(OS_ARCH)) - $(LD) -NOLOGO -OUT:$@ $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(PROGOBJS) $(RESFILE) $(LIBS) $(EXTRA_LIBS) $(OS_LIBS) + $(LD) -NOLOGO -OUT:$@ $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(PROGOBJS) $(RESFILE) $(call EXPAND_FAKELIBS,$(LIBS) $(EXTRA_LIBS) $(OS_LIBS)) else ifeq (_WINNT,$(GNU_CC)_$(OS_ARCH)) - $(LD) -NOLOGO -OUT:$@ -PDB:$(LINK_PDBFILE) $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(PROGOBJS) $(RESFILE) $(LIBS) $(EXTRA_LIBS) $(OS_LIBS) + $(LD) -NOLOGO -OUT:$@ -PDB:$(LINK_PDBFILE) $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(PROGOBJS) $(RESFILE) $(call EXPAND_FAKELIBS,$(LIBS) $(EXTRA_LIBS) $(OS_LIBS)) ifdef MSMANIFEST_TOOL @if test -f $@.manifest; then \ if test -f "$(srcdir)/$@.manifest"; then \ @@ -1023,9 +1043,9 @@ ifdef MOZ_PROFILE_GENERATE endif else # !WINNT || GNU_CC ifeq ($(CPP_PROG_LINK),1) - $(CCC) -o $@ $(CXXFLAGS) $(WRAP_MALLOC_CFLAGS) $(PROGOBJS) $(RESFILE) $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(LIBS_DIR) $(LIBS) $(OS_LIBS) $(EXTRA_LIBS) $(BIN_FLAGS) $(WRAP_MALLOC_LIB) $(EXE_DEF_FILE) + $(CCC) -o $@ $(CXXFLAGS) $(WRAP_MALLOC_CFLAGS) $(PROGOBJS) $(RESFILE) $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(LIBS_DIR) $(call EXPAND_FAKELIBS,$(LIBS) $(OS_LIBS) $(EXTRA_LIBS)) $(BIN_FLAGS) $(call EXPAND_FAKELIBS,$(WRAP_MALLOC_LIB)) $(EXE_DEF_FILE) else # ! CPP_PROG_LINK - $(CC) -o $@ $(CFLAGS) $(PROGOBJS) $(RESFILE) $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(LIBS_DIR) $(LIBS) $(OS_LIBS) $(EXTRA_LIBS) $(BIN_FLAGS) $(EXE_DEF_FILE) + $(CC) -o $@ $(CFLAGS) $(PROGOBJS) $(RESFILE) $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(LIBS_DIR) $(call EXPAND_FAKELIBS,$(LIBS) $(OS_LIBS) $(EXTRA_LIBS)) $(BIN_FLAGS) $(EXE_DEF_FILE) endif # CPP_PROG_LINK endif # WINNT && !GNU_CC endif # WINCE @@ -1082,10 +1102,10 @@ endif # $(SIMPLE_PROGRAMS): %$(BIN_SUFFIX): %.$(OBJ_SUFFIX) $(LIBS_DEPS) $(EXTRA_DEPS) $(GLOBAL_DEPS) ifeq (WINCE,$(OS_ARCH)) - $(LD) -nologo -entry:mainACRTStartup -out:$@ $< $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(LIBS) $(EXTRA_LIBS) $(OS_LIBS) + $(LD) -nologo -entry:mainACRTStartup -out:$@ $< $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(call EXPAND_FAKELIBS,$(LIBS) $(EXTRA_LIBS) $(OS_LIBS)) else ifeq (_WINNT,$(GNU_CC)_$(OS_ARCH)) - $(LD) -nologo -out:$@ -pdb:$(LINK_PDBFILE) $< $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(LIBS) $(EXTRA_LIBS) $(OS_LIBS) + $(LD) -nologo -out:$@ -pdb:$(LINK_PDBFILE) $< $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(call EXPAND_FAKELIBS,$(LIBS) $(EXTRA_LIBS) $(OS_LIBS)) ifdef MSMANIFEST_TOOL @if test -f $@.manifest; then \ mt.exe -NOLOGO -MANIFEST $@.manifest -OUTPUTRESOURCE:$@\;1; \ @@ -1094,9 +1114,9 @@ ifdef MSMANIFEST_TOOL endif # MSVC with manifest tool else ifeq ($(CPP_PROG_LINK),1) - $(CCC) $(WRAP_MALLOC_CFLAGS) $(CXXFLAGS) -o $@ $< $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(LIBS_DIR) $(LIBS) $(OS_LIBS) $(EXTRA_LIBS) $(WRAP_MALLOC_LIB) $(BIN_FLAGS) + $(CCC) $(WRAP_MALLOC_CFLAGS) $(CXXFLAGS) -o $@ $< $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(LIBS_DIR) $(call EXPAND_FAKELIBS,$(LIBS) $(OS_LIBS) $(EXTRA_LIBS) $(WRAP_MALLOC_LIB)) $(BIN_FLAGS) else - $(CC) $(WRAP_MALLOC_CFLAGS) $(CFLAGS) $(OUTOPTION)$@ $< $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(LIBS_DIR) $(LIBS) $(OS_LIBS) $(EXTRA_LIBS) $(WRAP_MALLOC_LIB) $(BIN_FLAGS) + $(CC) $(WRAP_MALLOC_CFLAGS) $(CFLAGS) $(OUTOPTION)$@ $< $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(LIBS_DIR) $(call EXPAND_FAKELIBS,$(LIBS) $(OS_LIBS) $(EXTRA_LIBS) $(WRAP_MALLOC_LIB)) $(BIN_FLAGS) endif # CPP_PROG_LINK endif # WINNT && !GNU_CC endif # WINCE @@ -1158,6 +1178,17 @@ ifneq (,$(BUILD_STATIC_LIBS)$(FORCE_STATIC_LIB)) LOBJS += $(SHARED_LIBRARY_LIBS) endif else +NONFAKE_SHARED_LIBRARY_LIBS = $(filter-out %.fake,$(call EXPAND_FAKELIBS,$(SHARED_LIBRARY_LIBS))) +ifeq (,$(NONFAKE_SHARED_LIBRARY_LIBS)) +# All of our SHARED_LIBRARY_LIBS have fake equivalents. Score! +# Just pass the original object files around. +# For shared libraries, these are already included in EXTRA_DSO_LDOPTS +# above. +ifndef SHARED_LIBRARY +LOBJS += $(shell cat $(addsuffix .fake,$(SHARED_LIBRARY_LIBS))) +endif +SKIP_SUB_LOBJS := 1 +else ifneq (,$(filter OSF1 BSD_OS FreeBSD NetBSD OpenBSD SunOS Darwin,$(OS_ARCH))) CLEANUP1 := | egrep -v '(________64ELEL_|__.SYMDEF)' CLEANUP2 := rm -f ________64ELEL_ __.SYMDEF @@ -1165,7 +1196,8 @@ else CLEANUP2 := true endif SUB_LOBJS = $(shell for lib in $(SHARED_LIBRARY_LIBS); do $(AR_LIST) $${lib} $(CLEANUP1); done;) -endif +endif # EXPAND_FAKELIBS +endif # SHARED_LIBARY_LIBS endif ifdef MOZILLA_PROBE_LIBS PROBE_LOBJS = $(shell for lib in $(MOZILLA_PROBE_LIBS); do $(AR_LIST) $${lib} $(CLEANUP1); done;) @@ -1176,15 +1208,33 @@ endif $(LIBRARY): $(OBJS) $(LOBJS) $(SHARED_LIBRARY_LIBS) $(EXTRA_DEPS) $(GLOBAL_DEPS) rm -f $@ +ifndef SKIP_SUB_LOBJS ifneq (,$(GNU_LD)$(filter-out OS2 WINNT WINCE, $(OS_ARCH))) ifdef SHARED_LIBRARY_LIBS @rm -f $(SUB_LOBJS) @for lib in $(SHARED_LIBRARY_LIBS); do $(AR_EXTRACT) $${lib}; $(CLEANUP2); done endif endif +endif # SKIP_SUB_LOBJS $(AR) $(AR_FLAGS) $(OBJS) $(LOBJS) $(SUB_LOBJS) $(RANLIB) $@ +ifndef MOZ_FAKELIBS +# Don't clean these up if we're building a fake lib, because then +# we'll reference nonexistent object files in our fake lib. @rm -f foodummyfilefoo $(SUB_LOBJS) +endif +# Also produce a .fake file that just contains the names of the object files. +# This can be used as a response file to the linker later instead of +# linking the actual static library. +ifdef MOZ_FAKELIBS +ifndef SUPPRESS_FAKELIB +ifeq (WINNT_,$(OS_ARCH)_$(.PYMAKE)) + echo "$(strip $(foreach f,$(OBJS) $(SEPARATE_OBJS) $(LOBJS) $(SUB_LOBJS),$(subst \,\\,$(call core_winabspath,$(f))))) " > $@.fake +else + echo "$(strip $(foreach f,$(OBJS) $(SEPARATE_OBJS) $(LOBJS) $(SUB_LOBJS),$(call core_abspath,$(f)))) " > $@.fake +endif +endif +endif ifeq (,$(filter-out WINNT WINCE, $(OS_ARCH))) $(IMPORT_LIBRARY): $(SHARED_LIBRARY) @@ -1295,7 +1345,7 @@ endif ofiles=`$(AR_LIST) $${lib}`; \ $(AR_DELETE) $${lib} $$ofiles; \ done - $(MKSHLIB) $(SHLIB_LDSTARTFILE) $(OBJS) $(LOBJS) $(SUB_SHLOBJS) $(DTRACE_PROBE_OBJ) $(PROBE_LOBJS) $(RESFILE) $(LDFLAGS) $(EXTRA_DSO_LDOPTS) $(OS_LIBS) $(EXTRA_LIBS) $(DEF_FILE) $(SHLIB_LDENDFILE) + $(MKSHLIB) $(SHLIB_LDSTARTFILE) $(OBJS) $(LOBJS) $(SUB_SHLOBJS) $(DTRACE_PROBE_OBJ) $(PROBE_LOBJS) $(RESFILE) $(LDFLAGS) $(EXTRA_DSO_LDOPTS) $(call EXPAND_FAKELIBS,$(OS_LIBS) $(EXTRA_LIBS)) $(DEF_FILE) $(SHLIB_LDENDFILE) @rm -f $(PROBE_LOBJS) @rm -f $(DTRACE_PROBE_OBJ) @for lib in $(MOZILLA_PROBE_LIBS); do \ @@ -1304,7 +1354,7 @@ endif @rm -f $(MOZILLA_PROBE_LIBS) else # ! DTRACE_LIB_DEPENDENT - $(MKSHLIB) $(SHLIB_LDSTARTFILE) $(OBJS) $(DTRACE_PROBE_OBJ) $(LOBJS) $(SUB_SHLOBJS) $(RESFILE) $(LDFLAGS) $(EXTRA_DSO_LDOPTS) $(OS_LIBS) $(EXTRA_LIBS) $(DEF_FILE) $(SHLIB_LDENDFILE) + $(MKSHLIB) $(SHLIB_LDSTARTFILE) $(OBJS) $(DTRACE_PROBE_OBJ) $(LOBJS) $(SUB_SHLOBJS) $(RESFILE) $(LDFLAGS) $(EXTRA_DSO_LDOPTS) $(call EXPAND_FAKELIBS,$(OS_LIBS) $(EXTRA_LIBS)) $(DEF_FILE) $(SHLIB_LDENDFILE) endif # DTRACE_LIB_DEPENDENT ifeq (_WINNT,$(GNU_CC)_$(OS_ARCH)) diff --git a/configure.in b/configure.in index 70a709e62a4..5a353ce4b65 100644 --- a/configure.in +++ b/configure.in @@ -8388,14 +8388,9 @@ if test "$MOZ_TREE_CAIRO"; then AC_SUBST(PNG_FUNCTIONS_FEATURE) AC_SUBST(QT_SURFACE_FEATURE) - if test "$_WIN32_MSVC"; then - MOZ_CAIRO_LIBS='$(DEPTH)/gfx/cairo/cairo/src/mozcairo.lib $(DEPTH)/gfx/cairo/libpixman/src/mozlibpixman.lib' - else - MOZ_CAIRO_LIBS='$(DEPTH)/gfx/cairo/cairo/src/$(LIB_PREFIX)mozcairo.$(LIB_SUFFIX) $(DEPTH)/gfx/cairo/libpixman/src/$(LIB_PREFIX)mozlibpixman.$(LIB_SUFFIX)'" $CAIRO_FT_LIBS" - - if test "$MOZ_X11"; then - MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS $XLDFLAGS -lXrender -lfreetype -lfontconfig" - fi + MOZ_CAIRO_LIBS='$(call EXPAND_LIBNAME_PATH,mozcairo,$(DEPTH)/gfx/cairo/cairo/src) $(call EXPAND_LIBNAME_PATH,mozlibpixman,$(DEPTH)/gfx/cairo/libpixman/src)' $CAIRO_FT_LIBS + if test "$MOZ_X11"; then + MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS $XLDFLAGS -lXrender -lfreetype -lfontconfig" fi CAIRO_FEATURES_H=gfx/cairo/cairo/src/cairo-features.h @@ -8420,7 +8415,7 @@ dnl ======================================================== dnl qcms dnl ======================================================== -QCMS_LIBS='$(DEPTH)/gfx/qcms/$(LIB_PREFIX)mozqcms.$(LIB_SUFFIX)' +QCMS_LIBS='$(call EXPAND_LIBNAME_PATH,mozqcms,$(DEPTH)/gfx/qcms)' AC_SUBST(QCMS_LIBS) dnl ======================================================== diff --git a/embedding/components/printingui/src/Makefile.in b/embedding/components/printingui/src/Makefile.in index d021c59677a..37ab50bf75e 100644 --- a/embedding/components/printingui/src/Makefile.in +++ b/embedding/components/printingui/src/Makefile.in @@ -63,4 +63,4 @@ DIRS = $(PLATFORM_DIR) include $(topsrcdir)/config/rules.mk libs:: - $(INSTALL) $(PLATFORM_DIR)/$(LIB_PREFIX)printingui_s.$(LIB_SUFFIX) . + $(INSTALL) $(PLATFORM_DIR)/$(LIB_PREFIX)printingui_s.$(LIB_SUFFIX) $(wildcard $(PLATFORM_DIR)/$(LIB_PREFIX)printingui_s.$(LIB_SUFFIX).fake) . diff --git a/gfx/cairo/cairo/src/Makefile.in b/gfx/cairo/cairo/src/Makefile.in index 16965571288..3baf1a58d09 100644 --- a/gfx/cairo/cairo/src/Makefile.in +++ b/gfx/cairo/cairo/src/Makefile.in @@ -49,6 +49,7 @@ endif MODULE = cairo LIBRARY_NAME = mozcairo +SUPPRESS_FAKELIB = 1 # cairo isn't awesome enough for fakelibs yet LIBXUL_LIBRARY = 1 ifdef GNU_CC diff --git a/ipc/chromium/Makefile.in b/ipc/chromium/Makefile.in index 64fc012b3a7..16bd93916cf 100644 --- a/ipc/chromium/Makefile.in +++ b/ipc/chromium/Makefile.in @@ -44,6 +44,7 @@ include $(DEPTH)/config/autoconf.mk OS_CXXFLAGS := $(filter-out -fshort-wchar,$(OS_CXXFLAGS)) LIBRARY_NAME = chromium_s +SUPPRESS_FAKELIB = 1 # Chromium is not ready for the awesomeness of fakelibs FORCE_STATIC_LIB = 1 LIBXUL_LIBRARY = 1 EXPORT_LIBRARY = 1 diff --git a/js/src/config/config.mk b/js/src/config/config.mk index d1cd7f1f547..f91545fd650 100644 --- a/js/src/config/config.mk +++ b/js/src/config/config.mk @@ -80,6 +80,11 @@ $(foreach x,$(CHECK_VARS),$(check-variable)) core_abspath = $(if $(findstring :,$(1)),$(1),$(if $(filter /%,$(1)),$(1),$(CURDIR)/$(1))) +nullstr := +space :=$(nullstr) # EOL + +core_winabspath = $(firstword $(subst /, ,$(call core_abspath,$(1)))):$(subst $(space),,$(patsubst %,\\%,$(wordlist 2,$(words $(subst /, ,$(call core_abspath,$(1)))), $(strip $(subst /, ,$(call core_abspath,$(1))))))) + # FINAL_TARGET specifies the location into which we copy end-user-shipped # build products (typelibs, components, chrome). # @@ -318,6 +323,12 @@ STATIC_LIBRARY_NAME=$(LIBRARY_NAME) endif endif +# GNU make on Windows can't handle using fake libs, because the path +# munging gets confused when we pass response files like @file to the linker. +#ifneq (WINNT_,$(OS_ARCH)_$(.PYMAKE)) +MOZ_FAKELIBS = 1 +#endif + # This comes from configure ifdef MOZ_PROFILE_GUIDED_OPTIMIZE_DISABLE NO_PROFILE_GUIDED_OPTIMIZE = 1 @@ -719,7 +730,7 @@ DEFINES += -DOSARCH=$(OS_ARCH) ###################################################################### -GARBAGE += $(DEPENDENCIES) $(MKDEPENDENCIES) $(MKDEPENDENCIES).bak core $(wildcard core.[0-9]*) $(wildcard *.err) $(wildcard *.pure) $(wildcard *_pure_*.o) Templates.DB +GARBAGE += $(DEPENDENCIES) $(MKDEPENDENCIES) $(MKDEPENDENCIES).bak core $(wildcard core.[0-9]*) $(wildcard *.err) $(wildcard *.pure) $(wildcard *_pure_*.o) Templates.DB $(FAKE_LIBRARY) ifeq ($(OS_ARCH),Darwin) ifndef NSDISTMODE @@ -827,3 +838,7 @@ ifdef TIERS DIRS += $(foreach tier,$(TIERS),$(tier_$(tier)_dirs)) STATIC_DIRS += $(foreach tier,$(TIERS),$(tier_$(tier)_staticdirs)) endif + +ifdef BUILD_STATIC_LIBS +include $(topsrcdir)/config/static-config.mk +endif diff --git a/js/src/config/rules.mk b/js/src/config/rules.mk index ea55eaa0e52..82c1e01da1a 100644 --- a/js/src/config/rules.mk +++ b/js/src/config/rules.mk @@ -121,6 +121,21 @@ EXPAND_LIBNAME_PATH = -L$(2) $(addprefix -l,$(1)) EXPAND_MOZLIBNAME = $(addprefix -l,$(1)) endif +ifdef MOZ_FAKELIBS +# If a lib.fake is present, replace it with @lib.fake, otherwise just pass +# the library name through unchanged. +EXPAND_FAKELIBS = $(foreach f,$(1),$(if $(wildcard $(f).fake),@$(wildcard $(f).fake),$(f))) + +# Also override EXPAND_LIBNAME_PATH and EXPAND_MOZLIBNAME on non-RELATIVE_PATH +# platforms, so we can shortcut linking -lfoo if we have foo.a.fake +ifndef _LIBNAME_RELATIVE_PATHS +EXPAND_LIBNAME_PATH = $(if $(wildcard $(2)/$(LIB_PREFIX)$(1).$(LIB_SUFFIX).fake),@$(2)/$(LIB_PREFIX)$(1).$(LIB_SUFFIX).fake,-L$(2) $(addprefix -l,$(1))) +EXPAND_MOZLIBNAME = $(if $(wildcard $(DIST)/lib/$(LIB_PREFIX)$(1).$(LIB_SUFFIX).fake),@$(DIST)/lib/$(LIB_PREFIX)$(1).$(LIB_SUFFIX).fake,$(addprefix -l,$(1))) +endif +else +EXPAND_FAKELIBS = $1 +endif + ifdef EXTRA_DSO_LIBS EXTRA_DSO_LIBS := $(call EXPAND_MOZLIBNAME,$(EXTRA_DSO_LIBS)) endif @@ -201,6 +216,7 @@ check-one: endif # XPCSHELL_TESTS +ifndef BUILD_STATIC_LIBS ifdef CPP_UNIT_TESTS # Compile the tests to $(DIST)/bin. Make lots of niceties available by default @@ -219,6 +235,7 @@ check:: done endif # CPP_UNIT_TESTS +endif # !BUILD_STATIC_LIBS .PHONY: check xpcshell-tests check-interactive check-one @@ -235,6 +252,11 @@ endif # ENABLE_TESTS ifndef LIBRARY ifdef STATIC_LIBRARY_NAME LIBRARY := $(LIB_PREFIX)$(STATIC_LIBRARY_NAME).$(LIB_SUFFIX) +ifdef MOZ_FAKELIBS +ifndef SUPPRESS_FAKELIB +FAKE_LIBRARY = $(LIBRARY).fake +endif # SUPPRESS_FAKELIB +endif # MOZ_FAKELIBS endif # STATIC_LIBRARY_NAME endif # LIBRARY @@ -543,7 +565,7 @@ endif # ifndef NO_LD_ARCHIVE_FLAGS ifdef SHARED_LIBRARY_LIBS -EXTRA_DSO_LDOPTS := $(MKSHLIB_FORCE_ALL) $(SHARED_LIBRARY_LIBS) $(MKSHLIB_UNFORCE_ALL) $(EXTRA_DSO_LDOPTS) +EXTRA_DSO_LDOPTS := $(MKSHLIB_FORCE_ALL) $(call EXPAND_FAKELIBS,$(SHARED_LIBRARY_LIBS)) $(MKSHLIB_UNFORCE_ALL) $(EXTRA_DSO_LDOPTS) endif endif @@ -870,16 +892,16 @@ ifndef NO_DIST_INSTALL ifdef LIBRARY ifdef EXPORT_LIBRARY # Stage libs that will be linked into a static build ifdef IS_COMPONENT - $(INSTALL) $(IFLAGS1) $(LIBRARY) $(DEPTH)/staticlib/components + $(INSTALL) $(IFLAGS1) $(LIBRARY) $(FAKE_LIBRARY) $(DEPTH)/staticlib/components else - $(INSTALL) $(IFLAGS1) $(LIBRARY) $(DEPTH)/staticlib + $(INSTALL) $(IFLAGS1) $(LIBRARY) $(FAKE_LIBRARY) $(DEPTH)/staticlib endif endif # EXPORT_LIBRARY ifdef DIST_INSTALL ifdef IS_COMPONENT $(error Shipping static component libs makes no sense.) else - $(INSTALL) $(IFLAGS1) $(LIBRARY) $(DIST)/lib + $(INSTALL) $(IFLAGS1) $(LIBRARY) $(FAKE_LIBRARY) $(DIST)/lib endif endif # DIST_INSTALL endif # LIBRARY @@ -998,10 +1020,10 @@ alltags: $(PROGRAM): $(PROGOBJS) $(LIBS_DEPS) $(EXTRA_DEPS) $(EXE_DEF_FILE) $(RESFILE) $(GLOBAL_DEPS) @rm -f $@.manifest ifeq (WINCE,$(OS_ARCH)) - $(LD) -NOLOGO -OUT:$@ $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(PROGOBJS) $(RESFILE) $(LIBS) $(EXTRA_LIBS) $(OS_LIBS) + $(LD) -NOLOGO -OUT:$@ $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(PROGOBJS) $(RESFILE) $(call EXPAND_FAKELIBS,$(LIBS) $(EXTRA_LIBS) $(OS_LIBS)) else ifeq (_WINNT,$(GNU_CC)_$(OS_ARCH)) - $(LD) -NOLOGO -OUT:$@ -PDB:$(LINK_PDBFILE) $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(PROGOBJS) $(RESFILE) $(LIBS) $(EXTRA_LIBS) $(OS_LIBS) + $(LD) -NOLOGO -OUT:$@ -PDB:$(LINK_PDBFILE) $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(PROGOBJS) $(RESFILE) $(call EXPAND_FAKELIBS,$(LIBS) $(EXTRA_LIBS) $(OS_LIBS)) ifdef MSMANIFEST_TOOL @if test -f $@.manifest; then \ if test -f "$(srcdir)/$@.manifest"; then \ @@ -1023,9 +1045,9 @@ ifdef MOZ_PROFILE_GENERATE endif else # !WINNT || GNU_CC ifeq ($(CPP_PROG_LINK),1) - $(CCC) -o $@ $(CXXFLAGS) $(WRAP_MALLOC_CFLAGS) $(PROGOBJS) $(RESFILE) $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(LIBS_DIR) $(LIBS) $(OS_LIBS) $(EXTRA_LIBS) $(BIN_FLAGS) $(WRAP_MALLOC_LIB) $(EXE_DEF_FILE) + $(CCC) -o $@ $(CXXFLAGS) $(WRAP_MALLOC_CFLAGS) $(PROGOBJS) $(RESFILE) $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(LIBS_DIR) $(call EXPAND_FAKELIBS,$(LIBS) $(OS_LIBS) $(EXTRA_LIBS)) $(BIN_FLAGS) $(call EXPAND_FAKELIBS,$(WRAP_MALLOC_LIB)) $(EXE_DEF_FILE) else # ! CPP_PROG_LINK - $(CC) -o $@ $(CFLAGS) $(PROGOBJS) $(RESFILE) $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(LIBS_DIR) $(LIBS) $(OS_LIBS) $(EXTRA_LIBS) $(BIN_FLAGS) $(EXE_DEF_FILE) + $(CC) -o $@ $(CFLAGS) $(PROGOBJS) $(RESFILE) $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(LIBS_DIR) $(call EXPAND_FAKELIBS,$(LIBS) $(OS_LIBS) $(EXTRA_LIBS)) $(BIN_FLAGS) $(EXE_DEF_FILE) endif # CPP_PROG_LINK endif # WINNT && !GNU_CC endif # WINCE @@ -1082,10 +1104,10 @@ endif # $(SIMPLE_PROGRAMS): %$(BIN_SUFFIX): %.$(OBJ_SUFFIX) $(LIBS_DEPS) $(EXTRA_DEPS) $(GLOBAL_DEPS) ifeq (WINCE,$(OS_ARCH)) - $(LD) -nologo -entry:mainACRTStartup -out:$@ $< $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(LIBS) $(EXTRA_LIBS) $(OS_LIBS) + $(LD) -nologo -entry:mainACRTStartup -out:$@ $< $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(call EXPAND_FAKELIBS,$(LIBS) $(EXTRA_LIBS) $(OS_LIBS)) else ifeq (_WINNT,$(GNU_CC)_$(OS_ARCH)) - $(LD) -nologo -out:$@ -pdb:$(LINK_PDBFILE) $< $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(LIBS) $(EXTRA_LIBS) $(OS_LIBS) + $(LD) -nologo -out:$@ -pdb:$(LINK_PDBFILE) $< $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(call EXPAND_FAKELIBS,$(LIBS) $(EXTRA_LIBS) $(OS_LIBS)) ifdef MSMANIFEST_TOOL @if test -f $@.manifest; then \ mt.exe -NOLOGO -MANIFEST $@.manifest -OUTPUTRESOURCE:$@\;1; \ @@ -1158,6 +1180,17 @@ ifneq (,$(BUILD_STATIC_LIBS)$(FORCE_STATIC_LIB)) LOBJS += $(SHARED_LIBRARY_LIBS) endif else +NONFAKE_SHARED_LIBRARY_LIBS = $(filter-out %.fake,$(call EXPAND_FAKELIBS,$(SHARED_LIBRARY_LIBS))) +ifeq (,$(NONFAKE_SHARED_LIBRARY_LIBS)) +# All of our SHARED_LIBRARY_LIBS have fake equivalents. Score! +# Just pass the original object files around. +# For shared libraries, these are already included in EXTRA_DSO_LDOPTS +# above. +ifndef SHARED_LIBRARY +LOBJS += $(shell cat $(addsuffix .fake,$(SHARED_LIBRARY_LIBS))) +endif +SKIP_SUB_LOBJS := 1 +else ifneq (,$(filter OSF1 BSD_OS FreeBSD NetBSD OpenBSD SunOS Darwin,$(OS_ARCH))) CLEANUP1 := | egrep -v '(________64ELEL_|__.SYMDEF)' CLEANUP2 := rm -f ________64ELEL_ __.SYMDEF @@ -1165,7 +1198,8 @@ else CLEANUP2 := true endif SUB_LOBJS = $(shell for lib in $(SHARED_LIBRARY_LIBS); do $(AR_LIST) $${lib} $(CLEANUP1); done;) -endif +endif # EXPAND_FAKELIBS +endif # SHARED_LIBARY_LIBS endif ifdef MOZILLA_PROBE_LIBS PROBE_LOBJS = $(shell for lib in $(MOZILLA_PROBE_LIBS); do $(AR_LIST) $${lib} $(CLEANUP1); done;) @@ -1176,15 +1210,33 @@ endif $(LIBRARY): $(OBJS) $(LOBJS) $(SHARED_LIBRARY_LIBS) $(EXTRA_DEPS) $(GLOBAL_DEPS) rm -f $@ +ifndef SKIP_SUB_LOBJS ifneq (,$(GNU_LD)$(filter-out OS2 WINNT WINCE, $(OS_ARCH))) ifdef SHARED_LIBRARY_LIBS @rm -f $(SUB_LOBJS) @for lib in $(SHARED_LIBRARY_LIBS); do $(AR_EXTRACT) $${lib}; $(CLEANUP2); done endif endif +endif # SKIP_SUB_LOBJS $(AR) $(AR_FLAGS) $(OBJS) $(LOBJS) $(SUB_LOBJS) $(RANLIB) $@ +ifndef MOZ_FAKELIBS +# Don't clean these up if we're building a fake lib, because then +# we'll reference nonexistent object files in our fake lib. @rm -f foodummyfilefoo $(SUB_LOBJS) +endif +# Also produce a .fake file that just contains the names of the object files. +# This can be used as a response file to the linker later instead of +# linking the actual static library. +ifdef MOZ_FAKELIBS +ifndef SUPPRESS_FAKELIB +ifeq (WINNT_,$(OS_ARCH)_$(.PYMAKE)) + echo "$(strip $(foreach f,$(OBJS) $(SEPARATE_OBJS) $(LOBJS) $(SUB_LOBJS),$(subst \,\\,$(call core_winabspath,$(f))))) " > $@.fake +else + echo "$(strip $(foreach f,$(OBJS) $(SEPARATE_OBJS) $(LOBJS) $(SUB_LOBJS),$(call core_abspath,$(f)))) " > $@.fake +endif +endif +endif ifeq (,$(filter-out WINNT WINCE, $(OS_ARCH))) $(IMPORT_LIBRARY): $(SHARED_LIBRARY) @@ -1295,7 +1347,7 @@ endif ofiles=`$(AR_LIST) $${lib}`; \ $(AR_DELETE) $${lib} $$ofiles; \ done - $(MKSHLIB) $(SHLIB_LDSTARTFILE) $(OBJS) $(LOBJS) $(SUB_SHLOBJS) $(DTRACE_PROBE_OBJ) $(PROBE_LOBJS) $(RESFILE) $(LDFLAGS) $(EXTRA_DSO_LDOPTS) $(OS_LIBS) $(EXTRA_LIBS) $(DEF_FILE) $(SHLIB_LDENDFILE) + $(MKSHLIB) $(SHLIB_LDSTARTFILE) $(OBJS) $(LOBJS) $(SUB_SHLOBJS) $(DTRACE_PROBE_OBJ) $(PROBE_LOBJS) $(RESFILE) $(LDFLAGS) $(EXTRA_DSO_LDOPTS) $(call EXPAND_FAKELIBS,$(OS_LIBS) $(EXTRA_LIBS)) $(DEF_FILE) $(SHLIB_LDENDFILE) @rm -f $(PROBE_LOBJS) @rm -f $(DTRACE_PROBE_OBJ) @for lib in $(MOZILLA_PROBE_LIBS); do \ @@ -1304,7 +1356,7 @@ endif @rm -f $(MOZILLA_PROBE_LIBS) else # ! DTRACE_LIB_DEPENDENT - $(MKSHLIB) $(SHLIB_LDSTARTFILE) $(OBJS) $(DTRACE_PROBE_OBJ) $(LOBJS) $(SUB_SHLOBJS) $(RESFILE) $(LDFLAGS) $(EXTRA_DSO_LDOPTS) $(OS_LIBS) $(EXTRA_LIBS) $(DEF_FILE) $(SHLIB_LDENDFILE) + $(MKSHLIB) $(SHLIB_LDSTARTFILE) $(OBJS) $(DTRACE_PROBE_OBJ) $(LOBJS) $(SUB_SHLOBJS) $(RESFILE) $(LDFLAGS) $(EXTRA_DSO_LDOPTS) $(call EXPAND_FAKELIBS,$(OS_LIBS) $(EXTRA_LIBS)) $(DEF_FILE) $(SHLIB_LDENDFILE) endif # DTRACE_LIB_DEPENDENT ifeq (_WINNT,$(GNU_CC)_$(OS_ARCH)) diff --git a/storage/test/Makefile.in b/storage/test/Makefile.in index 194b97abc05..7124895acb6 100644 --- a/storage/test/Makefile.in +++ b/storage/test/Makefile.in @@ -75,7 +75,6 @@ LOCAL_INCLUDES = \ LIBS = \ $(LIBS_DIR) \ - $(LIBXUL_DIST)/lib/$(LIB_PREFIX)xpcomglue_s.$(LIB_SUFFIX) \ $(MOZ_COMPONENT_LIBS) \ $(SQLITE_LIBS) \ $(NULL) diff --git a/toolkit/components/url-classifier/src/Makefile.in b/toolkit/components/url-classifier/src/Makefile.in index 6b24db1fa29..ab7ee74ad79 100644 --- a/toolkit/components/url-classifier/src/Makefile.in +++ b/toolkit/components/url-classifier/src/Makefile.in @@ -7,6 +7,7 @@ include $(DEPTH)/config/autoconf.mk MODULE = url-classifier LIBRARY_NAME = urlclassifier_s +SUPPRESS_FAKELIB = 1 # The urlclassifier test chokes on fakelibs XPIDL_MODULE = url-classifier LIBXUL_LIBRARY = 1 FORCE_STATIC_LIB = 1 diff --git a/xpcom/glue/Makefile.in b/xpcom/glue/Makefile.in index 7438b66cae5..8e9bcbb23eb 100644 --- a/xpcom/glue/Makefile.in +++ b/xpcom/glue/Makefile.in @@ -49,6 +49,7 @@ DIRS = standalone MODULE = xpcom LIBRARY_NAME = xpcomglue_s +SUPPRESS_FAKELIB = 1 DIST_INSTALL = 1 diff --git a/xpcom/glue/standalone/Makefile.in b/xpcom/glue/standalone/Makefile.in index 2c867a977fa..a461efe275a 100644 --- a/xpcom/glue/standalone/Makefile.in +++ b/xpcom/glue/standalone/Makefile.in @@ -47,6 +47,7 @@ EXTRA_DEPS += $(srcdir)/../objs.mk MODULE = xpcom LIBRARY_NAME = xpcomglue +SUPPRESS_FAKELIB = 1 DIST_INSTALL = 1 diff --git a/xpcom/reflect/xptcall/src/md/os2/Makefile.in b/xpcom/reflect/xptcall/src/md/os2/Makefile.in index 88a1caa1776..d7a42361edf 100644 --- a/xpcom/reflect/xptcall/src/md/os2/Makefile.in +++ b/xpcom/reflect/xptcall/src/md/os2/Makefile.in @@ -71,4 +71,4 @@ DEFINES += -DEXPORT_XPTC_API LOCAL_INCLUDES += -I$(srcdir)/../.. libs:: $(LIBRARY) - $(INSTALL) $(LIBRARY) ../.. + $(INSTALL) $(LIBRARY) $(FAKE_LIBRARY) ../.. diff --git a/xpcom/reflect/xptcall/src/md/unix/Makefile.in b/xpcom/reflect/xptcall/src/md/unix/Makefile.in index 6ee8bad8e0c..d024a154e37 100644 --- a/xpcom/reflect/xptcall/src/md/unix/Makefile.in +++ b/xpcom/reflect/xptcall/src/md/unix/Makefile.in @@ -544,7 +544,8 @@ ifndef GNU_CC ifeq (x86_64,$(OS_TEST)) xptcstubs_asm_x86_64_solaris_SUNW.o: $(DIST)/include/xptcstubsdef.inc $(srcdir)/xptcstubs_asm_x86_64_solaris_SUNW.s sed \ - -e 's/^\(STUB_ENTRY\)(\([0-9]\))/\11\(\2\)/' \ + -e 's/^\(STUB_ENTRY\)(\([0 +-9]\))/\11\(\2\)/' \ -e 's/^\(STUB_ENTRY\)(\([0-9][0-9]\))/\12\(\2\)/' \ -e 's/^\(STUB_ENTRY\)(\([0-9][0-9][0-9]\))/\13\(\2\)/' \ $(DIST)/include/xptcstubsdef.inc > ./xptcstubsdef_asm.solx86 @@ -564,4 +565,4 @@ endif endif libs:: $(LIBRARY) - $(INSTALL) $(LIBRARY) ../.. + $(INSTALL) $(LIBRARY) $(FAKE_LIBRARY) ../.. diff --git a/xpcom/reflect/xptcall/src/md/win32/Makefile.in b/xpcom/reflect/xptcall/src/md/win32/Makefile.in index 574c77bae17..76facf37cff 100644 --- a/xpcom/reflect/xptcall/src/md/win32/Makefile.in +++ b/xpcom/reflect/xptcall/src/md/win32/Makefile.in @@ -109,4 +109,4 @@ DEFINES += -DEXPORT_XPTC_API -D_IMPL_NS_COM LOCAL_INCLUDES += -I$(srcdir)/../.. libs:: $(LIBRARY) - $(INSTALL) $(LIBRARY) ../.. + $(INSTALL) $(LIBRARY) $(FAKE_LIBRARY) ../.. diff --git a/xpcom/tests/Makefile.in b/xpcom/tests/Makefile.in index 6e6a693785b..d863366dbc0 100644 --- a/xpcom/tests/Makefile.in +++ b/xpcom/tests/Makefile.in @@ -147,10 +147,6 @@ endif include $(topsrcdir)/config/config.mk -ifndef MOZILLA_INTERNAL_API -LIBS += $(DIST)/lib/$(LIB_PREFIX)xpcomglue_s.$(LIB_SUFFIX) -endif - LIBS += $(XPCOM_LIBS) # Needed to resolve __yylex (?)