git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH v3 2/2] Makefile: support universal macOS builds via RUST_TARGETS

From
SNShardul Natu <snatu@google.com>
Date
Jul 3, 2026, 17:37 UTC
Message-ID
<CABaQWZey-7FKd7FDTKZ5v7jjuRdTXm5cqJUpL8JKAL+Pom1iWw@mail.gmail.com>
In-Reply-To
<xmqqldbsk51t.fsf@gitster.g>
Show 7 quoted lines
> > +$(RUST_LIB): $(RUST_MEMBER_LIBS)
> > + @$(call mkdir_p_parent_template)
>
> The leading @ is a bit curious because among ~20 existing use of
> this pattern, nobody adds it to squelch "mkdir -p". In fact, the
> macro uses the standard pattern to define $(QUIET_MKDIR_P_PARENT)
> that does the squelching when $(V) is unset.
Done!
Show 11 quoted lines
> Recipe parts in our Makefile that are written in bourne shell, the
> CodingGuidelines apply.
>
> $ git grep -n -e 'if \[' ':(glob)**/Makefile'
>
> gives empty. Probably,
>
> if test $(words $(RUST_TARGETS)) -gt 1; \
> then \
>
> would fit better.

Thank you for pointing out the CodingGuidelines rule for Bourne shell snippets in Makefiles. I have updated the condition from "if [" to "if test".

Thanks, Shardul

On Thu, Jul 2, 2026 at 10:36 PM Junio C Hamano <gitster@pobox.com> wrote:
Show 62 quoted lines
>
> "Shardul Natu via GitGitGadget" <gitgitgadget@gmail.com> writes:
>
> > From: Shardul Natu <snatu@google.com>
> >
> > On macOS, Universal Binaries contain native executable code for
> > multiple architectures (such as Intel x86_64 and Apple Silicon arm64)
> > bundled into a single file. This is standard practice for macOS
> > distribution and CI packaging (such as internal distribution packages
> > or tooling like Burrito/Homebrew), allowing a single build artifact
> > to run natively across all Macs without Rosetta emulation or
> > maintaining separate packages.
> >
> > When building Git C code for multiple architectures on macOS, the
> > Apple toolchain (clang) natively supports universal builds via
> > CFLAGS/LDFLAGS. When "-arch x86_64 -arch arm64" is passed, clang
> > automatically compiles and links universal binaries for all C object
> > files and executables out of the box.
> >
> > Cargo and rustc, however, do not support multiple "-arch" flags or
> > emitting universal binaries in a single invocation. Instead, Cargo
> > requires invoking each target triple independently (e.g., passing
> > "--target x86_64-apple-darwin" and "--target aarch64-apple-darwin").
>
> This is much easier to understand for those of us unfamiliar with
> the macOS ecosystem.  Very much appreciated.
>
> > +$(RUST_LIB): $(RUST_MEMBER_LIBS)
> > +     @$(call mkdir_p_parent_template)
>
> The leading @ is a bit curious because among ~20 existing use of
> this pattern, nobody adds it to squelch "mkdir -p".  In fact, the
> macro uses the standard pattern to define $(QUIET_MKDIR_P_PARENT)
> that does the squelching when $(V) is unset.
>
> > +     $(QUIET_GEN)\
> > +     if [ $(words $(RUST_TARGETS)) -gt 1 ]; then \
>
> Recipe parts in our Makefile that are written in bourne shell, the
> CodingGuidelines apply.
>
>     $ git grep -n -e 'if \[' ':(glob)**/Makefile'
>
> gives empty.  Probably,
>
>         if test $(words $(RUST_TARGETS)) -gt 1; \
>         then \
>
> would fit better.
>
> > +             lipo -create $^ -output $@; \
> > +     else \
> > +             cp $< $@; \
> > +     fi
> > +endif
> >
> >  .PHONY: rust
> >  rust: $(RUST_LIB)
>
> Other than that, looking good.
>
> Thanks.
Previous: Junio C HamanoNext: Shardul Natu via GitGitGadget
Message 17 of 46 in “Makefile: link osxkeychain helper against Rust”
  1. Makefile: link osxkeychain helper against RustShardul Natu via GitGitGadget, May 5, 2026
  2. Kristoffer HaugsbakkMay 5, 2026
  3. ShnatuMay 7, 2026
  4. Junio C HamanoMay 8, 2026
  5. Koji NakamaruMay 8, 2026
  6. ShnatuMay 8, 2026
  7. Makefile: link osxkeychain & support universal RustShardul Natu via GitGitGadget, Jul 1, 2026
  8. Junio C HamanoJul 2, 2026
  9. Patrick SteinhardtJul 2, 2026
  10. Shardul NatuJul 2, 2026
  11. Patrick SteinhardtJul 3, 2026
  12. lipo availability [was: [PATCH v2] Makefile: link osxkeychain & support universal Rust]Ben Knoble, Jul 3, 2026
  13. 0/2 Makefile: link osxkeychain helper against RustShardul Natu via GitGitGadget, Jul 2, 2026
  14. 1/2 Makefile: add $(RUST_LIB) prerequisite to osxkeychainShardul Natu via GitGitGadget, Jul 2, 2026
  15. 2/2 Makefile: support universal macOS builds via RUST_TARGETSShardul Natu via GitGitGadget, Jul 2, 2026
  16. Junio C HamanoJul 3, 2026
  17. Shardul NatuJul 3, 2026
  18. 0/2 Makefile: link osxkeychain helper against RustShardul Natu via GitGitGadget, Jul 4, 2026
  19. 1/2 Makefile: add $(RUST_LIB) prerequisite to osxkeychainShardul Natu via GitGitGadget, Jul 4, 2026
  20. Patrick SteinhardtJul 6, 2026
  21. 2/2 Makefile: support universal macOS builds via RUST_TARGETSShardul Natu via GitGitGadget, Jul 4, 2026
  22. Patrick SteinhardtJul 6, 2026
  23. Junio C HamanoJul 5, 2026
  24. Shardul NatuJul 5, 2026
  25. 0/2 Makefile: link osxkeychain helper against RustShardul Natu via GitGitGadget, Jul 6, 2026
  26. 1/2 Makefile: add $(GITLIBS) prerequisite to osxkeychainShardul Natu via GitGitGadget, Jul 6, 2026
  27. Junio C HamanoJul 6, 2026
  28. ShnatuJul 7, 2026
  29. ShnatuJul 7, 2026
  30. Shardul NatuJul 8, 2026
  31. 2/2 Makefile: support universal macOS builds via RUST_TARGETSShardul Natu via GitGitGadget, Jul 6, 2026
  32. 0/3 Makefile: link osxkeychain helper against RustShardul Natu via GitGitGadget, Jul 6, 2026
  33. 1/3 Makefile: add $(RUST_LIB) prerequisite to osxkeychainShardul Natu via GitGitGadget, Jul 6, 2026
  34. 2/3 Makefile: support universal macOS builds via RUST_TARGETSShardul Natu via GitGitGadget, Jul 6, 2026
  35. 3/3 contrib: wire up osxkeychain in contrib/Makefile on macOSShardul Natu via GitGitGadget, Jul 6, 2026
  36. 0/3 Makefile: link osxkeychain helper against RustShardul Natu via GitGitGadget, Jul 7, 2026
  37. 1/3 Makefile: add $(RUST_LIB) prerequisite to osxkeychainShardul Natu via GitGitGadget, Jul 7, 2026
  38. 2/3 Makefile: support universal macOS builds via RUST_TARGETSShardul Natu via GitGitGadget, Jul 7, 2026
  39. 3/3 contrib: wire up osxkeychain in contrib/Makefile on macOSShardul Natu via GitGitGadget, Jul 7, 2026
  40. Junio C HamanoJul 8, 2026
  41. Junio C HamanoJul 7, 2026
  42. 0/3 Makefile: link osxkeychain helper against RustShardul Natu via GitGitGadget, Jul 8, 2026
  43. 1/3 Makefile: add $(RUST_LIB) prerequisite to osxkeychainShardul Natu via GitGitGadget, Jul 8, 2026
  44. 2/3 Makefile: support universal macOS builds via RUST_TARGETSShardul Natu via GitGitGadget, Jul 8, 2026
  45. 3/3 contrib: wire up osxkeychain in contrib/Makefile on macOSShardul Natu via GitGitGadget, Jul 8, 2026
  46. Junio C HamanoJul 8, 2026

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.