mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-28 13:21:28 +00:00
Bug 1656141 - Create res and rc files based on the name of the binary they are linked into. r=firefox-build-system-reviewers,rstewart
This will allow creating separate res files for e.g. SIMPLE_PROGRAMS. Differential Revision: https://phabricator.services.mozilla.com/D86155
This commit is contained in:
parent
afe0ac845a
commit
63984026bb
@ -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)
|
||||
|
||||
|
||||
|
@ -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 ;
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
Loading…
x
Reference in New Issue
Block a user