summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLibravatar Jonathan Nieder <jrnieder@gmail.com>2010-01-26 09:52:11 -0600
committerLibravatar Jonathan Nieder <jrnieder@gmail.com>2010-01-26 10:08:55 -0600
commitc373991375a4903dbb9bea69e2ce11ce819253e2 (patch)
tree9fc0f74813ae6a755eb4e7bd9f1c6ba396d806f1
parentMakefile: disable default implicit rules (diff)
downloadtgif-c373991375a4903dbb9bea69e2ce11ce819253e2.tar.xz
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>
-rw-r--r--Makefile9
1 files changed, 7 insertions, 2 deletions
diff --git a/Makefile b/Makefile
index 8d3299a8f0..a3774f7172 100644
--- a/Makefile
+++ b/Makefile
@@ -1671,14 +1671,19 @@ GIT_OBJS := $(LIB_OBJS) $(BUILTIN_OBJS) $(TEST_OBJS) \
$(patsubst git-%$X,%.o,$(PROGRAMS))
XDIFF_OBJS = xdiff/xdiffi.o xdiff/xprepare.o xdiff/xutils.o xdiff/xemit.o \
xdiff/xmerge.o xdiff/xpatience.o
+OBJECTS := $(GIT_OBJS) $(XDIFF_OBJS)
+
+ASM_SRC := $(wildcard $(OBJECTS:o=S))
+ASM_OBJ := $(ASM_SRC:S=o)
+C_OBJ := $(filter-out $(ASM_OBJ),$(OBJECTS))
.SUFFIXES:
-%.o: %.c GIT-CFLAGS
+$(C_OBJ): %.o: %.c GIT-CFLAGS
$(QUIET_CC)$(CC) -o $*.o -c $(ALL_CFLAGS) $<
%.s: %.c GIT-CFLAGS FORCE
$(QUIET_CC)$(CC) -S $(ALL_CFLAGS) $<
-%.o: %.S GIT-CFLAGS
+$(ASM_OBJ): %.o: %.S GIT-CFLAGS
$(QUIET_CC)$(CC) -o $*.o -c $(ALL_CFLAGS) $<
$(GIT_OBJS): $(LIB_H)