From 85b9eb90d92b383b925d8898aed9dfe777ab37d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?T=C3=B5ivo=20Leedj=C3=A4rv?= Date: Fri, 13 Dec 2024 11:33:08 +0100 Subject: [PATCH 1/2] Makefile: Use substitution references Substitution references are supported by all widely used make implementations, whereas marcro functions (as used previously) are not. --- src/Makefile.OCaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Makefile.OCaml b/src/Makefile.OCaml index 69b142885..e5fa2a891 100644 --- a/src/Makefile.OCaml +++ b/src/Makefile.OCaml @@ -202,8 +202,8 @@ ifeq ($(NATIVE), true) CAMLC=$(OCAMLOPT) - CAMLOBJS=$(subst .cmo,.cmx, $(subst .cma,.cmxa, $(OCAMLOBJS))) - CAMLLIBS=$(subst .cma,.cmxa, $(OCAMLLIBS)) + CAMLOBJS = $(OCAMLOBJS:.cmo=.cmx) + CAMLLIBS = $(OCAMLLIBS:.cma=.cmxa) else ## Set up for bytecode compilation From 8cef7405a873035587f6de28087f8cf1e188afd8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?T=C3=B5ivo=20Leedj=C3=A4rv?= Date: Fri, 13 Dec 2024 11:34:39 +0100 Subject: [PATCH 2/2] Makefile: Use inference rules Inference rules are supported by all widely used make implementations, whereas pattern rules (as used previously) are not. --- src/Makefile.OCaml | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/Makefile.OCaml b/src/Makefile.OCaml index e5fa2a891..556175173 100644 --- a/src/Makefile.OCaml +++ b/src/Makefile.OCaml @@ -422,23 +422,22 @@ win32rc/unison.res.lib: win32rc/unison.rc win32rc/U.ico $(WINDRES) win32rc/unison.rc win32rc/unison.res $(WINDRES) win32rc/unison.res win32rc/unison.res.lib -%.ml: %.mll - -$(RM) $@ - ocamllex $< +.SUFFIXES: +.SUFFIXES: .mli .cmi .ml .cmo .cmx .c .o .obj -%.cmi : %.mli +.mli.cmi: @echo "$(CAMLC): $< ---> $@" $(CAMLC) $(CAMLFLAGS) -c $(CWD)/$< -%.cmo: %.ml +.ml.cmo: @echo "$(OCAMLC): $< ---> $@" $(OCAMLC) $(CAMLFLAGS) -c $(CWD)/$< -%.cmx: %.ml +.ml.cmx: @echo "$(OCAMLOPT): $< ---> $@" $(OCAMLOPT) $(CAMLFLAGS) -c $(CWD)/$< -%$(OBJ_EXT): %.c +.c$(OBJ_EXT): @echo "$(CAMLC): $< ---> $@" $(CAMLC) $(CAMLFLAGS) $(CAMLCFLAGS) -ccopt $(OUTPUT_SEL)$(CWD)/$@ -c $(CWD)/$<