416
# Define LINK_FUZZ_PROGRAMS if you want `make all` to also build the fuzz test
417
# programs in oss-fuzz/.
418
#
419
+# Define INCLUDE_LIBGIT_RS if you want `make all` and `make test` to build and
420
+# test the Rust crate in contrib/libgit-sys.
421
+#
422
# === Optional library: libintl ===
423
#
424
# Define NO_GETTEXT if you don't want Git output to be translated.
660
GCOV = gcov
661
STRIP = strip
662
SPATCH = spatch
663
+LD = ld
664
+OBJCOPY = objcopy
665
666
export TCL_PATH TCLTK_PATH
667
680
FUZZ_PROGRAMS =
681
GIT_OBJS =
682
LIB_OBJS =
683
+LIBGIT_PUB_OBJS =
684
SCALAR_OBJS =
685
OBJECTS =
686
OTHER_PROGRAMS =
2242
COMPAT_OBJS += compat/fsmonitor/fsm-path-utils-$(FSMONITOR_OS_SETTINGS).o
2243
endif
2244
2245
+ifdef INCLUDE_LIBGIT_RS
2246
+ # Enable symbol hiding in contrib/libgit-sys/libgitpub.a without making
2247
+ # us rebuild the whole tree every time we run a Rust build.
2248
+ BASIC_CFLAGS += -fvisibility=hidden
2249
+endif
2250
+
2251
ifeq ($(TCLTK_PATH),)
2252
NO_TCLTK = NoThanks
2253
endif
2744
OBJECTS += $(CLAR_TEST_OBJS)
2745
OBJECTS += $(patsubst %,$(UNIT_TEST_DIR)/%.o,$(UNIT_TEST_PROGRAMS))
2746
2747
+ifdef INCLUDE_LIBGIT_RS
2748
+ OBJECTS += contrib/libgit-sys/public_symbol_export.o
2749
+endif
2750
+
2751
ifndef NO_CURL
2752
OBJECTS += http.o http-walker.o remote-curl.o
2753
endif
3742
$(RM) $(htmldocs).tar.gz $(manpages).tar.gz
3743
$(MAKE) -C Documentation/ clean
3744
$(RM) Documentation/GIT-EXCLUDED-PROGRAMS
3745
+ $(RM) -r contrib/libgit-sys/target
3746
+ $(RM) contrib/libgit-sys/partial_symbol_export.o
3747
+ $(RM) contrib/libgit-sys/hidden_symbol_export.o
3748
+ $(RM) contrib/libgit-sys/libgitpub.a
3749
ifndef NO_PERL
3750
$(RM) -r perl/build/
3751
endif
3907
build-unit-tests: $(UNIT_TEST_PROGS) $(CLAR_TEST_PROG)
3908
unit-tests: $(UNIT_TEST_PROGS) $(CLAR_TEST_PROG) t/helper/test-tool$X
3909
$(MAKE) -C t/ unit-tests
3910
+
3911
+.PHONY: libgit-sys
3912
+libgit-sys:
3913
+ $(QUIET)(\
3914
+ cd contrib/libgit-sys && \
3915
+ cargo build \
3916
+ )
3917
+ifdef INCLUDE_LIBGIT_RS
3918
+all:: libgit-sys
3919
+endif
3920
+
3921
+LIBGIT_PUB_OBJS += contrib/libgit-sys/public_symbol_export.o
3922
+LIBGIT_PUB_OBJS += libgit.a
3923
+LIBGIT_PUB_OBJS += reftable/libreftable.a
3924
+LIBGIT_PUB_OBJS += xdiff/lib.a
3925
+
3926
+LIBGIT_PARTIAL_EXPORT = contrib/libgit-sys/partial_symbol_export.o
3927
+
3928
+LIBGIT_HIDDEN_EXPORT = contrib/libgit-sys/hidden_symbol_export.o
3929
+
3930
+$(LIBGIT_PARTIAL_EXPORT): $(LIBGIT_PUB_OBJS)
3931
+ $(LD) -r $^ -o $@
3932
+
3933
+$(LIBGIT_HIDDEN_EXPORT): $(LIBGIT_PARTIAL_EXPORT)
3934
+ $(OBJCOPY) --localize-hidden $^ $@
3935
+
3936
+contrib/libgit-sys/libgitpub.a: $(LIBGIT_HIDDEN_EXPORT)
3937
+ $(AR) $(ARFLAGS) $@ $^