Guest User

Untitled

a guest
Sep 16th, 2018
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Make 3.03 KB | None | 0 0
  1. ###############################################################################
  2. # Makefile for the project
  3. ###############################################################################
  4.  
  5. ## General Flags
  6. PROJECT = Mode5Demo
  7. GAME= Mode5Demo
  8. MCU = atmega644
  9. TARGET = $(GAME).elf
  10. CC = avr-gcc
  11. INFO=../gameinfo.properties
  12.  
  13. ## Kernel settings
  14. KERNEL_DIR = ../../../kernel
  15. KERNEL_OPTIONS  = -DVIDEO_MODE=5 -DINTRO_LOGO=1
  16.  
  17.  
  18. ## Options common to compile, link and assembly rules
  19. COMMON = -mmcu=$(MCU)
  20.  
  21. ## Compile options common for all C compilation units.
  22. CFLAGS = $(COMMON)
  23. CFLAGS += -Wall -gdwarf-2 -std=gnu99 -DF_CPU=28636360UL -O0 -fsigned-char -ffunction-sections
  24. CFLAGS += -MD -MP -MT $(*F).o -MF dep/$(@F).d
  25. CFLAGS += $(KERNEL_OPTIONS)
  26.  
  27.  
  28. ## Assembly specific flags
  29. ASMFLAGS = $(COMMON)
  30. ASMFLAGS += $(CFLAGS)
  31. ASMFLAGS += -x assembler-with-cpp -Wa,-gdwarf2
  32.  
  33. ## Linker flags
  34. LDFLAGS = $(COMMON)
  35. LDFLAGS += -Wl,-Map=$(GAME).map
  36. LDFLAGS += -Wl,-gc-sections
  37.  
  38.  
  39.  
  40. ## Intel Hex file production flags
  41. HEX_FLASH_FLAGS = -R .eeprom
  42.  
  43. HEX_EEPROM_FLAGS = -j .eeprom
  44. HEX_EEPROM_FLAGS += --set-section-flags=.eeprom="alloc,load"
  45. HEX_EEPROM_FLAGS += --change-section-lma .eeprom=0 --no-change-warnings
  46.  
  47.  
  48. ## Objects that must be built in order to link
  49. OBJECTS = uzeboxVideoEngineCore.o uzeboxCore.o uzeboxSoundEngine.o uzeboxSoundEngineCore.o uzeboxVideoEngine.o $(GAME).o
  50.  
  51. ## Objects explicitly added by the user
  52. LINKONLYOBJECTS =
  53.  
  54. ## Include Directories
  55. INCLUDES = -I"$(KERNEL_DIR)"
  56.  
  57. ## Build
  58. all: ../data/tiles.inc ../data/fonts6x8.inc $(TARGET) $(GAME).hex $(GAME).eep $(GAME).lss $(GAME).uze size
  59.  
  60. ## Rebuild graphics ressource
  61. ../data/fonts6x8.inc: ../data/fonts6x8.png ../data/font.gconvert.xml
  62.     gconvert ../data/font.gconvert.xml
  63.  
  64. ../data/tiles.inc: ../data/tiles.png ../data/tiles.gconvert.xml
  65.     gconvert ../data/tiles.gconvert.xml
  66.  
  67. ## Compile Kernel files
  68. uzeboxVideoEngineCore.o: $(KERNEL_DIR)/uzeboxVideoEngineCore.s
  69.     $(CC) $(INCLUDES) $(ASMFLAGS) -c  $<
  70.  
  71. uzeboxSoundEngineCore.o: $(KERNEL_DIR)/uzeboxSoundEngineCore.s
  72.     $(CC) $(INCLUDES) $(ASMFLAGS) -c  $<
  73.  
  74. uzeboxCore.o: $(KERNEL_DIR)/uzeboxCore.c
  75.     $(CC) $(INCLUDES) $(CFLAGS) -c  $<
  76.  
  77. uzeboxSoundEngine.o: $(KERNEL_DIR)/uzeboxSoundEngine.c
  78.     $(CC) $(INCLUDES) $(CFLAGS) -c  $<
  79.  
  80. uzeboxVideoEngine.o: $(KERNEL_DIR)/uzeboxVideoEngine.c
  81.     $(CC) $(INCLUDES) $(CFLAGS) -c  $<
  82.  
  83. ## Compile game sources
  84. $(GAME).o: ../Mode5Demo.c
  85.     $(CC) $(INCLUDES) $(CFLAGS) -c  $<
  86.  
  87. ##Link
  88. $(TARGET): $(OBJECTS)
  89.      $(CC) $(LDFLAGS) $(OBJECTS) $(LINKONLYOBJECTS) $(LIBDIRS) $(LIBS) -o $(TARGET)
  90.  
  91. %.hex: $(TARGET)
  92.     avr-objcopy -O ihex $(HEX_FLASH_FLAGS)  $< $@
  93.  
  94. %.eep: $(TARGET)
  95.     -avr-objcopy $(HEX_EEPROM_FLAGS) -O ihex $< $@ || exit 0
  96.  
  97. %.lss: $(TARGET)
  98.     avr-objdump -h -S $< > $@
  99.  
  100. %.uze: $(TARGET)
  101.     -$(UZEBIN_DIR)packrom $(GAME).hex $@ $(INFO)
  102.  
  103. size: ${TARGET}
  104.     @echo
  105.     @avr-size -C --mcu=${MCU} ${TARGET}
  106.  
  107. ## Clean target
  108. .PHONY: clean
  109. clean:
  110.     -rm -rf $(OBJECTS) $(GAME).* dep/* *.uze
  111.  
  112.  
  113. ## Other dependencies
  114. -include $(shell mkdir dep 2>/dev/null) $(wildcard dep/*)
Add Comment
Please, Sign In to add comment