Skip to content

Commit c373991

Browse files
committed
Makefile: list generated object files in OBJECTS
Set the OBJECTS variable to a comprehensive list of all object file targets. To make sure it is truly comprehensive, restrict the scope of the %.o pattern rule to only generate objects in this list. Attempts to build other object files will fail loudly: $ touch foo.c $ make foo.o make: *** No rule to make target `foo.o'. Stop. providing a reminder to add the new object to the OBJECTS list. The new variable is otherwise unused. The intent is for later patches to take advantage of it. Signed-off-by: Jonathan Nieder <[email protected]>
1 parent 3024888 commit c373991

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

Makefile

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1671,14 +1671,19 @@ GIT_OBJS := $(LIB_OBJS) $(BUILTIN_OBJS) $(TEST_OBJS) \
16711671
$(patsubst git-%$X,%.o,$(PROGRAMS))
16721672
XDIFF_OBJS = xdiff/xdiffi.o xdiff/xprepare.o xdiff/xutils.o xdiff/xemit.o \
16731673
xdiff/xmerge.o xdiff/xpatience.o
1674+
OBJECTS := $(GIT_OBJS) $(XDIFF_OBJS)
1675+
1676+
ASM_SRC := $(wildcard $(OBJECTS:o=S))
1677+
ASM_OBJ := $(ASM_SRC:S=o)
1678+
C_OBJ := $(filter-out $(ASM_OBJ),$(OBJECTS))
16741679

16751680
.SUFFIXES:
16761681

1677-
%.o: %.c GIT-CFLAGS
1682+
$(C_OBJ): %.o: %.c GIT-CFLAGS
16781683
$(QUIET_CC)$(CC) -o $*.o -c $(ALL_CFLAGS) $<
16791684
%.s: %.c GIT-CFLAGS FORCE
16801685
$(QUIET_CC)$(CC) -S $(ALL_CFLAGS) $<
1681-
%.o: %.S GIT-CFLAGS
1686+
$(ASM_OBJ): %.o: %.S GIT-CFLAGS
16821687
$(QUIET_CC)$(CC) -o $*.o -c $(ALL_CFLAGS) $<
16831688

16841689
$(GIT_OBJS): $(LIB_H)

0 commit comments

Comments
 (0)