Skip to content

Commit e36cb1c

Browse files
torvaldsgitster
authored andcommitted
Makefile: add an explicit rule for building assembly output
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 301ac38 commit e36cb1c

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ common-cmds.h
159159
*.deb
160160
git-core.spec
161161
*.exe
162-
*.[ao]
162+
*.[aos]
163163
*.py[co]
164164
config.mak
165165
autom4te.cache

Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -845,6 +845,8 @@ git$X git.spec \
845845

846846
%.o: %.c GIT-CFLAGS
847847
$(QUIET_CC)$(CC) -o $*.o -c $(ALL_CFLAGS) $<
848+
%.s: %.c GIT-CFLAGS
849+
$(QUIET_CC)$(CC) -S $(ALL_CFLAGS) $<
848850
%.o: %.S
849851
$(QUIET_CC)$(CC) -o $*.o -c $(ALL_CFLAGS) $<
850852

0 commit comments

Comments
 (0)