Skip to content

Commit ed953e1

Browse files
committed
Merge branch 'ab/make-cleanup'
Reorganize Makefile to allow building git.o and other essential objects without extra stuff needed only for testing. * ab/make-cleanup: Makefile: add {program,xdiff,test,git,fuzz}-objs & objects targets Makefile: split OBJECTS into OBJECTS and GIT_OBJS Makefile: sort OBJECTS assignment for subsequent change Makefile: split up long OBJECTS line Makefile: guard against TEST_OBJS in the environment
2 parents 9198c13 + 029bac0 commit ed953e1

File tree

1 file changed

+26
-5
lines changed

1 file changed

+26
-5
lines changed

Makefile

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -578,7 +578,9 @@ GENERATED_H =
578578
EXTRA_CPPFLAGS =
579579
FUZZ_OBJS =
580580
FUZZ_PROGRAMS =
581+
GIT_OBJS =
581582
LIB_OBJS =
583+
OBJECTS =
582584
PROGRAM_OBJS =
583585
PROGRAMS =
584586
EXCLUDED_PROGRAMS =
@@ -587,6 +589,7 @@ SCRIPT_PYTHON =
587589
SCRIPT_SH =
588590
SCRIPT_LIB =
589591
TEST_BUILTINS_OBJS =
592+
TEST_OBJS =
590593
TEST_PROGRAMS_NEED_X =
591594
THIRD_PARTY_SOURCES =
592595

@@ -662,6 +665,8 @@ ETAGS_TARGET = TAGS
662665
FUZZ_OBJS += fuzz-commit-graph.o
663666
FUZZ_OBJS += fuzz-pack-headers.o
664667
FUZZ_OBJS += fuzz-pack-idx.o
668+
.PHONY: fuzz-objs
669+
fuzz-objs: $(FUZZ_OBJS)
665670

666671
# Always build fuzz objects even if not testing, to prevent bit-rot.
667672
all:: $(FUZZ_OBJS)
@@ -679,6 +684,8 @@ PROGRAM_OBJS += http-backend.o
679684
PROGRAM_OBJS += imap-send.o
680685
PROGRAM_OBJS += sh-i18n--envsubst.o
681686
PROGRAM_OBJS += shell.o
687+
.PHONY: program-objs
688+
program-objs: $(PROGRAM_OBJS)
682689

683690
# Binary suffix, set to .exe for Windows builds
684691
X =
@@ -2378,16 +2385,30 @@ XDIFF_OBJS += xdiff/xmerge.o
23782385
XDIFF_OBJS += xdiff/xpatience.o
23792386
XDIFF_OBJS += xdiff/xprepare.o
23802387
XDIFF_OBJS += xdiff/xutils.o
2388+
.PHONY: xdiff-objs
2389+
xdiff-objs: $(XDIFF_OBJS)
23812390

23822391
TEST_OBJS := $(patsubst %$X,%.o,$(TEST_PROGRAMS)) $(patsubst %,t/helper/%,$(TEST_BUILTINS_OBJS))
2383-
OBJECTS := $(LIB_OBJS) $(BUILTIN_OBJS) $(PROGRAM_OBJS) $(TEST_OBJS) \
2384-
$(XDIFF_OBJS) \
2385-
$(FUZZ_OBJS) \
2386-
common-main.o \
2387-
git.o
2392+
.PHONY: test-objs
2393+
test-objs: $(TEST_OBJS)
2394+
2395+
GIT_OBJS += $(LIB_OBJS)
2396+
GIT_OBJS += $(BUILTIN_OBJS)
2397+
GIT_OBJS += common-main.o
2398+
GIT_OBJS += git.o
2399+
.PHONY: git-objs
2400+
git-objs: $(GIT_OBJS)
2401+
2402+
OBJECTS += $(GIT_OBJS)
2403+
OBJECTS += $(PROGRAM_OBJS)
2404+
OBJECTS += $(TEST_OBJS)
2405+
OBJECTS += $(XDIFF_OBJS)
2406+
OBJECTS += $(FUZZ_OBJS)
23882407
ifndef NO_CURL
23892408
OBJECTS += http.o http-walker.o remote-curl.o
23902409
endif
2410+
.PHONY: objects
2411+
objects: $(OBJECTS)
23912412

23922413
dep_files := $(foreach f,$(OBJECTS),$(dir $f).depend/$(notdir $f).d)
23932414
dep_dirs := $(addsuffix .depend,$(sort $(dir $(OBJECTS))))

0 commit comments

Comments
 (0)