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 #---------------------------------------------------------------------------------
8 #---------------------------------------------------------------------------------
9 ifeq ($(strip $(DEVKITPPC)),)
10 $(error "Please set DEVKITPPC in your environment. export DEVKITPPC=<path to>devkitPPC")
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 #---------------------------------------------------------------------------------
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)
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
45 #---------------------------------------------------------------------------------
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 #---------------------------------------------------------------------------------
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)/*.*)))
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) \
85 #---------------------------------------------------------------------------------
86 # build a list of library paths
87 #---------------------------------------------------------------------------------
88 export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib) \
91 export OUTPUT := $(CURDIR)/$(TARGET)
92 .PHONY: $(BUILD) clean
94 #---------------------------------------------------------------------------------
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 #---------------------------------------------------------------------------------
104 @rm -fr $(BUILD) $(OUTPUT).elf $(OUTPUT).dol
106 #---------------------------------------------------------------------------------
108 wiiload $(TARGET).dol
111 #---------------------------------------------------------------------------------
114 DEPENDS := $(OFILES:.o=.d)
116 #---------------------------------------------------------------------------------
118 #---------------------------------------------------------------------------------
119 $(OUTPUT).dol: $(OUTPUT).elf
120 $(OUTPUT).elf: $(OFILES)
122 #---------------------------------------------------------------------------------
123 # This rule links in binary data with the .jpg extension
124 #---------------------------------------------------------------------------------
126 #---------------------------------------------------------------------------------
132 #---------------------------------------------------------------------------------
134 #---------------------------------------------------------------------------------