Re: [PATCH v2 6/6] Makefile: add {program,xdiff,test,git}-objs & objects targets
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Feb 1, 2021, 22:30 UTC
- Message-ID
- <xmqq1rdzjuaa.fsf@gitster.c.googlers.com>
- In-Reply-To
- <20210201111715.10200-7-avarab@gmail.com>
Ævar Arnfjörð Bjarmason <avarab@gmail.com> writes:
Show 11 quoted lines
> 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> > --- > Makefile | 5 +++++ > 1 file changed, 5 insertions(+)
If you are not actually depositing files whose names are *-objs, please mark them as .PHONY: targets.
Show 37 quoted lines
> diff --git a/Makefile b/Makefile > index 07763353423..31123639f65 100644 > --- a/Makefile > +++ b/Makefile > @@ -683,6 +683,7 @@ PROGRAM_OBJS += http-backend.o > PROGRAM_OBJS += imap-send.o > PROGRAM_OBJS += sh-i18n--envsubst.o > PROGRAM_OBJS += shell.o > +program-objs: $(PROGRAM_OBJS) > > # Binary suffix, set to .exe for Windows builds > X = > @@ -2383,13 +2384,16 @@ XDIFF_OBJS += xdiff/xmerge.o > XDIFF_OBJS += xdiff/xpatience.o > XDIFF_OBJS += xdiff/xprepare.o > XDIFF_OBJS += xdiff/xutils.o > +xdiff-objs: $(XDIFF_OBJS) > > TEST_OBJS := $(patsubst %$X,%.o,$(TEST_PROGRAMS)) $(patsubst %,t/helper/%,$(TEST_BUILTINS_OBJS)) > +test-objs: $(TEST_OBJS) > > GIT_OBJS += $(LIB_OBJS) > GIT_OBJS += $(BUILTIN_OBJS) > GIT_OBJS += common-main.o > GIT_OBJS += git.o > +git-objs: $(GIT_OBJS) > > OBJECTS += $(GIT_OBJS) > OBJECTS += $(PROGRAM_OBJS) > @@ -2399,6 +2403,7 @@ OBJECTS += $(FUZZ_OBJS) > ifndef NO_CURL > OBJECTS += http.o http-walker.o remote-curl.o > endif > +objects: $(OBJECTS) > > dep_files := $(foreach f,$(OBJECTS),$(dir $f).depend/$(notdir $f).d) > dep_dirs := $(addsuffix .depend,$(sort $(dir $(OBJECTS))))