use $(file …) directly instead of gb_var2file when not used as intermediate

i.e. when the temporary file is not uses as a responsefile for another
command, but instead the point of running gb_var2file is to have that
file as a result in the end.

also move the helper into the main gbuild.mk and remove Tempfile.mk

Change-Id: I79382bef5d7e8a155ba6a8e0750c6a17da42eb37
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143912
Tested-by: Jenkins
Reviewed-by: Christian Lohmaier <lohmaier+LibreOffice@googlemail.com>
This commit is contained in:
Christian Lohmaier
2022-12-13 15:05:43 +00:00
parent dad5becaca
commit 8b87e29c98
9 changed files with 20 additions and 48 deletions
+2 -1
View File
@@ -24,7 +24,8 @@ $(call gb_CustomTarget_get_workdir,officecfg/registry)/officecfg/officecfg_qa_al
$(SRCDIR)/officecfg/files.mk
$(call gb_Output_announce,officecfg_qa_allheaders.hxx,$(true),CAT,1)
$(call gb_Trace_StartRange,officecfg_qa_allheaders.hxx,CAT)
mv $(call gb_var2file,$(shell mkdir -p $(dir $@) && cat /dev/null >$@.tmp && echo $@.tmp),$(foreach file,$(officecfg_XCSFILES),$(call officecfg_geninclude,$(file)))) $@
$(shell mkdir -p $(dir $@))
$(file >$@,$(foreach file,$(officecfg_XCSFILES),$(call officecfg_geninclude,$(file))))
$(call gb_Trace_EndRange,officecfg_qa_allheaders.hxx,CAT)
# pass the stem as space separated path elements and get a set of --stringparam ns<level> <element> in return
+3 -6
View File
@@ -29,18 +29,15 @@ $(postprocess_WORKDIR)/services_componentfiles.list: \
$(foreach comp,$(gb_ComponentTarget__ALLCOMPONENTS),$(call gb_ComponentTarget_get_target,$(comp))) \
| $(postprocess_WORKDIR)/.dir
$(call gb_Output_announce,$(subst $(BUILDDIR)/,,$@),$(true),GEN,2)
TEMPFILE=$(call gb_var2file,$(shell $(gb_MKTEMP)), \
$(foreach comp,$(sort $(gb_ComponentTarget__ALLCOMPONENTS)),$(call gb_ComponentTarget_get_target,$(comp))$(gb_NEWLINE))) && \
mv $$TEMPFILE $@
$(file >$@,$(foreach comp,$(sort $(gb_ComponentTarget__ALLCOMPONENTS)),$(call gb_ComponentTarget_get_target,$(comp))$(gb_NEWLINE)))
$(postprocess_WORKDIR)/services_constructors.list: \
$(SRCDIR)/solenv/bin/constructors.py \
$(postprocess_WORKDIR)/services_componentfiles.list \
| $(postprocess_WORKDIR)/.dir
$(call gb_Output_announce,$(subst $(BUILDDIR)/,,$@),$(true),GEN,2)
TEMPFILE=$(shell $(gb_MKTEMP)) && \
$(call gb_Helper_abbreviate_dirs,$(call gb_ExternalExecutable_get_command,python) $^) > $$TEMPFILE && \
$(call gb_Helper_replace_if_different_and_touch,$${TEMPFILE},$@)
$(call gb_Helper_abbreviate_dirs,$(call gb_ExternalExecutable_get_command,python) $^) > $@.tmp && \
$(call gb_Helper_replace_if_different_and_touch,$@.tmp,$@)
.PHONY: $(postprocess_WORKDIR)/services_componentfiles.list
+2 -3
View File
@@ -652,10 +652,9 @@ $(call gb_CustomTarget_get_workdir,postprocess/registry)/registry_%.list :
$(call gb_CustomTarget_get_workdir,postprocess/registry)/%.list :
$(call gb_Output_announce,$(subst $(WORKDIR)/,,$@),$(true),ECH,2)
$(call gb_Trace_StartRange,$(subst $(WORKDIR)/,,$@),ECH)
mv $(call gb_var2file,$@.tmp,<list> $(foreach i,$(postprocess_DEPS_$*), <dependency file='$i'/>) \
$(file >$@,<list> $(foreach i,$(postprocess_DEPS_$*), <dependency file='$i'/>) \
$(foreach i,$(postprocess_OPTDEPS_$*), <dependency file='$i' optional='true'/>) \
$(foreach i,$(postprocess_FILES_$*), <filename>$(i)</filename>) </list>) \
$@
$(foreach i,$(postprocess_FILES_$*), <filename>$(i)</filename>) </list>)
$(call gb_Trace_EndRange,$(subst $(WORKDIR)/,,$@),ECH)
# vim: set noet sw=4 ts=4:
+1 -1
View File
@@ -567,7 +567,7 @@ $(dir $(call gb_HelpTarget_get_target,%))%/.dir :
# Translation of the module's .xhp files and all used modules is done.
# Also creates the list for gb_HelpTarget_get_filelist.
$(call gb_HelpTarget_get_translation_target,%) :
rm -f $@ && mv $(call gb_var2file,$@.tmp,$(strip $(HELP_FILES))) $@
$(file >$@,$(strip $(HELP_FILES)))
# Translation of the module's .xhp files and all used and linked modules
# is done.
+5 -7
View File
@@ -805,7 +805,7 @@ endef
# call gb_LinkTarget__command_objectlist,linktarget
define gb_LinkTarget__command_objectlist
TEMPFILE=$(call gb_var2file,$(shell $(gb_MKTEMP)),\
$(file >$(1),\
$(foreach object,$(COBJECTS),$(call gb_CObject_get_target,$(object))) \
$(foreach object,$(CXXOBJECTS),$(call gb_CxxObject_get_target,$(object))) \
$(foreach object,$(OBJCOBJECTS),$(call gb_ObjCObject_get_target,$(object))) \
@@ -819,8 +819,7 @@ TEMPFILE=$(call gb_var2file,$(shell $(gb_MKTEMP)),\
$(foreach object,$(GENNASMOBJECTS),$(call gb_GenNasmObject_get_target,$(object))) \
$(foreach object,$(GENCXXCLROBJECTS),$(call gb_GenCxxClrObject_get_target,$(object))) \
$(PCHOBJS) \
$(foreach extraobjectlist,$(EXTRAOBJECTLISTS),$(shell cat $(extraobjectlist)))) && \
mv $${TEMPFILE} $(1)
$(foreach extraobjectlist,$(EXTRAOBJECTLISTS),$(shell cat $(extraobjectlist))))
endef
@@ -893,10 +892,9 @@ define gb_LinkTarget__static_dep_x_template
define gb_LinkTarget__command_dep_$(1)
$$(call gb_Output_announce,LNK:$$(2).d.$(1),$$(true),DEP,1)
mkdir -p $$(dir $$(1)) && \
TEMPFILE=$$(call gb_var2file,$$(shell $$(gb_MKTEMP)),\
$$(call gb_LinkTarget__get_all_$(1),$$(2))) && \
$$(call gb_Helper_replace_if_different_and_touch,$$$${TEMPFILE},$$(1))
$$(shell mkdir -p $$(dir $$(1)))
$$(file >$$(1).tmp,$$(call gb_LinkTarget__get_all_$(1),$$(2)))
$$(call gb_Helper_replace_if_different_and_touch,$$(1).tmp,$$(1))
endef
+1 -2
View File
@@ -81,8 +81,7 @@ $(call gb_Package_get_target,%) :
$(call gb_Output_announce,$*,$(true),PKG,2)
$(call gb_Trace_StartRange,$*,PKG)
$(if $(PACKAGE_DEFINED),,$(call gb_Output_error,$(RDEPENDS) depend(s) on package $* which does not exist.))
rm -f $@ && \
mv $(call gb_var2file,$@.tmp,$(sort $(FILES))) $@
$(file >$@,$(sort $(FILES)))
$(call gb_Trace_EndRange,$*,PKG)
# for other targets that want to create Packages, does not register at Module
-24
View File
@@ -1,24 +0,0 @@
# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
#
# This file is part of the LibreOffice project.
#
# 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/.
#
# This file incorporates work covered by the following license notice:
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed
# with this work for additional information regarding copyright
# ownership. The ASF licenses this file to you under the Apache
# License, Version 2.0 (the "License"); you may not use this file
# except in compliance with the License. You may obtain a copy of
# the License at http://www.apache.org/licenses/LICENSE-2.0 .
#
define gb_var2file
$(file >$(1),$(2))$(1)
endef
# vim: set noet sw=4 ts=4:
+4 -1
View File
@@ -194,7 +194,10 @@ endif
include $(GBUILDDIR)/ExternalExecutable.mk
include $(GBUILDDIR)/TargetLocations.mk
include $(GBUILDDIR)/Tempfile.mk
define gb_var2file
$(file >$(1),$(2))$(1)
endef
$(eval $(call gb_Helper_init_registries))
include $(SRCDIR)/Repository.mk
+2 -3
View File
@@ -1514,10 +1514,9 @@ $(emscripten_fs_image_WORKDIR)/soffice.data.filelist: \
$(emscripten_fs_image_WORKDIR)/soffice.data.concat_lists \
$(gb_emscripten_fs_image_files) \
| $(emscripten_fs_image_WORKDIR)/.dir
TEMPFILE=$(call gb_var2file,$(shell $(gb_MKTEMP)),\
$(file >$@,\
$(subst @,@@,$(subst $(BUILDDIR)/,,$(filter $(BUILDDIR)%,$(gb_emscripten_fs_image_all_files)))) \
$(foreach item,$(filter-out $(BUILDDIR)%,$(gb_emscripten_fs_image_all_files)),$(subst @,@@,$(item))@$(subst @,@@,$(subst $(SRCDIR)/,,$(item))))) \
&& mv $$TEMPFILE $@
$(foreach item,$(filter-out $(BUILDDIR)%,$(gb_emscripten_fs_image_all_files)),$(subst @,@@,$(item))@$(subst @,@@,$(subst $(SRCDIR)/,,$(item)))))
# Unfortunately the file packager just allows a cmdline file list, but all paths are
# relative to $(BUILDDIR), so we won't run out of cmdline space that fast...