1 # Makefile for the Wii port of RPN.
\r
2 # Based on the template Makefile from devkitPPC.
\r
4 #---------------------------------------------------------------------------------
\r
5 # Clear the implicit built in rules
\r
6 #---------------------------------------------------------------------------------
\r
8 #---------------------------------------------------------------------------------
\r
9 ifeq ($(strip $(DEVKITPPC)),)
\r
10 $(error "Please set DEVKITPPC in your environment. export DEVKITPPC=<path to>devkitPPC")
\r
13 include $(DEVKITPPC)/wii_rules
\r
15 #---------------------------------------------------------------------------------
\r
16 # TARGET is the name of the output
\r
17 # BUILD is the directory where object files & intermediate files will be placed
\r
18 # SOURCES is a list of directories containing source code
\r
19 # INCLUDES is a list of directories containing extra header files
\r
20 #---------------------------------------------------------------------------------
\r
21 TARGET := bin/wii/rpn
\r
25 INCLUDES := src/include
\r
27 #---------------------------------------------------------------------------------
\r
28 # options for code generation
\r
29 #---------------------------------------------------------------------------------
\r
31 DEFINES = -DRPN_DOUBLE -DRPN_WII -DRPN_CONSOLE
\r
32 CFLAGS = -g -O2 -Wall $(MACHDEP) $(INCLUDE) $(DEFINES)
\r
33 CXXFLAGS = $(CFLAGS)
\r
34 LDFLAGS = -g $(MACHDEP) -Wl,-Map,$(notdir $@).map
\r
36 #---------------------------------------------------------------------------------
\r
37 # any extra libraries we wish to link with the project
\r
38 #---------------------------------------------------------------------------------
\r
39 LIBS := -lwiiuse -lbte -logc -lm
\r
41 #---------------------------------------------------------------------------------
\r
42 # list of directories containing libraries, this must be the top level containing
\r
44 #---------------------------------------------------------------------------------
\r
47 #---------------------------------------------------------------------------------
\r
48 # no real need to edit anything past this point unless you need to add additional
\r
49 # rules for different file extensions
\r
50 #---------------------------------------------------------------------------------
\r
51 ifneq ($(BUILD),$(notdir $(CURDIR)))
\r
52 #---------------------------------------------------------------------------------
\r
54 export OUTPUT := $(CURDIR)/$(TARGET)
\r
56 export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \
\r
57 $(foreach dir,$(DATA),$(CURDIR)/$(dir))
\r
59 export DEPSDIR := $(CURDIR)/$(BUILD)
\r
61 #---------------------------------------------------------------------------------
\r
62 # automatically build a list of object files for our project
\r
63 #---------------------------------------------------------------------------------
\r
64 CFILES = wii/input.c wii/setup.c wii/wii.c calculator.c commands.c \
\r
65 operators.c parser.c stack.c tokens.c variables.c console/help.c \
\r
68 #CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp)))
\r
69 #sFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s)))
\r
70 #SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.S)))
\r
71 #BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*)))
\r
74 export OFILES := $(CFILES:.c=.o) $(CPPFILES:.cpp=.o)
\r
76 #---------------------------------------------------------------------------------
\r
77 # build a list of include paths
\r
78 #---------------------------------------------------------------------------------
\r
79 export INCLUDE := $(foreach dir,$(INCLUDES), -iquote $(CURDIR)/$(dir)) \
\r
80 $(foreach dir,$(LIBDIRS),-I$(dir)/include) \
\r
81 -I$(CURDIR)/$(BUILD) \
\r
84 #---------------------------------------------------------------------------------
\r
85 # build a list of library paths
\r
86 #---------------------------------------------------------------------------------
\r
87 export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib) \
\r
90 export OUTPUT := $(CURDIR)/$(TARGET)
\r
91 .PHONY: $(BUILD) clean
\r
93 #---------------------------------------------------------------------------------
\r
95 @[ -d $@ ] || mkdir -p $@
\r
96 @[ -d $@/wii ] || mkdir -p $@/wii
\r
97 @[ -d $@/console ] || mkdir -p $@/console
\r
98 @make --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile.wii
\r
100 #---------------------------------------------------------------------------------
\r
103 @rm -fr $(BUILD) $(OUTPUT).elf $(OUTPUT).dol
\r
105 #---------------------------------------------------------------------------------
\r
107 wiiload $(TARGET).dol
\r
110 #---------------------------------------------------------------------------------
\r
113 DEPENDS := $(OFILES:.o=.d)
\r
115 #---------------------------------------------------------------------------------
\r
117 #---------------------------------------------------------------------------------
\r
118 $(OUTPUT).dol: $(OUTPUT).elf
\r
119 $(OUTPUT).elf: $(OFILES)
\r
121 #---------------------------------------------------------------------------------
\r
122 # This rule links in binary data with the .jpg extension
\r
123 #---------------------------------------------------------------------------------
\r
125 #---------------------------------------------------------------------------------
\r
129 -include $(DEPENDS)
\r
131 #---------------------------------------------------------------------------------
\r
133 #---------------------------------------------------------------------------------
\r