1 #---------------------------------------------------------------------------------
2 # Clear the implicit built in rules
3 #---------------------------------------------------------------------------------
5 #---------------------------------------------------------------------------------
6 ifeq ($(strip $(DEVKITPPC
)),)
7 $(error
"Please set DEVKITPPC in your environment. export DEVKITPPC=<path to>devkitPPC")
10 include $(DEVKITPPC
)/wii_rules
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 TARGET
:= $(notdir $(CURDIR
))
24 #---------------------------------------------------------------------------------
25 # options for code generation
26 #---------------------------------------------------------------------------------
28 CFLAGS
= -g
-O2
-mrvl
-Wall
$(MACHDEP
) $(INCLUDE
)
31 LDFLAGS
= -g
$(MACHDEP
) -mrvl
-Wl
,-Map
,$(notdir $@
).map
33 #---------------------------------------------------------------------------------
34 # any extra libraries we wish to link with the project
35 #---------------------------------------------------------------------------------
36 LIBS
:= -lwiiuse
-lbte
-logc
-ldb
-lm
38 #---------------------------------------------------------------------------------
39 # list of directories containing libraries, this must be the top level containing
41 #---------------------------------------------------------------------------------
44 #---------------------------------------------------------------------------------
45 # no real need to edit anything past this point unless you need to add additional
46 # rules for different file extensions
47 #---------------------------------------------------------------------------------
48 ifneq ($(BUILD
),$(notdir $(CURDIR
)))
49 #---------------------------------------------------------------------------------
51 export OUTPUT
:= $(CURDIR
)/$(TARGET
)
53 export VPATH
:= $(foreach dir,$(SOURCES
),$(CURDIR
)/$(dir)) \
54 $(foreach dir,$(DATA
),$(CURDIR
)/$(dir))
56 export DEPSDIR
:= $(CURDIR
)/$(BUILD
)
58 #---------------------------------------------------------------------------------
59 # automatically build a list of object files for our project
60 #---------------------------------------------------------------------------------
61 CFILES
:= $(foreach dir,$(SOURCES
),$(notdir $(wildcard $(dir)/*.c
)))
62 CPPFILES
:= $(foreach dir,$(SOURCES
),$(notdir $(wildcard $(dir)/*.
cpp)))
63 sFILES
:= $(foreach dir,$(SOURCES
),$(notdir $(wildcard $(dir)/*.s
)))
64 SFILES
:= $(foreach dir,$(SOURCES
),$(notdir $(wildcard $(dir)/*.S
)))
65 BINFILES
:= $(foreach dir,$(DATA
),$(notdir $(wildcard $(dir)/*.
*)))
67 #---------------------------------------------------------------------------------
68 # use CXX for linking C++ projects, CC for standard C
69 #---------------------------------------------------------------------------------
70 ifeq ($(strip $(CPPFILES
)),)
76 export OFILES
:= $(addsuffix .o
,$(BINFILES
)) \
77 $(CPPFILES
:.
cpp=.o
) $(CFILES
:.c
=.o
) \
78 $(sFILES
:.s
=.o
) $(SFILES
:.S
=.o
)
80 #---------------------------------------------------------------------------------
81 # build a list of include paths
82 #---------------------------------------------------------------------------------
83 export INCLUDE
:= $(foreach dir,$(INCLUDES
), -iquote
$(CURDIR
)/$(dir)) \
84 $(foreach dir,$(LIBDIRS
),-I
$(dir)/include) \
85 -I
$(CURDIR
)/$(BUILD
) \
88 #---------------------------------------------------------------------------------
89 # build a list of library paths
90 #---------------------------------------------------------------------------------
91 export LIBPATHS
:= $(foreach dir,$(LIBDIRS
),-L
$(dir)/lib
) \
94 export OUTPUT
:= $(CURDIR
)/$(TARGET
)
95 .PHONY
: $(BUILD
) clean
97 #---------------------------------------------------------------------------------
99 @
[ -d
$@
] || mkdir
-p
$@
100 @make
--no-print-directory
-C
$(BUILD
) -f
$(CURDIR
)/Makefile
102 #---------------------------------------------------------------------------------
105 @
rm -fr
$(BUILD
) $(OUTPUT
).elf
$(OUTPUT
)_debug.elf
107 #---------------------------------------------------------------------------------
109 wiiload
$(TARGET
).elf
111 #---------------------------------------------------------------------------------
114 DEPENDS
:= $(OFILES
:.o
=.d
)
116 #---------------------------------------------------------------------------------
118 #---------------------------------------------------------------------------------
119 $(OUTPUT
).elf
: $(OUTPUT
)_debug.elf
123 $(OUTPUT
)_debug.elf
: $(OFILES
)
125 #---------------------------------------------------------------------------------
126 # This rule links in binary data with the .wad extension
127 #---------------------------------------------------------------------------------
129 #---------------------------------------------------------------------------------
135 #---------------------------------------------------------------------------------
137 #---------------------------------------------------------------------------------