Skip to content

Commit c0219dd

Browse files
peffgitster
authored andcommitted
Makefile: apply dependencies consistently to sparse/asm targets
When a C file "foo.c" depends on a generated header file, we note the dependency for the "foo.o" target. However, we should also note it for other targets that are built from foo.c, like "foo.sp" and "foo.s". These tend to be missed because the latter two are not part of the default build, and are typically built after a regular build which will generate the header. Let's be consistent about including them in dependencies. This also makes us more consistent with nearby lines which tack on EXTRA_CPPFLAGS when building certain files. These flags may sometimes require extra dependencies to be added (e.g., like GIT-VERSION-FILE; this is not the case for any of the updated lines in this patch, but it is establishing a style that will be used in later patches). Technically the ".sp" and ".s" targets do not care about these dependencies, because they are force-built (".sp" because it is a phony target, and ".s" because we explicitly force a rebuild). Since the blocks in question are about communicating "things built from foo.c depend on these flags", it frees the reader from having to know or care more about how those targets are implemented, and why it is OK for only "foo.o" to depend on GIT-VERSION-FILE while "foo.sp" and "foo.s" both are impacted by $(GIT_VERSION). And it helps future-proof us if those force-build details should ever change. This patch explicitly does not update the static header dependencies used when COMPUTED_HEADER_DEPENDENCIES is off. They are similar to the GIT-VERSION-FILE case above, in that technically "foo.s" would depend on its included headers, but it is irrelevant because we force-build it anyway. So it would be tempting to update them in the same way (for readability and future-proofing). However, those rules are meant as a fallback to the computed header dependencies, which do not handle ".s" and ".sp" at all (and are a much harder problem to solve, as gcc is the one generating those dependency lists). So let's leave that harder problem until (and if) somebody wants to change the ".sp" and ".s" rules, and keep the static header dependencies consistent with the computed ones. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent eea8c32 commit c0219dd

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1979,9 +1979,9 @@ git$X: git.o GIT-LDFLAGS $(BUILTIN_OBJS) $(GITLIBS)
19791979
$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ git.o \
19801980
$(BUILTIN_OBJS) $(ALL_LDFLAGS) $(LIBS)
19811981

1982-
help.sp help.o: common-cmds.h
1982+
help.sp help.s help.o: common-cmds.h
19831983

1984-
builtin/help.sp builtin/help.o: common-cmds.h
1984+
builtin/help.sp builtin/help.s builtin/help.o: common-cmds.h
19851985
builtin/help.sp builtin/help.s builtin/help.o: EXTRA_CPPFLAGS = \
19861986
'-DGIT_HTML_PATH="$(htmldir_SQ)"' \
19871987
'-DGIT_MAN_PATH="$(mandir_SQ)"' \

0 commit comments

Comments
 (0)