SHARE
TWEET

Untitled

a guest May 19th, 2017 41 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #---------------------------------------------------------------------------------
  2. # Clear the implicit built in rules
  3. #---------------------------------------------------------------------------------
  4. .SUFFIXES:
  5. #---------------------------------------------------------------------------------
  6. ifeq ($(strip $(DEVKITPPC)),)
  7. $(error "Please set DEVKITPPC in your environment. export DEVKITPPC=<path to>devkitPPC")
  8. endif
  9.  
  10. include $(DEVKITPPC)/wii_rules
  11.  
  12. #---------------------------------------------------------------------------------
  13. # TARGET is the name of the output
  14. # BUILD is the directory where object files & intermediate files will be placed
  15. # SOURCES is a list of directories containing source code
  16. # INCLUDES is a list of directories containing extra header files
  17. #---------------------------------------------------------------------------------
  18.  
  19. TARGET      :=  $(notdir $(CURDIR))
  20. BUILD       :=  build
  21. SOURCES     :=  src src/bot
  22. DATA        :=  data
  23. INCLUDES    :=  src src/bot
  24.  
  25. #---------------------------------------------------------------------------------
  26. # options for code generation
  27. #---------------------------------------------------------------------------------
  28.  
  29. CFLAGS  = -Wno-write-strings -D_WII_ -DGEKKO -g -O3 -Wall -w -fsigned-char -fomit-frame-pointer -pipe $(MACHDEP) $(INCLUDE)
  30. CXXFLAGS    =   $(CFLAGS) -w
  31.  
  32. LDFLAGS =   -O3 -Wall -g $(MACHDEP)  -Wl,-Map,$(notdir $@).map
  33.  
  34. #---------------------------------------------------------------------------------
  35. # any extra libraries we wish to link with the project
  36. #---------------------------------------------------------------------------------
  37.  
  38. LIBS    :=  $(LIBDIRS) -ldb -lz -lSDL_mixer -lsmpeg -lSDL_image -ljpeg -lpng12 -lgl2gx -lSDL -lfat -lwiiuse -lasnd -lvorbisidec -lbte -logc -lm -lwiikeyboard -lopenal -logg -lenet
  39.  
  40. #--------------------------------------------------------------------------------
  41. # list of directories containing libraries, this must be the top level containing
  42. # include and lib
  43. #---------------------------------------------------------------------------------
  44. LIBDIRS := $(CURDIR) $(DEVKITPRO)/libogc/lib/wii
  45.  
  46. #---------------------------------------------------------------------------------
  47. # no real need to edit anything past this point unless you need to add additional
  48. # rules for different file extensions
  49. #---------------------------------------------------------------------------------
  50. ifneq ($(BUILD),$(notdir $(CURDIR)))
  51. #---------------------------------------------------------------------------------
  52.  
  53. export OUTPUT   :=  $(CURDIR)/$(TARGET)
  54.  
  55. export VPATH    :=  $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \
  56.                     $(foreach dir,$(DATA),$(CURDIR)/$(dir))
  57.  
  58. export DEPSDIR  :=  $(CURDIR)/$(BUILD)
  59.  
  60. #---------------------------------------------------------------------------------
  61. # automatically build a list of object files for our project
  62. #---------------------------------------------------------------------------------
  63. CFILES      :=  $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c)))
  64. CPPFILES    :=  $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp)))
  65. sFILES      :=  $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s)))
  66. SFILES      :=  $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.S)))
  67. BINFILES    :=  $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*)))
  68.  
  69. #---------------------------------------------------------------------------------
  70. # use CXX for linking C++ projects, CC for standard C
  71. #---------------------------------------------------------------------------------
  72. ifeq ($(strip $(CPPFILES)),)
  73.     export LD   :=  $(CC)
  74. else
  75.     export LD   :=  $(CXX)
  76. endif
  77.  
  78. export OFILES   :=  $(addsuffix .o,$(BINFILES)) \
  79.                     $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) \
  80.                     $(sFILES:.s=.o) $(SFILES:.S=.o)
  81.  
  82. #---------------------------------------------------------------------------------
  83. # build a list of include paths
  84. #---------------------------------------------------------------------------------
  85. export INCLUDE  :=  $(foreach dir,$(INCLUDES), -iquote $(CURDIR)/$(dir)) \
  86.                     $(foreach dir,$(LIBDIRS),-I$(dir)/include) \
  87.                     -I$(CURDIR)/$(BUILD) \
  88.                     -I$(LIBOGC_INC) \
  89.                     -I$(CURDIR)/enet/include \
  90.                     -I$(LIBOGC_INC)/SDL \
  91.                     -I$(CURDIR)/include/GL
  92.  
  93. #---------------------------------------------------------------------------------
  94. # build a list of library paths
  95. #---------------------------------------------------------------------------------
  96. export LIBPATHS :=  $(foreach dir,$(LIBDIRS),-L$(dir)/lib) \
  97.                     -L$(LIBOGC_LIB)
  98.  
  99.  
  100. export OUTPUT   :=  $(CURDIR)/$(TARGET)
  101. .PHONY: $(BUILD) clean
  102.  
  103. #---------------------------------------------------------------------------------
  104. $(BUILD):
  105.     @[ -d $@ ] || mkdir -p $@
  106.     @$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile
  107.  
  108. install:
  109.     @cp -v $(OUTPUT).dol cube/boot.dol
  110.  
  111. #---------------------------------------------------------------------------------
  112. clean:
  113.     @echo clean ...
  114.     @rm -fr $(BUILD) $(OUTPUT).elf $(OUTPUT).dol
  115.  
  116. #---------------------------------------------------------------------------------
  117. run:
  118.     wiiload $(TARGET).dol
  119.  
  120.  
  121.  
  122. #---------------------------------------------------------------------------------
  123. else
  124.  
  125. DEPENDS :=  $(OFILES:.o=.d)
  126.  
  127. #---------------------------------------------------------------------------------
  128. # main targets
  129. #---------------------------------------------------------------------------------
  130. $(OUTPUT).dol: $(OUTPUT).elf
  131. $(OUTPUT).elf: $(OFILES)
  132.  
  133. #---------------------------------------------------------------------------------
  134. # This rule links in binary data with the .jpg extension
  135. #---------------------------------------------------------------------------------
  136. %.jpg.o :   %.jpg
  137. #---------------------------------------------------------------------------------
  138.     @echo $(notdir $<)
  139.     $(bin2o)
  140.  
  141. -include $(DEPENDS)
  142.  
  143. #---------------------------------------------------------------------------------
  144. endif
  145. #---------------------------------------------------------------------------------
RAW Paste Data
Want to get better at Bash?
Learn to code Bash in 2017
Top