Makefile: add an explicit rule for building assembly output
authorLinus Torvalds <torvalds@linux-foundation.org>
Wed, 30 May 2007 17:42:41 +0000 (10:42 -0700)
committerJunio C Hamano <gitster@pobox.com>
Sun, 10 Jun 2007 22:15:17 +0000 (15:15 -0700)
In the kernel we have a rule for *.c -> *.s files exactly because
it's nice to be able to easily say "ok, what does that generate".

Here's a patch to add such a rule to git too, in case anybody is
interested. It makes it much simpler to just do

make sha1_file.s

and look at the compiler-generated output that way, rather than having to
fire up gdb on the resulting binary.

(Add -fverbose-asm or something if you want to, it can make the result
even more readable)

[jc: add *.s to .gitignore]

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
.gitignore
Makefile
index 27e5aeb8a078a1bac61ce207e56338881ae57a07..bd49cd4627a786d6dbcd7f0d17f0fddc2add7014 100644 (file)
@@ -159,7 +159,7 @@ common-cmds.h
 *.deb
 git-core.spec
 *.exe
-*.[ao]
+*.[aos]
 *.py[co]
 config.mak
 autom4te.cache
index 0f7595552d6b13c3dda425ab4240cfb75ca4bea7..30a405292215acc4a4520e87a8c10bd7a9284a98 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -845,6 +845,8 @@ git$X git.spec \
 
 %.o: %.c GIT-CFLAGS
        $(QUIET_CC)$(CC) -o $*.o -c $(ALL_CFLAGS) $<
+%.s: %.c GIT-CFLAGS
+       $(QUIET_CC)$(CC) -S $(ALL_CFLAGS) $<
 %.o: %.S
        $(QUIET_CC)$(CC) -o $*.o -c $(ALL_CFLAGS) $<