git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 3/5] Makefile: learn to generate listings for targets requiring special flags

From
Jonathan Nieder <jrnieder@gmail.com>
Date
Jan 6, 2010, 08:06 UTC
Message-ID
<20100106080603.GD7298@progeny.tock>
In-Reply-To
<20100106080216.GA7298@progeny.tock>

'make git.s' to debug code generation of main() fails because git.c makes use of preprocessor symbols such as GIT_VERSION that are not set. make does not generate code listings for builtin_help.c, exec_cmd.c, builtin-init-db.c, config.c, http.c, or http-walker.c either, for the same reason.

So pass the flags used to generate each .o file when generating the corresponding assembler listing.

Cc: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
---
 Makefile |   14 +++++++-------
 1 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/Makefile b/Makefile
index 81190a6..3d774c6 100644
--- a/Makefile
+++ b/Makefile
@@ -1468,7 +1468,7 @@ strip: $(PROGRAMS) git$X
 	$(STRIP) $(STRIP_OPTS) $(PROGRAMS) git$X
 
 git.o: common-cmds.h
-git.o: ALL_CFLAGS += -DGIT_VERSION='"$(GIT_VERSION)"' \
+git.s git.o: ALL_CFLAGS += -DGIT_VERSION='"$(GIT_VERSION)"' \
 	'-DGIT_HTML_PATH="$(htmldir_SQ)"'
 
 git$X: git.o $(BUILTIN_OBJS) $(GITLIBS)
@@ -1476,7 +1476,7 @@ git$X: git.o $(BUILTIN_OBJS) $(GITLIBS)
 		$(BUILTIN_OBJS) $(ALL_LDFLAGS) $(LIBS)
 
 builtin-help.o: common-cmds.h
-builtin-help.o: ALL_CFLAGS += \
+builtin-help.s builtin-help.o: ALL_CFLAGS += \
 	'-DGIT_HTML_PATH="$(htmldir_SQ)"' \
 	'-DGIT_MAN_PATH="$(mandir_SQ)"' \
 	'-DGIT_INFO_PATH="$(infodir_SQ)"'
@@ -1637,21 +1637,21 @@ git.o git.spec \
 %.o: %.S
 	$(QUIET_CC)$(CC) -o $*.o -c $(ALL_CFLAGS) $<
 
-exec_cmd.o: ALL_CFLAGS += \
+exec_cmd.s exec_cmd.o: ALL_CFLAGS += \
 	'-DGIT_EXEC_PATH="$(gitexecdir_SQ)"' \
 	'-DBINDIR="$(bindir_relative_SQ)"' \
 	'-DPREFIX="$(prefix_SQ)"'
 
-builtin-init-db.o: ALL_CFLAGS += \
+builtin-init-db.s builtin-init-db.o: ALL_CFLAGS += \
 	-DDEFAULT_GIT_TEMPLATE_DIR='"$(template_dir_SQ)"'
 
-config.o: ALL_CFLAGS += -DETC_GITCONFIG='"$(ETC_GITCONFIG_SQ)"'
+config.s config.o: ALL_CFLAGS += -DETC_GITCONFIG='"$(ETC_GITCONFIG_SQ)"'
 
-http.o: ALL_CFLAGS += -DGIT_USER_AGENT='"git/$(GIT_VERSION)"'
+http.s http.o: ALL_CFLAGS += -DGIT_USER_AGENT='"git/$(GIT_VERSION)"'
 
 ifdef NO_EXPAT
 http-walker.o: http.h
-http-walker.o: ALL_CFLAGS += -DNO_EXPAT
+http-walker.s http-walker.o: ALL_CFLAGS += -DNO_EXPAT
 endif
 
 git-%$X: %.o $(GITLIBS)
-- 
1.6.6.rc2
Previous: Jonathan NiederNext: Jonathan Nieder
Message 12 of 20 in “Makefile fixes”
  1. 0/4 Makefile fixesJonathan Nieder, Nov 28, 2009
  2. 1/4 Makefile: fix http-push.o dependenciesJonathan Nieder, Nov 28, 2009
  3. Junio C HamanoNov 28, 2009
  4. 2/4 Makefile: make ppc/sha1ppc.o depend on GIT-CFLAGSJonathan Nieder, Nov 28, 2009
  5. Makefile: make ppc/sha1ppc.o depend on GIT-CFLAGSJonathan Nieder, Jan 6, 2010
  6. Nicolas PitreJan 6, 2010
  7. 3/4 Makefile: fix .s pattern rule dependenciesJonathan Nieder, Nov 28, 2009
  8. 0/5 Makefile: fix generation of assembler listingsJonathan Nieder, Jan 6, 2010
  9. 1/5 Makefile: regenerate assembler listings when askedJonathan Nieder, Jan 6, 2010
  10. 2/5 Makefile: use target-specific variable to pass flags to ccJonathan Nieder, Jan 6, 2010
  11. Jonathan NiederJan 7, 2010
  12. 3/5 Makefile: learn to generate listings for targets requiring special flagsJonathan Nieder, Jan 6, 2010
  13. 4/5 Makefile: consolidate .FORCE-* targetsJonathan Nieder, Jan 6, 2010
  14. 5/5 git-gui/Makefile: consolidate .FORCE-* targetsJonathan Nieder, Jan 6, 2010
  15. Shawn O. PearceJan 7, 2010
  16. Linus TorvaldsJan 6, 2010
  17. 4/4 Makefile: do not clean arm directoryJonathan Nieder, Nov 28, 2009
  18. Nanako ShiraishiJan 1, 2010
  19. Junio C HamanoJan 6, 2010
  20. Jonathan NiederJan 6, 2010

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.