Makefile: add {program,xdiff,test,git,fuzz}-objs & objects targets

Add targets to compile the various *.o files we declared in commonly used *_OBJS variables. This is useful for debugging purposes, to e.g. get to the point where we can compile a git.o. See [1] for a use-case for this target. https://lore.kernel.org/git/YBCGtd9if0qtuQxx@coredump.intra.peff.net/ Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Ævar Arnfjörð Bjarmason committed Feb 23, 2021 at 12:41 UTC 029bac01a87ec8c3f569199c1c3ce71c21c6a161
1 file changed +12
Makefile
+12
@@ -669,6 +669,8 @@ ETAGS_TARGET = TAGS
669 FUZZ_OBJS += fuzz-commit-graph.o
670 FUZZ_OBJS += fuzz-pack-headers.o
671 FUZZ_OBJS += fuzz-pack-idx.o
672 +.PHONY: fuzz-objs
673 +fuzz-objs: $(FUZZ_OBJS)
674
675 # Always build fuzz objects even if not testing, to prevent bit-rot.
676 all:: $(FUZZ_OBJS)
@@ -686,6 +688,8 @@ PROGRAM_OBJS += http-backend.o
688 PROGRAM_OBJS += imap-send.o
689 PROGRAM_OBJS += sh-i18n--envsubst.o
690 PROGRAM_OBJS += shell.o
691 +.PHONY: program-objs
692 +program-objs: $(PROGRAM_OBJS)
693
694 # Binary suffix, set to .exe for Windows builds
695 X =
@@ -2386,13 +2390,19 @@ XDIFF_OBJS += xdiff/xmerge.o
2390 XDIFF_OBJS += xdiff/xpatience.o
2391 XDIFF_OBJS += xdiff/xprepare.o
2392 XDIFF_OBJS += xdiff/xutils.o
2393 +.PHONY: xdiff-objs
2394 +xdiff-objs: $(XDIFF_OBJS)
2395
2396 TEST_OBJS := $(patsubst %$X,%.o,$(TEST_PROGRAMS)) $(patsubst %,t/helper/%,$(TEST_BUILTINS_OBJS))
2397 +.PHONY: test-objs
2398 +test-objs: $(TEST_OBJS)
2399
2400 GIT_OBJS += $(LIB_OBJS)
2401 GIT_OBJS += $(BUILTIN_OBJS)
2402 GIT_OBJS += common-main.o
2403 GIT_OBJS += git.o
2404 +.PHONY: git-objs
2405 +git-objs: $(GIT_OBJS)
2406
2407 OBJECTS += $(GIT_OBJS)
2408 OBJECTS += $(PROGRAM_OBJS)
@@ -2402,6 +2412,8 @@ OBJECTS += $(FUZZ_OBJS)
2412 ifndef NO_CURL
2413 OBJECTS += http.o http-walker.o remote-curl.o
2414 endif
2415 +.PHONY: objects
2416 +objects: $(OBJECTS)
2417
2418 dep_files := $(foreach f,$(OBJECTS),$(dir $f).depend/$(notdir $f).d)
2419 dep_dirs := $(addsuffix .depend,$(sort $(dir $(OBJECTS))))