1 #---------------------------------------------------------------------------------
3 #---------------------------------------------------------------------------------
5 ifeq ($(strip $(DEVKITARM
)),)
6 $(error
"Please set DEVKITARM in your environment. export DEVKITARM=<path to>devkitARM")
9 include $(DEVKITARM
)/ds_rules
11 #---------------------------------------------------------------------------------
12 # TARGET is the name of the output
13 # BUILD is the directory where object files & intermediate files will be placed
14 # SOURCES is a list of directories containing source code
15 # DATA is a list of directories containing data files
16 # INCLUDES is a list of directories containing header files
17 #---------------------------------------------------------------------------------
18 TARGET
:= $(shell basename $(CURDIR
))
24 #---------------------------------------------------------------------------------
25 # options for code generation
26 #---------------------------------------------------------------------------------
27 ARCH
:= -mthumb
-mthumb-interwork
30 -march
=armv5te
-mtune
=arm946e-s \
31 -fomit-frame-pointer
-ffast-math \
34 CFLAGS
+= $(INCLUDE
) -DARM9
35 CXXFLAGS
:= $(CFLAGS
) -fno-rtti
-fno-exceptions
37 ASFLAGS
:= $(ARCH
) -march
=armv5te
-mtune
=arm946e-s
38 LDFLAGS
= -specs
=ds_arm9.specs
-g
$(ARCH
) -Wl
,-Map
,$(notdir $*.map
)
40 #---------------------------------------------------------------------------------
41 # list of directories containing libraries, this must be the top level containing
43 #---------------------------------------------------------------------------------
46 #---------------------------------------------------------------------------------
47 # no real need to edit anything past this point unless you need to add additional
48 # rules for different file extensions
49 #---------------------------------------------------------------------------------
50 ifneq ($(BUILD
),$(notdir $(CURDIR
)))
51 #---------------------------------------------------------------------------------
53 export OUTPUT
:= $(CURDIR
)/lib
/libz.a
55 export VPATH
:= $(foreach dir,$(SOURCES
),$(CURDIR
)/$(dir)) \
56 $(foreach dir,$(DATA
),$(CURDIR
)/$(dir))
58 export DEPSDIR
:= $(CURDIR
)/$(BUILD
)
60 CFILES
:= $(foreach dir,$(SOURCES
),$(notdir $(wildcard $(dir)/*.c
)))
61 CPPFILES
:= $(foreach dir,$(SOURCES
),$(notdir $(wildcard $(dir)/*.
cpp)))
62 SFILES
:= $(foreach dir,$(SOURCES
),$(notdir $(wildcard $(dir)/*.s
)))
63 BINFILES
:= $(foreach dir,$(DATA
),$(notdir $(wildcard $(dir)/*.
*)))
65 #---------------------------------------------------------------------------------
66 # use CXX for linking C++ projects, CC for standard C
67 #---------------------------------------------------------------------------------
68 ifeq ($(strip $(CPPFILES
)),)
69 #---------------------------------------------------------------------------------
71 #---------------------------------------------------------------------------------
73 #---------------------------------------------------------------------------------
75 #---------------------------------------------------------------------------------
77 #---------------------------------------------------------------------------------
79 export OFILES
:= $(addsuffix .o
,$(BINFILES
)) \
80 $(CPPFILES
:.
cpp=.o
) $(CFILES
:.c
=.o
) $(SFILES
:.s
=.o
)
82 export INCLUDE
:= $(foreach dir,$(INCLUDES
),-I
$(CURDIR
)/$(dir)) \
83 $(foreach dir,$(LIBDIRS
),-I
$(dir)/include) \
86 .PHONY
: $(BUILD
) clean all
88 #---------------------------------------------------------------------------------
90 @
[ -d
$@
] || mkdir
-p
include
94 @
[ -d
$@
] || mkdir
-p
$@
97 @
[ -d
$@
] || mkdir
-p
$@
98 @
$(MAKE
) --no-print-directory
-C
$(BUILD
) -f
$(CURDIR
)/Makefile
100 #---------------------------------------------------------------------------------
105 #---------------------------------------------------------------------------------
108 DEPENDS
:= $(OFILES
:.o
=.d
)
110 #---------------------------------------------------------------------------------
112 #---------------------------------------------------------------------------------
113 $(OUTPUT
) : $(OFILES
)
115 #---------------------------------------------------------------------------------
117 #---------------------------------------------------------------------------------
124 #---------------------------------------------------------------------------------------
126 #---------------------------------------------------------------------------------------