Guest User

TinyG Make File - works on OS X

a guest
Mar 22nd, 2016
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.08 KB | None | 0 0
  1. ###############################################################################
  2. # Makefile for the project tinyg
  3. ###############################################################################
  4.  
  5. ## General Flags
  6. PROJECT = tinyg
  7. MCU = atxmega192a3
  8. TARGET = tinyg.elf
  9. CC = avr-gcc
  10.  
  11. CPP = avr-g++
  12.  
  13. ## Options common to compile, link and assembly rules
  14. COMMON = -mmcu=$(MCU)
  15.  
  16. ## Compile options common for all C compilation units.
  17. CFLAGS = $(COMMON)
  18. CFLAGS += -gdwarf-2 -std=gnu99 -Wall -DF_CPU=32000000UL -Os -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums
  19. CFLAGS += -MD -MP -MT $(*F).o -MF dep/$(@F).d
  20.  
  21. ## Assembly specific flags
  22. ASMFLAGS = $(COMMON)
  23. ASMFLAGS += $(CFLAGS)
  24. ASMFLAGS += -x assembler-with-cpp -Wa,-gdwarf2
  25.  
  26. ## Linker flags
  27. LDFLAGS = $(COMMON)
  28. LDFLAGS += -Wl,-u,vfprintf -lprintf_flt -lm -Wl,-Map=tinyg.map
  29.  
  30.  
  31. ## Intel Hex file production flags
  32. HEX_FLASH_FLAGS = -R .eeprom -R .fuse -R .lock -R .signature
  33.  
  34. HEX_EEPROM_FLAGS = -j .eeprom
  35. HEX_EEPROM_FLAGS += --set-section-flags=.eeprom="alloc,load"
  36. HEX_EEPROM_FLAGS += --change-section-lma .eeprom=0 --no-change-warnings
  37.  
  38.  
  39. ## Libraries
  40. LIBS = -lm
  41.  
  42. ## Objects that must be built in order to link
  43. OBJECTS = util.o canonical_machine.o config.o controller.o cycle_homing.o gcode_parser.o gpio.o help.o json_parser.o kinematics.o main.o planner.o report.o spindle.o stepper.o hardware.o test.o xmega_rtc.o xmega_eeprom.o xmega_init.o xmega_interrupts.o xio_usb.o xio_pgm.o xio_rs485.o xio_usart.o pwm.o plan_line.o plan_arc.o xio_spi.o xio_file.o network.o config_app.o text_parser.o switch.o cycle_probing.o xio.o cycle_jogging.o plan_exec.o encoder.o plan_zoid.o persistence.o
  44.  
  45. ## Objects explicitly added by the user
  46. LINKONLYOBJECTS =
  47.  
  48. ## Build
  49. all: $(TARGET) tinyg.hex tinyg.eep tinyg.lss
  50.  
  51. ## Compile
  52. util.o: ../util.c
  53. $(CC) $(INCLUDES) $(CFLAGS) -c $<
  54.  
  55. canonical_machine.o: ../canonical_machine.c
  56. $(CC) $(INCLUDES) $(CFLAGS) -c $<
  57.  
  58. config.o: ../config.c
  59. $(CC) $(INCLUDES) $(CFLAGS) -c $<
  60.  
  61. controller.o: ../controller.c
  62. $(CC) $(INCLUDES) $(CFLAGS) -c $<
  63.  
  64. cycle_homing.o: ../cycle_homing.c
  65. $(CC) $(INCLUDES) $(CFLAGS) -c $<
  66.  
  67. gcode_parser.o: ../gcode_parser.c
  68. $(CC) $(INCLUDES) $(CFLAGS) -c $<
  69.  
  70. gpio.o: ../gpio.c
  71. $(CC) $(INCLUDES) $(CFLAGS) -c $<
  72.  
  73. help.o: ../help.c
  74. $(CC) $(INCLUDES) $(CFLAGS) -c $<
  75.  
  76. json_parser.o: ../json_parser.c
  77. $(CC) $(INCLUDES) $(CFLAGS) -c $<
  78.  
  79. kinematics.o: ../kinematics.c
  80. $(CC) $(INCLUDES) $(CFLAGS) -c $<
  81.  
  82. main.o: ../main.c
  83. $(CC) $(INCLUDES) $(CFLAGS) -c $<
  84.  
  85. planner.o: ../planner.c
  86. $(CC) $(INCLUDES) $(CFLAGS) -c $<
  87.  
  88. report.o: ../report.c
  89. $(CC) $(INCLUDES) $(CFLAGS) -c $<
  90.  
  91. spindle.o: ../spindle.c
  92. $(CC) $(INCLUDES) $(CFLAGS) -c $<
  93.  
  94. stepper.o: ../stepper.c
  95. $(CC) $(INCLUDES) $(CFLAGS) -c $<
  96.  
  97. hardware.o: ../hardware.c
  98. $(CC) $(INCLUDES) $(CFLAGS) -c $<
  99.  
  100. test.o: ../test.c
  101. $(CC) $(INCLUDES) $(CFLAGS) -c $<
  102.  
  103. xmega_rtc.o: ../xmega/xmega_rtc.c
  104. $(CC) $(INCLUDES) $(CFLAGS) -c $<
  105.  
  106. xmega_eeprom.o: ../xmega/xmega_eeprom.c
  107. $(CC) $(INCLUDES) $(CFLAGS) -c $<
  108.  
  109. xmega_init.o: ../xmega/xmega_init.c
  110. $(CC) $(INCLUDES) $(CFLAGS) -c $<
  111.  
  112. xmega_interrupts.o: ../xmega/xmega_interrupts.c
  113. $(CC) $(INCLUDES) $(CFLAGS) -c $<
  114.  
  115. xio_usb.o: ../xio/xio_usb.c
  116. $(CC) $(INCLUDES) $(CFLAGS) -c $<
  117.  
  118. xio_pgm.o: ../xio/xio_pgm.c
  119. $(CC) $(INCLUDES) $(CFLAGS) -c $<
  120.  
  121. xio_rs485.o: ../xio/xio_rs485.c
  122. $(CC) $(INCLUDES) $(CFLAGS) -c $<
  123.  
  124. xio_usart.o: ../xio/xio_usart.c
  125. $(CC) $(INCLUDES) $(CFLAGS) -c $<
  126.  
  127. pwm.o: ../pwm.c
  128. $(CC) $(INCLUDES) $(CFLAGS) -c $<
  129.  
  130. plan_line.o: ../plan_line.c
  131. $(CC) $(INCLUDES) $(CFLAGS) -c $<
  132.  
  133. plan_arc.o: ../plan_arc.c
  134. $(CC) $(INCLUDES) $(CFLAGS) -c $<
  135.  
  136. xio_spi.o: ../xio/xio_spi.c
  137. $(CC) $(INCLUDES) $(CFLAGS) -c $<
  138.  
  139. xio_file.o: ../xio/xio_file.c
  140. $(CC) $(INCLUDES) $(CFLAGS) -c $<
  141.  
  142. network.o: ../network.c
  143. $(CC) $(INCLUDES) $(CFLAGS) -c $<
  144.  
  145. config_app.o: ../config_app.c
  146. $(CC) $(INCLUDES) $(CFLAGS) -c $<
  147.  
  148. text_parser.o: ../text_parser.c
  149. $(CC) $(INCLUDES) $(CFLAGS) -c $<
  150.  
  151. switch.o: ../switch.c
  152. $(CC) $(INCLUDES) $(CFLAGS) -c $<
  153.  
  154. cycle_probing.o: ../cycle_probing.c
  155. $(CC) $(INCLUDES) $(CFLAGS) -c $<
  156.  
  157. xio.o: ../xio.c
  158. $(CC) $(INCLUDES) $(CFLAGS) -c $<
  159.  
  160. cycle_jogging.o: ../cycle_jogging.c
  161. $(CC) $(INCLUDES) $(CFLAGS) -c $<
  162.  
  163. plan_exec.o: ../plan_exec.c
  164. $(CC) $(INCLUDES) $(CFLAGS) -c $<
  165.  
  166. encoder.o: ../encoder.c
  167. $(CC) $(INCLUDES) $(CFLAGS) -c $<
  168.  
  169. plan_zoid.o: ../plan_zoid.c
  170. $(CC) $(INCLUDES) $(CFLAGS) -c $<
  171.  
  172. persistence.o: ../persistence.c
  173. $(CC) $(INCLUDES) $(CFLAGS) -c $<
  174.  
  175.  
  176. ##Link
  177. $(TARGET): $(OBJECTS)
  178. $(CC) $(LDFLAGS) $(OBJECTS) $(LINKONLYOBJECTS) $(LIBDIRS) $(LIBS) -o $(TARGET)
  179.  
  180. %.hex: $(TARGET)
  181. avr-objcopy -O ihex $(HEX_FLASH_FLAGS) $< $@
  182.  
  183. %.eep: $(TARGET)
  184. -avr-objcopy $(HEX_EEPROM_FLAGS) -O ihex $< $@ || exit 0
  185.  
  186. %.lss: $(TARGET)
  187. avr-objdump -h -S $< > $@
  188.  
  189. size: ${TARGET}
  190. @echo
  191. @avr-size -C --mcu=${MCU} ${TARGET}
  192.  
  193. ## Clean target
  194. .PHONY: clean
  195. clean:
  196. -rm -rf $(OBJECTS) tinyg.elf dep/* tinyg.hex tinyg.eep tinyg.lss tinyg.map
  197.  
  198.  
  199. ## Other dependencies
  200. -include $(shell mkdir dep 2>NUL) $(wildcard dep/*)
Advertisement
Add Comment
Please, Sign In to add comment