Guest User

Untitled

a guest
Oct 18th, 2017
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.00 KB | None | 0 0
  1. ################################################################################
  2.  
  3. # These are variables for the GBA toolchain build
  4.  
  5. # You can add others if you wish to
  6.  
  7. ################################################################################
  8.  
  9.  
  10.  
  11. # The name of your desired GBA game
  12.  
  13. # This should be a just a name i.e MyFirstGBAGame
  14.  
  15. # No SPACES AFTER THE NAME.
  16.  
  17. PROGNAME = hw8
  18.  
  19.  
  20.  
  21. # The object files you want to compile into your program
  22.  
  23. # This should be a space (SPACE!) separated list of .o files
  24.  
  25. OFILES = hw8.o myLib.o
  26.  
  27.  
  28.  
  29. # The header files you have created.
  30.  
  31. # This is necessary to determine when to recompile for files.
  32.  
  33. # This should be a space (SPACE!) separated list of .h files
  34.  
  35. HFILES = myLib.h
  36.  
  37.  
  38.  
  39. # The flags to run the vba program with
  40.  
  41. # for a list of options run /usr/local/cs2110-tools/bin/vbam
  42.  
  43. # Most notable ones are -f0 -f1 -f13 -f15
  44.  
  45. # -f0 : Stretch 1x
  46.  
  47. # -f1 : Stretch 2x
  48.  
  49. # -f13 : Stretch 3x
  50.  
  51. # -f15 : Stretch 4x
  52.  
  53. VBAOPT = -f1
  54.  
  55.  
  56.  
  57. ################################################################################
  58.  
  59. # These are various settings used to make the GBA toolchain work
  60.  
  61. # DO NOT EDIT BELOW.
  62.  
  63. ################################################################################
  64.  
  65.  
  66.  
  67. TOOLDIR = /usr/local/cs2110-tools
  68.  
  69. CFLAGS = -Wall -Werror -std=c99 -pedantic -O2
  70.  
  71. CFLAGS += -mthumb-interwork -mlong-calls -nostartfiles
  72.  
  73. LDFLAGS = -L $(TOOLDIR)/lib \
  74.  
  75. -L $(TOOLDIR)/lib/gcc/arm-thumb-eabi/4.4.1/thumb \
  76.  
  77. -L $(TOOLDIR)/arm-thumb-eabi/lib \
  78.  
  79. --script $(TOOLDIR)/arm-thumb-eabi/lib/arm-gba.ld
  80.  
  81. CC = $(TOOLDIR)/bin/arm-thumb-eabi-gcc
  82.  
  83. AS = $(TOOLDIR)/bin/arm-thumb-eabi-as
  84.  
  85. LD = $(TOOLDIR)/bin/arm-thumb-eabi-ld
  86.  
  87. OBJCOPY = $(TOOLDIR)/bin/arm-thumb-eabi-objcopy
  88.  
  89. GDB = $(TOOLDIR)/bin/arm-thumb-eabi-gdb
  90.  
  91. GBADEPS = gbadeps
  92.  
  93. CFILES = $(OFILES:.o=.c)
  94.  
  95.  
  96.  
  97. ################################################################################
  98.  
  99. # These are the targets for the GBA build system
  100.  
  101. ################################################################################
  102.  
  103.  
  104.  
  105. all: $(GBADEPS) $(PROGNAME).gba
  106.  
  107.  
  108.  
  109. $(PROGNAME).gba: $(PROGNAME).elf
  110.  
  111. @echo "[LINK] Creating $(PROGNAME).gba"
  112.  
  113. @$(OBJCOPY) -O binary $(PROGNAME).elf $(PROGNAME).gba
  114.  
  115.  
  116.  
  117. $(PROGNAME).elf: crt0.o $(OFILES)
  118.  
  119. @echo "[LINK] Linking files together to create $(PROGNAME).elf"
  120.  
  121. @$(LD) $(LDFLAGS) -o $(PROGNAME).elf $^ -lgcc -lc -lgcc
  122.  
  123.  
  124.  
  125. crt0.o: $(TOOLDIR)/arm-thumb-eabi/lib/crt0.s
  126.  
  127. @$(AS) -mthumb-interwork $^ -o crt0.o
  128.  
  129.  
  130.  
  131. %.o: %.c
  132.  
  133. @echo "[COMPILE] Compiling $<"
  134.  
  135. @$(CC) $(CFLAGS) -c $< -o $@
  136.  
  137.  
  138.  
  139. clean:
  140.  
  141. @echo "Removing all .o .elf and .gba files"
  142.  
  143. @rm -f *.o *.elf *.gba $(GBADEPS)
  144.  
  145.  
  146.  
  147. vba: $(PROGNAME).gba
  148.  
  149. @echo "[RUN] Running Visual Boy Advance"
  150.  
  151. @$(TOOLDIR)/bin/vbam $(VBAOPT) $(PROGNAME).gba > /dev/null
  152.  
  153.  
  154.  
  155. rebuild: clean $(PROGNAME).gba
  156.  
  157.  
  158.  
  159. rebuildvba: clean vba
  160.  
  161.  
  162.  
  163. $(GBADEPS): $(CFILES) $(HFILES)
  164.  
  165. @$(CC) $(CFLAGS) -MM $(CFILES) > $(GBADEPS)
  166.  
  167.  
  168.  
  169. -include $(GBADEPS)
Add Comment
Please, Sign In to add comment