Edited Wii Makefile.
[rpn.git] / Makefile.wii
blob7dfae46a6a6377e4a51c855bfe7c8a2dc98f5135
1 # Makefile for the Wii port of RPN.
2 # Based on the template Makefile from devkitPPC.
4 #---------------------------------------------------------------------------------
5 # Clear the implicit built in rules
6 #---------------------------------------------------------------------------------
7 .SUFFIXES:
8 #---------------------------------------------------------------------------------
9 ifeq ($(strip $(DEVKITPPC)),)
10 $(error "Please set DEVKITPPC in your environment. export DEVKITPPC=<path to>devkitPPC")
11 endif
13 include $(DEVKITPPC)/wii_rules
15 #---------------------------------------------------------------------------------
16 # TARGET is the name of the output
17 # BUILD is the directory where object files & intermediate files will be placed
18 # SOURCES is a list of directories containing source code
19 # INCLUDES is a list of directories containing extra header files
20 #---------------------------------------------------------------------------------
21 TARGET          :=      bin/wii/rpn
22 BUILD           :=      wiiobj
23 SOURCES         :=      src
24 DATA            :=      data
25 INCLUDES        :=  -I/opt/devkitpro/devkitPPC/include
27 #---------------------------------------------------------------------------------
28 # options for code generation
29 #---------------------------------------------------------------------------------
31 GIT_BUILD = $(shell git describe)
32 DEFINES = -DRPN_WII -DRPN_DOUBLE -DGIT_BUILD="\"$(GIT_BUILD)\""
33 CFLAGS  = -g -O2 -Wall $(MACHDEP) $(INCLUDE) $(DEFINES) $(INCLUDES)
34 CXXFLAGS = $(CFLAGS)
35 LDFLAGS =       -g $(MACHDEP) -Wl,-Map,$(notdir $@).map
37 #---------------------------------------------------------------------------------
38 # any extra libraries we wish to link with the project
39 #---------------------------------------------------------------------------------
40 LIBS    :=      -lwiiuse -lbte -logc -lm
42 #---------------------------------------------------------------------------------
43 # list of directories containing libraries, this must be the top level containing
44 # include and lib
45 #---------------------------------------------------------------------------------
46 LIBDIRS :=
48 #---------------------------------------------------------------------------------
49 # no real need to edit anything past this point unless you need to add additional
50 # rules for different file extensions
51 #---------------------------------------------------------------------------------
52 ifneq ($(BUILD),$(notdir $(CURDIR)))
53 #---------------------------------------------------------------------------------
55 export OUTPUT   :=      $(CURDIR)/$(TARGET)
57 export VPATH    :=      $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \
58                                         $(foreach dir,$(DATA),$(CURDIR)/$(dir))
60 export DEPSDIR  :=      $(CURDIR)/$(BUILD)
62 #---------------------------------------------------------------------------------
63 # automatically build a list of object files for our project
64 #---------------------------------------------------------------------------------
65 CPPFILES = \
66                 Calculator.cpp Commands.cpp Help.cpp History.cpp Main.cpp \
67                 Operators.cpp Variables.cpp wii/port.cpp
69 #CPPFILES       :=      $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp)))
70 #sFILES         :=      $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s)))
71 #SFILES         :=      $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.S)))
72 #BINFILES       :=      $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*)))
74 export LD       :=      $(CXX)
75 export OFILES := $(CFILES:.c=.o) $(CPPFILES:.cpp=.o)
77 #---------------------------------------------------------------------------------
78 # build a list of include paths
79 #---------------------------------------------------------------------------------
80 export INCLUDE  :=      $(foreach dir,$(INCLUDES), -iquote $(CURDIR)/$(dir)) \
81                                         $(foreach dir,$(LIBDIRS),-I$(dir)/include) \
82                                         -I$(CURDIR)/$(BUILD) \
83                                         -I$(LIBOGC_INC)
85 #---------------------------------------------------------------------------------
86 # build a list of library paths
87 #---------------------------------------------------------------------------------
88 export LIBPATHS :=      $(foreach dir,$(LIBDIRS),-L$(dir)/lib) \
89                                         -L$(LIBOGC_LIB)
91 export OUTPUT   :=      $(CURDIR)/$(TARGET)
92 .PHONY: $(BUILD) clean
94 #---------------------------------------------------------------------------------
95 $(BUILD):
96         @[ -d $@ ] || mkdir -p $@
97         @[ -d $@/wii ] || mkdir -p $@/wii
98         @[ -d $@/console ] || mkdir -p $@/console
99         @make --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile.wii
101 #---------------------------------------------------------------------------------
102 clean:
103         @echo clean ...
104         @rm -fr $(BUILD) $(OUTPUT).elf $(OUTPUT).dol
106 #---------------------------------------------------------------------------------
107 run:
108         wiiload $(TARGET).dol
111 #---------------------------------------------------------------------------------
112 else
114 DEPENDS :=      $(OFILES:.o=.d)
116 #---------------------------------------------------------------------------------
117 # main targets
118 #---------------------------------------------------------------------------------
119 $(OUTPUT).dol: $(OUTPUT).elf
120 $(OUTPUT).elf: $(OFILES)
122 #---------------------------------------------------------------------------------
123 # This rule links in binary data with the .jpg extension
124 #---------------------------------------------------------------------------------
125 %.jpg.o :       %.jpg
126 #---------------------------------------------------------------------------------
127         @echo $(notdir $<)
128         $(bin2o)
130 -include $(DEPENDS)
132 #---------------------------------------------------------------------------------
133 endif
134 #---------------------------------------------------------------------------------