Skip to content

Commit

Permalink
Makefile: Save disassembly comments to a file
Browse files Browse the repository at this point in the history
This allows combining manually-written comments with an
automatically-generated assembly listing.
  • Loading branch information
smaeul committed Sep 3, 2017
1 parent 9377b8c commit 284f8a5
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
*.S
*.bin
*.dot
*.elf
Expand Down
14 changes: 11 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ M := @\#
Q :=
endif

all: $(BOARD)/arisc.elf $(BOARD)/arisc.s $(BOARD)/callgraph.svg
all: $(BOARD)/arisc.elf $(BOARD)/arisc.S $(BOARD)/callgraph.svg
$(M) DONE

check:
Expand All @@ -30,9 +30,13 @@ check:

clean:
$(M) CLEAN $(BOARD)
$(Q) rm -f $(BOARD)/arisc.bin $(BOARD)/arisc.elf $(BOARD)/arisc.s
$(Q) rm -f $(BOARD)/arisc.S $(BOARD)/arisc.bin $(BOARD)/arisc.elf $(BOARD)/arisc.s
$(Q) rm -f $(BOARD)/callgraph.dot $(BOARD)/callgraph.svg

save:
$(M) SAVE $(BOARD)/comments
$(Q) test -f $(BOARD)/arisc.S && cut -c81- $(BOARD)/arisc.S > $(BOARD)/comments

$(BOARD)/arisc.bin: $(BOARD)/arisc.hex
$(M) XXD $@
$(Q) xxd -r $^ $@
Expand All @@ -43,7 +47,11 @@ $(BOARD)/arisc.elf: $(BOARD)/arisc.bin $(BOARD)/sections $(BOARD)/symbols

$(BOARD)/arisc.s: $(BOARD)/arisc.elf
$(M) OBJDUMP $@
$(Q) $(CROSS_COMPILE)objdump -d $^ > $@
$(Q) $(CROSS_COMPILE)objdump -d $^ | expand > $@

$(BOARD)/arisc.S: $(BOARD)/arisc.s $(BOARD)/comments
$(M) PASTE $@
$(Q) paste $^ | expand -t 80,88 > $@

$(BOARD)/callgraph.dot: $(BOARD)/arisc.s
$(M) CGRAPH $@
Expand Down
Empty file added a64/arisc_tinalinux/comments
Empty file.

0 comments on commit 284f8a5

Please sign in to comment.