1 #---------------------------------------------------------------------------------
2 # Clear the implicit built in rules
3 #---------------------------------------------------------------------------------
5 #---------------------------------------------------------------------------------
7 ifeq ($(strip $(DEVKITPPC
)),)
8 $(error
"Please set DEVKITPPC in your environment. export DEVKITPPC=<path to>devkitPPC")
11 include $(DEVKITPPC
)/wii_rules
13 #---------------------------------------------------------------------------------
14 # TARGET is the name of the output
15 # BUILD is the directory where object files & intermediate files will be placed
16 # SOURCES is a list of directories containing source code
17 # INCLUDES is a list of directories containing extra header files
18 #---------------------------------------------------------------------------------
19 TARGET
:= build
/$(notdir $(CURDIR
))
23 INCLUDES
:= $(DEVKITPRO
)/libogc
27 #---------------------------------------------------------------------------------
28 # options for code generation
29 #---------------------------------------------------------------------------------
31 CFLAGS
= -g
-O2
-mrvl
-Wall
$(MACHDEP
) $(INCLUDE
) -I
$(DEVKITPPC
)/local
/include
34 LDFLAGS
= -g
$(MACHDEP
) -mrvl
-Wl
,-Map
,$(notdir $@
).map
36 #---------------------------------------------------------------------------------
37 # any extra libraries we wish to link with the project
38 #---------------------------------------------------------------------------------
41 #---------------------------------------------------------------------------------
42 # list of directories containing libraries, this must be the top level containing
44 #---------------------------------------------------------------------------------
47 #---------------------------------------------------------------------------------
48 # no real need to edit anything past this point unless you need to add additional
49 # rules for different file extensions
50 #---------------------------------------------------------------------------------
51 ifneq ($(BUILD
),$(notdir $(CURDIR
)))
52 #---------------------------------------------------------------------------------
54 export OUTPUT
:= $(CURDIR
)/$(TARGET
)
56 export VPATH
:= $(foreach dir,$(SOURCES
),$(CURDIR
)/$(dir)) \
57 $(foreach dir,$(DATA
),$(CURDIR
)/$(dir))
59 export DEPSDIR
:= $(CURDIR
)/$(BUILD
)
61 #---------------------------------------------------------------------------------
62 # automatically build a list of object files for our project
63 #---------------------------------------------------------------------------------
64 CFILES
:= $(foreach dir,$(SOURCES
),$(notdir $(wildcard $(dir)/*.c
)))
65 CPPFILES
:= $(foreach dir,$(SOURCES
),$(notdir $(wildcard $(dir)/*.
cpp)))
66 sFILES
:= $(foreach dir,$(SOURCES
),$(notdir $(wildcard $(dir)/*.s
)))
67 SFILES
:= $(foreach dir,$(SOURCES
),$(notdir $(wildcard $(dir)/*.S
)))
68 BINFILES
:= $(foreach dir,$(DATA
),$(notdir $(wildcard $(dir)/*.
*)))
70 #---------------------------------------------------------------------------------
71 # use CXX for linking C++ projects, CC for standard C
72 #---------------------------------------------------------------------------------
73 ifeq ($(strip $(CPPFILES
)),)
79 export OFILES
:= $(addsuffix .o
,$(BINFILES
)) \
80 $(CPPFILES
:.
cpp=.o
) $(CFILES
:.c
=.o
) \
81 $(sFILES
:.s
=.o
) $(SFILES
:.S
=.o
)
83 #---------------------------------------------------------------------------------
84 # build a list of include paths
85 #---------------------------------------------------------------------------------
86 export INCLUDE
:= $(foreach dir,$(INCLUDES
), -iquote
$(CURDIR
)/$(dir)) \
87 $(foreach dir,$(LIBDIRS
),-I
$(dir)/include) \
88 -I
$(CURDIR
)/$(BUILD
) \
91 #---------------------------------------------------------------------------------
92 # build a list of library paths
93 #---------------------------------------------------------------------------------
94 export LIBPATHS
:= $(foreach dir,$(LIBDIRS
),-L
$(dir)/lib
) \
95 -L
$(LIBOGC_LIB
) -L
$(DEVKITPPC
)/local
/lib
97 export OUTPUT
:= $(CURDIR
)/$(TARGET
)
98 .PHONY
: $(BUILD
) install clean
100 #---------------------------------------------------------------------------------
102 @
[ -d
$@
] || mkdir
-p
$@
103 @make
--no-print-directory
-C
$(BUILD
) -f
$(CURDIR
)/Makefile
105 #---------------------------------------------------------------------------------
108 @
rm -fr
$(BUILD
) $(OUTPUT
).elf
$(OUTPUT
).dol
111 @make
--no-print-directory
-f example
/Makefile
113 dev
: clean $(BUILD
) install
115 $(RELEASE
)/$(VERSION
).
tar.gz
: $(OFILES
) $(OUTPUT
).a
$(SOURCES
)/*.h
116 @cp build
/*.a lib
/wii
117 @cp
$(SOURCES
)/*.h
include
118 @cp isfs
/source
/*.h
include/isfs
119 @
tar -cvvzf
$@
include/ lib
/
121 $(RELEASE
)/source-
$(VERSION
).
tar.gz
: $(OFILES
)
122 @
tar -cvvzf
$@ data
include source Makefile
124 source-tar
: $(RELEASE
)/source-
$(VERSION
).
tar.gz
126 tar: $(RELEASE
)/$(VERSION
).
tar.gz
129 @echo Copying libs and includes
130 @cp
$(OUTPUT
).a
$(DEVKITPRO
)/libogc
/lib
/wii
131 @cp
$(SOURCES
)/*.h
$(DEVKITPRO
)/libogc
/include
133 #---------------------------------------------------------------------------------
136 DEPENDS
:= $(OFILES
:.o
=.d
)
138 #---------------------------------------------------------------------------------
140 #---------------------------------------------------------------------------------
141 $(OUTPUT
).a
: $(OFILES
)
143 #---------------------------------------------------------------------------------
144 # This rule links in binary data with the .jpg extension
145 #---------------------------------------------------------------------------------
147 #---------------------------------------------------------------------------------
153 #---------------------------------------------------------------------------------
155 #---------------------------------------------------------------------------------