diff --git a/config/create_rc.py b/config/create_rc.py index db6f682afa54..4164dc54f026 100644 --- a/config/create_rc.py +++ b/config/create_rc.py @@ -170,7 +170,7 @@ def generate_module_rc(binary='', rcinclude=None): productname=overrides.get('WIN32_MODULE_PRODUCTNAME', display_name), buildid=buildid, ) - with io.open('module.rc', 'w', encoding='latin1') as fh: + with io.open('{}.rc'.format(binary or 'module'), 'w', encoding='latin1') as fh: fh.write(data) diff --git a/config/makefiles/rust.mk b/config/makefiles/rust.mk index 58606db50fd5..70ca9e9d3402 100644 --- a/config/makefiles/rust.mk +++ b/config/makefiles/rust.mk @@ -363,9 +363,9 @@ ifdef RUST_PROGRAMS GARBAGE_DIRS += $(RUST_TARGET) -force-cargo-program-build: $(RESFILE) +force-cargo-program-build: $(call resfile,module) $(REPORT_BUILD) - $(call CARGO_BUILD) $(addprefix --bin ,$(RUST_CARGO_PROGRAMS)) $(cargo_target_flag) -- $(if $(RESFILE),-C link-arg=$(CURDIR)/$(RESFILE)) + $(call CARGO_BUILD) $(addprefix --bin ,$(RUST_CARGO_PROGRAMS)) $(cargo_target_flag) -- $(addprefix -C link-arg=$(CURDIR)/,$(call resfile,module)) $(RUST_PROGRAMS): force-cargo-program-build ; diff --git a/config/rules.mk b/config/rules.mk index 4593a3e1d31d..ced1174ec1ed 100644 --- a/config/rules.mk +++ b/config/rules.mk @@ -20,10 +20,6 @@ ifndef INCLUDED_CONFIG_MK include $(topsrcdir)/config/config.mk endif -ifndef INCLUDED_VERSION_MK -include $(MOZILLA_DIR)/config/version.mk -endif - USE_AUTOTARGETS_MK = 1 include $(MOZILLA_DIR)/config/makefiles/makeutils.mk @@ -403,6 +399,12 @@ everything:: # Dependencies which, if modified, should cause everything to rebuild GLOBAL_DEPS += Makefile $(addprefix $(DEPTH)/config/,$(INCLUDED_AUTOCONF_MK)) $(MOZILLA_DIR)/config/config.mk +ifeq ($(OS_ARCH),WINNT) +resfile = $(notdir $1).res +else +resfile = +endif + ############################################## ifdef COMPILE_ENVIRONMENT compile:: host target @@ -452,11 +454,11 @@ endef # PROGRAM = Foo # creates OBJS, links with LIBS to create Foo # -$(PROGRAM): $(PROGOBJS) $(STATIC_LIBS) $(EXTRA_DEPS) $(RESFILE) $(GLOBAL_DEPS) $(call mkdir_deps,$(FINAL_TARGET)) +$(PROGRAM): $(PROGOBJS) $(STATIC_LIBS) $(EXTRA_DEPS) $(call resfile,$(PROGRAM)) $(GLOBAL_DEPS) $(call mkdir_deps,$(FINAL_TARGET)) $(REPORT_BUILD) @$(RM) $@.manifest ifeq (_WINNT,$(GNU_CC)_$(OS_ARCH)) - $(LINKER) -OUT:$@ -PDB:$(LINK_PDBFILE) -IMPLIB:$(basename $(@F)).lib $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(MOZ_PROGRAM_LDFLAGS) $($(notdir $@)_OBJS) $(RESFILE) $(STATIC_LIBS) $(SHARED_LIBS) $(OS_LIBS) + $(LINKER) -OUT:$@ -PDB:$(LINK_PDBFILE) -IMPLIB:$(basename $(@F)).lib $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(MOZ_PROGRAM_LDFLAGS) $($(notdir $@)_OBJS) $(filter %.res,$^) $(STATIC_LIBS) $(SHARED_LIBS) $(OS_LIBS) ifdef MSMANIFEST_TOOL @if test -f $@.manifest; then \ echo "Manifest in objdir is not supported"; \ @@ -467,7 +469,7 @@ ifdef MSMANIFEST_TOOL fi endif # MSVC with manifest tool else # !WINNT || GNU_CC - $(call EXPAND_CC_OR_CXX,$@) -o $@ $(COMPUTED_CXX_LDFLAGS) $(PGO_CFLAGS) $($(notdir $@)_OBJS) $(RESFILE) $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(STATIC_LIBS) $(MOZ_PROGRAM_LDFLAGS) $(SHARED_LIBS) $(OS_LIBS) + $(call EXPAND_CC_OR_CXX,$@) -o $@ $(COMPUTED_CXX_LDFLAGS) $(PGO_CFLAGS) $($(notdir $@)_OBJS) $(filter %.res,$^) $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(STATIC_LIBS) $(MOZ_PROGRAM_LDFLAGS) $(SHARED_LIBS) $(OS_LIBS) $(call py_action,check_binary,--target $@) endif # WINNT && !GNU_CC @@ -598,12 +600,12 @@ endif # symlinks back to the originals. The symlinks are a no-op for stabs debugging, # so no need to conditionalize on OS version or debugging format. -$(SHARED_LIBRARY): $(OBJS) $(RESFILE) $(STATIC_LIBS) $(EXTRA_DEPS) $(GLOBAL_DEPS) +$(SHARED_LIBRARY): $(OBJS) $(call resfile,$(SHARED_LIBRARY)) $(STATIC_LIBS) $(EXTRA_DEPS) $(GLOBAL_DEPS) $(REPORT_BUILD) ifndef INCREMENTAL_LINKER $(RM) $@ endif - $(MKSHLIB) $($@_OBJS) $(RESFILE) $(LDFLAGS) $(STATIC_LIBS) $(SHARED_LIBS) $(EXTRA_DSO_LDOPTS) $(MOZ_GLUE_LDFLAGS) $(OS_LIBS) + $(MKSHLIB) $($@_OBJS) $(filter %.res,$^) $(LDFLAGS) $(STATIC_LIBS) $(SHARED_LIBS) $(EXTRA_DSO_LDOPTS) $(MOZ_GLUE_LDFLAGS) $(OS_LIBS) $(call py_action,check_binary,--target $@) ifeq (_WINNT,$(GNU_CC)_$(OS_ARCH)) @@ -859,7 +861,7 @@ endif endif -$(RESFILE): %.res: $(RCFILE) +%.res: $(or $(RCFILE),%.rc) $(REPORT_BUILD) @echo Creating Resource file: $@ ifdef GNU_CC @@ -868,6 +870,9 @@ else $(call WINEWRAP,$(RC)) $(RCFLAGS) -r $(DEFINES) $(INCLUDES:-I%=-I$(call relativize,%)) $(OUTOPTION)$@ $(call relativize,$<) endif +$(notdir $(addsuffix .rc,$(PROGRAM) $(SHARED_LIBRARY) module)): %.rc: $(RCINCLUDE) $(MOZILLA_DIR)/config/create_rc.py + $(PYTHON3) $(MOZILLA_DIR)/config/create_rc.py '$(if $(filter module,$*),,$*)' '$(RCINCLUDE)' + # Cancel GNU make built-in implicit rules MAKEFLAGS += -r diff --git a/config/version.mk b/config/version.mk deleted file mode 100644 index 3979b1f1c935..000000000000 --- a/config/version.mk +++ /dev/null @@ -1,46 +0,0 @@ -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. - -ifndef INCLUDED_VERSION_MK -INCLUDED_VERSION_MK=1 - -# Windows gmake build: -# Build default .rc file if $(RESFILE) isn't defined. -# TODO: -# PBI : Private build info. Not used currently. -# Guessing the best way would be to set an env var. -# BINARY : Binary name. Not used currently. -ifeq ($(MOZ_WIDGET_TOOLKIT),windows) -ifndef RESFILE -RESFILE=./module.res -ifdef PROGRAM -_RC_BINARY = $(notdir $(PROGRAM)) -else -ifdef _PROGRAM -_RC_BINARY = $(notdir $(_PROGRAM)) -else -ifdef SHARED_LIBRARY -_RC_BINARY = $(notdir $(SHARED_LIBRARY)) -endif -endif -endif - -GARBAGE += $(RESFILE) - -#dummy target so $(RCFILE) doesn't become the default =P -all:: - -ifndef RCFILE -RCFILE=./module.rc - -$(RCFILE): $(RCINCLUDE) $(MOZILLA_DIR)/config/create_rc.py - $(PYTHON3) $(MOZILLA_DIR)/config/create_rc.py '$(_RC_BINARY)' '$(RCINCLUDE)' - -GARBAGE += $(RCFILE) -endif # RCFILE - -endif # RESFILE -endif # Windows - -endif