diff mbox series

[2/3] tools/ocaml: Drop o= rune

Message ID 20240823105157.991275-3-andrew.cooper3@citrix.com (mailing list archive)
State New
Headers show
Series tools/ocaml: Incremental build fixes | expand

Commit Message

Andrew Cooper Aug. 23, 2024, 10:51 a.m. UTC
This hides a shell redirection which is quite rude.  It also opencodes
$(move-if-changed) without the benefit of short-circuiting dependent logic
when the content hasn't changed.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
CC: Christian Lindig <christian.lindig@citrix.com>
CC: David Scott <dave@recoil.org>
CC: Edwin Török <edwin.torok@cloud.com>
CC: Rob Hoes <Rob.Hoes@citrix.com>
CC: Andrii Sultanov <andrii.sultanov@cloud.com>
CC: Anthony PERARD <anthony.perard@vates.tech>
---
 tools/ocaml/Makefile.rules | 5 +++--
 tools/ocaml/common.make    | 2 --
 2 files changed, 3 insertions(+), 4 deletions(-)
diff mbox series

Patch

diff --git a/tools/ocaml/Makefile.rules b/tools/ocaml/Makefile.rules
index 5638193edf8a..5d534d8754bf 100644
--- a/tools/ocaml/Makefile.rules
+++ b/tools/ocaml/Makefile.rules
@@ -40,13 +40,14 @@  ALL_OCAML_OBJS ?= $(OBJS)
 	$(call quiet-command, $(CC) $(CFLAGS) -c -o $@ $<,CC,$@)
 
 META: META.in
-	sed 's/@VERSION@/$(VERSION)/g' < $< $o
+	sed 's/@VERSION@/$(VERSION)/g' < $< > $@.tmp
+	$(call move-if-changed,$@.tmp,$@)
 
 ALL_OCAML_OBJ_SOURCES=$(addsuffix .ml, $(ALL_OCAML_OBJS))
 
 ifneq ($(MAKECMDGOALS),clean)
 .ocamldep.make: $(ALL_OCAML_OBJ_SOURCES) Makefile $(OCAML_TOPLEVEL)/Makefile.rules
-	$(call quiet-command, $(OCAMLDEP) $(ALL_OCAML_OBJ_SOURCES) *.mli $o,MLDEP,)
+	$(call quiet-command, $(OCAMLDEP) $(ALL_OCAML_OBJ_SOURCES) *.mli > $@.tmp; $(call move-if-changed,$@.tmp,$@),MLDEP,)
 endif
 
 clean: $(CLEAN_HOOKS)
diff --git a/tools/ocaml/common.make b/tools/ocaml/common.make
index 708d74617c8d..979cbe08459b 100644
--- a/tools/ocaml/common.make
+++ b/tools/ocaml/common.make
@@ -17,5 +17,3 @@  OCAMLCFLAGS += -g $(OCAMLINCLUDE) -w F -warn-error F
 VERSION := 4.1
 
 OCAMLDESTDIR ?= $(DESTDIR)$(shell $(OCAMLFIND) printconf destdir)
-
-o= >$@.new && mv -f $@.new $@