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 <jrnieder@gmail.com>
Jonathan Nieder committed
Jan 26, 2010 at 09:52 UTC
c373991375a4903dbb9bea69e2ce11ce819253e2
1 file changed
+7
-2
Makefile
+7
-2
@@ -1671,14 +1671,19 @@ GIT_OBJS := $(LIB_OBJS) $(BUILTIN_OBJS) $(TEST_OBJS) \
1671
$(patsubst git-%$X,%.o,$(PROGRAMS))
1672
XDIFF_OBJS = xdiff/xdiffi.o xdiff/xprepare.o xdiff/xutils.o xdiff/xemit.o \
1673
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))
1679
1680
.SUFFIXES:
1681
1677
-%.o: %.c GIT-CFLAGS
1682
+$(C_OBJ): %.o: %.c GIT-CFLAGS
1683
$(QUIET_CC)$(CC) -o $*.o -c $(ALL_CFLAGS) $<
1684
%.s: %.c GIT-CFLAGS FORCE
1685
$(QUIET_CC)$(CC) -S $(ALL_CFLAGS) $<
1681
-%.o: %.S GIT-CFLAGS
1686
+$(ASM_OBJ): %.o: %.S GIT-CFLAGS
1687
$(QUIET_CC)$(CC) -o $*.o -c $(ALL_CFLAGS) $<
1688
1689
$(GIT_OBJS): $(LIB_H)