Re: [PATCH v2] Makefile: link osxkeychain & support universal Rust
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Jul 2, 2026, 01:35 UTC
- Message-ID
- <xmqqpl16kwb3.fsf@gitster.g>
- In-Reply-To
- <pull.2288.v2.git.git.1782943303219.gitgitgadget@gmail.com>
"Shardul Natu via GitGitGadget" <gitgitgadget@gmail.com> writes:
> From: Shnatu <snatu@google.com> > Signed-off-by: Shardul Natu <snatu@google.com>
You'd want to make sure these two match.
Show 18 quoted lines
> To implement this cleanly without complex shell scripting in recipes: > 1. We introduce a declarative Make pattern rule (target/%/...) to > compile each target-specific library slice (e.g., > target/aarch64-apple-darwin/...). > 2. We update the $(RUST_LIB) recipe to depend on the list of > compiled target-specific member libraries ($(RUST_MEMBER_LIBS)). > 3. On macOS, if multiple targets are specified, we use lipo to > combine them into a single Universal static library at > target/release/libgitcore.a. > 4. If only one target is specified, we copy it to the standard > path. > 5. We enforce that building for multiple targets requires macOS > (as lipo is only available there), raising a clear make error > on other platforms. > > This is a highly elegant and native Makefile solution that avoids > complex shell scripting in recipes and fully supports macOS Universal > Binaries.
You're the second person on this list I saw who calls their own creation "elegant" ;-).
Show 8 quoted lines
> +$(RUST_LIB): $(RUST_MEMBER_LIBS) > + $(QUIET_GEN)\ > + if [ $(words $(RUST_TARGETS)) -gt 1 ]; then \ > + lipo -create $^ -output $@; \ > + else \ > + cp $< $@; \ > + fi > +endif
Do we know that leading directories to $(RUST_LIB) target has already been created at this point? If not, we may want to have
$(RUST_LIB): $(RUST_MEMBER_LIBS)
+ $(call mkdir_p_parent_template)
$(QUIET_GEN)\
if [ $(words $(RUST_TARGETS)) -gt 1 ]; then \
lipo -create $^ -output $@; \on top.
Thanks for making the build procedure better.