author | Edward Rudd <urkle@outoforder.cc> |
Wed, 26 Sep 2012 14:08:46 -0400 | |
changeset 6462 | 5e09ac1aba80 |
parent 6285 | f12649068adb |
permissions | -rw-r--r-- |
5423 | 1 |
#--------------------------------------------------------------------------------- |
2 |
.SUFFIXES: |
|
3 |
#--------------------------------------------------------------------------------- |
|
5289 | 4 |
|
5 |
ifeq ($(strip $(DEVKITARM)),) |
|
5423 | 6 |
$(error "Please set DEVKITARM in your environment. export DEVKITARM=<path to>devkitARM") |
5289 | 7 |
endif |
5423 | 8 |
|
9 |
include $(DEVKITARM)/ds_rules |
|
2735
204be4fc2726
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
10 |
|
5423 | 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)) |
|
19 |
BUILD := src |
|
5515 | 20 |
SOURCES := src |
5423 | 21 |
DATA := data |
22 |
INCLUDES := include |
|
23 |
||
24 |
#--------------------------------------------------------------------------------- |
|
25 |
# options for code generation |
|
26 |
#--------------------------------------------------------------------------------- |
|
27 |
ARCH := -mthumb -mthumb-interwork \ |
|
28 |
-D__NDS__ -DENABLE_NDS -DNO_SIGNAL_H -DDISABLE_THREADS -DPACKAGE=\"SDL\" \ |
|
6251
3e8c673cad58
Removing some more references to SDL 1.3
Sam Lantinga <slouken@libsdl.org>
parents:
5536
diff
changeset
|
29 |
-DVERSION=\"2.0\" -DHAVE_ALLOCA_H=1 -DHAVE_ALLOCA=1 |
5423 | 30 |
|
6285
f12649068adb
Updated Nintendo DS support
Sam Lantinga <slouken@libsdl.org>
parents:
6251
diff
changeset
|
31 |
CFLAGS := -g -Wall -Os\ |
5423 | 32 |
-march=armv5te -mtune=arm946e-s \ |
33 |
-fomit-frame-pointer -ffast-math \ |
|
34 |
$(ARCH) |
|
2735
204be4fc2726
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
35 |
|
5423 | 36 |
CFLAGS += $(INCLUDE) -DARM9 |
37 |
CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions |
|
38 |
||
39 |
ASFLAGS := -g $(ARCH) -march=armv5te -mtune=arm946e-s |
|
40 |
LDFLAGS = -specs=ds_arm9.specs -g $(ARCH) -Wl,-Map,$(notdir $*.map) |
|
41 |
||
6285
f12649068adb
Updated Nintendo DS support
Sam Lantinga <slouken@libsdl.org>
parents:
6251
diff
changeset
|
42 |
# Set to 0 to use a framer buffer, or 1 to use the GL like hardware |
5423 | 43 |
# renderer. Alas, both cannot be used at the same time for lack of |
44 |
# display/texture memory. |
|
45 |
USE_HW_RENDERER := 1 |
|
46 |
||
47 |
ifeq ($(USE_HW_RENDERER),1) |
|
48 |
CFLAGS += -DUSE_HW_RENDERER |
|
49 |
else |
|
50 |
endif |
|
2735
204be4fc2726
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
51 |
|
5423 | 52 |
#--------------------------------------------------------------------------------- |
53 |
# list of directories containing libraries, this must be the top level containing |
|
54 |
# include and lib |
|
55 |
#--------------------------------------------------------------------------------- |
|
5515 | 56 |
LIBDIRS := $(LIBNDS) $(PORTLIBS) |
2735
204be4fc2726
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
57 |
|
5423 | 58 |
#--------------------------------------------------------------------------------- |
59 |
# no real need to edit anything past this point unless you need to add additional |
|
60 |
# rules for different file extensions |
|
61 |
#--------------------------------------------------------------------------------- |
|
62 |
ifneq ($(BUILD),$(notdir $(CURDIR))) |
|
63 |
#--------------------------------------------------------------------------------- |
|
64 |
||
65 |
export OUTPUT := $(CURDIR)/lib/lib$(TARGET).a |
|
66 |
||
67 |
export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \ |
|
68 |
$(foreach dir,$(DATA),$(CURDIR)/$(dir)) |
|
69 |
||
70 |
export DEPSDIR := $(CURDIR)/$(BUILD) |
|
2735
204be4fc2726
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
71 |
|
5423 | 72 |
CFILES := \ |
73 |
SDL.c \ |
|
74 |
SDL_assert.c \ |
|
75 |
SDL_error.c \ |
|
76 |
SDL_fatal.c \ |
|
77 |
SDL_hints.c \ |
|
78 |
SDL_log.c \ |
|
79 |
atomic/SDL_atomic.c \ |
|
80 |
atomic/SDL_spinlock.arm.c \ |
|
81 |
audio/SDL_audio.c \ |
|
82 |
audio/SDL_audiocvt.c \ |
|
83 |
audio/SDL_audiodev.c \ |
|
84 |
audio/SDL_audiotypecvt.c \ |
|
85 |
audio/SDL_mixer.c \ |
|
86 |
audio/SDL_wave.c \ |
|
87 |
audio/nds/SDL_ndsaudio.c \ |
|
88 |
cpuinfo/SDL_cpuinfo.c \ |
|
89 |
events/SDL_events.c \ |
|
90 |
events/SDL_keyboard.c \ |
|
91 |
events/SDL_mouse.c \ |
|
92 |
events/SDL_quit.c \ |
|
93 |
events/SDL_touch.c \ |
|
94 |
events/SDL_windowevents.c \ |
|
95 |
events/nds/SDL_ndsgesture.c \ |
|
96 |
file/SDL_rwops.c \ |
|
97 |
haptic/SDL_haptic.c \ |
|
98 |
haptic/nds/SDL_syshaptic.c \ |
|
99 |
joystick/SDL_joystick.c \ |
|
100 |
joystick/nds/SDL_sysjoystick.c \ |
|
101 |
power/SDL_power.c \ |
|
102 |
power/nds/SDL_syspower.c \ |
|
103 |
render/SDL_render.c \ |
|
104 |
render/SDL_yuv_sw.c \ |
|
5428
cff5d3cd5777
A better way of setting the fullscreen flag for windows on Nintendo DS
Sam Lantinga <slouken@libsdl.org>
parents:
5423
diff
changeset
|
105 |
render/nds/SDL_ndsrender.c \ |
6285
f12649068adb
Updated Nintendo DS support
Sam Lantinga <slouken@libsdl.org>
parents:
6251
diff
changeset
|
106 |
render/nds/SDL_libgl2D.c \ |
5423 | 107 |
render/software/SDL_blendfillrect.c \ |
108 |
render/software/SDL_blendline.c \ |
|
109 |
render/software/SDL_blendpoint.c \ |
|
110 |
render/software/SDL_drawline.c \ |
|
111 |
render/software/SDL_drawpoint.c \ |
|
112 |
render/software/SDL_render_sw.c \ |
|
113 |
stdlib/SDL_getenv.c \ |
|
114 |
stdlib/SDL_iconv.c \ |
|
115 |
stdlib/SDL_malloc.c \ |
|
116 |
stdlib/SDL_qsort.c \ |
|
117 |
stdlib/SDL_stdlib.c \ |
|
118 |
stdlib/SDL_string.c \ |
|
119 |
thread/SDL_thread.c \ |
|
120 |
thread/nds/SDL_syscond.c \ |
|
121 |
thread/nds/SDL_sysmutex.c \ |
|
122 |
thread/nds/SDL_syssem.c \ |
|
123 |
thread/nds/SDL_systhread.c \ |
|
124 |
timer/SDL_timer.c \ |
|
125 |
timer/nds/SDL_systimer.c \ |
|
126 |
video/SDL_RLEaccel.c \ |
|
127 |
video/SDL_blit.c \ |
|
128 |
video/SDL_blit_0.c \ |
|
129 |
video/SDL_blit_1.c \ |
|
130 |
video/SDL_blit_A.c \ |
|
131 |
video/SDL_blit_N.c \ |
|
132 |
video/SDL_blit_auto.c \ |
|
133 |
video/SDL_blit_copy.c \ |
|
134 |
video/SDL_blit_slow.c \ |
|
135 |
video/SDL_bmp.c \ |
|
136 |
video/SDL_clipboard.c \ |
|
137 |
video/SDL_fillrect.c \ |
|
138 |
video/SDL_pixels.c \ |
|
139 |
video/SDL_rect.c \ |
|
140 |
video/SDL_stretch.c \ |
|
141 |
video/SDL_surface.c \ |
|
142 |
video/SDL_video.c \ |
|
143 |
video/nds/SDL_ndsevents.c \ |
|
5428
cff5d3cd5777
A better way of setting the fullscreen flag for windows on Nintendo DS
Sam Lantinga <slouken@libsdl.org>
parents:
5423
diff
changeset
|
144 |
video/nds/SDL_ndsvideo.c \ |
cff5d3cd5777
A better way of setting the fullscreen flag for windows on Nintendo DS
Sam Lantinga <slouken@libsdl.org>
parents:
5423
diff
changeset
|
145 |
video/nds/SDL_ndswindow.c |
2735
204be4fc2726
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
146 |
|
204be4fc2726
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
147 |
|
5423 | 148 |
#CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp))) |
149 |
#SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s))) |
|
150 |
#BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*))) |
|
5289 | 151 |
|
5423 | 152 |
#--------------------------------------------------------------------------------- |
153 |
# use CXX for linking C++ projects, CC for standard C |
|
154 |
#--------------------------------------------------------------------------------- |
|
155 |
ifeq ($(strip $(CPPFILES)),) |
|
156 |
#--------------------------------------------------------------------------------- |
|
157 |
export LD := $(CC) |
|
158 |
#--------------------------------------------------------------------------------- |
|
159 |
else |
|
160 |
#--------------------------------------------------------------------------------- |
|
161 |
export LD := $(CXX) |
|
162 |
#--------------------------------------------------------------------------------- |
|
163 |
endif |
|
164 |
#--------------------------------------------------------------------------------- |
|
165 |
||
166 |
export OFILES := $(addsuffix .o,$(BINFILES)) \ |
|
167 |
$(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o) |
|
2735
204be4fc2726
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
168 |
|
5423 | 169 |
export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \ |
170 |
$(foreach dir,$(LIBDIRS),-I$(dir)/include) \ |
|
5515 | 171 |
-I$(CURDIR)/$(BUILD) \ |
172 |
-I$(PORTLIBS)/include/SDL |
|
5423 | 173 |
|
174 |
.PHONY: $(BUILD) clean all |
|
175 |
||
176 |
#--------------------------------------------------------------------------------- |
|
177 |
all: arm_only $(BUILD) install nds_test |
|
178 |
||
179 |
lib: |
|
180 |
@[ -d $@ ] || mkdir -p $@ |
|
181 |
||
182 |
$(BUILD): lib |
|
183 |
@[ -d $@ ] || mkdir -p $@ |
|
184 |
@$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile.ds -s |
|
185 |
||
186 |
install: $(BUILD) |
|
5515 | 187 |
@mkdir -p $(PORTLIBS)/include/SDL/ |
188 |
@rsync -a $(OUTPUT) $(PORTLIBS)/lib/ |
|
189 |
@rsync -a include/*.h $(PORTLIBS)/include/SDL/ |
|
2735
204be4fc2726
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
190 |
|
204be4fc2726
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
191 |
nds_test: |
5515 | 192 |
$(MAKE) -C test/nds-test-progs -s |
5423 | 193 |
|
194 |
tags: |
|
5515 | 195 |
cd $(SOURCES); etags $(CFILES) |
5423 | 196 |
|
197 |
# This file must be compiled with the ARM instruction set, not |
|
198 |
# thumb. Use devkitpro way of doing things. |
|
199 |
arm_only: src/atomic/SDL_spinlock.arm.c |
|
200 |
src/atomic/SDL_spinlock.arm.c: src/atomic/SDL_spinlock.c |
|
201 |
@cp $< $@ |
|
202 |
||
203 |
#--------------------------------------------------------------------------------- |
|
204 |
clean: |
|
205 |
@echo clean ... |
|
206 |
@cd src; rm -fr $(OFILES) $(OFILES:.o=.d) lib |
|
5515 | 207 |
@rm -f $(OUTPUT) |
208 |
@make -C test/nds-test-progs -s clean |
|
5423 | 209 |
|
210 |
#--------------------------------------------------------------------------------- |
|
211 |
else |
|
2735
204be4fc2726
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
212 |
|
5423 | 213 |
DEPENDS := $(OFILES:.o=.d) |
214 |
||
215 |
#--------------------------------------------------------------------------------- |
|
216 |
# main targets |
|
217 |
#--------------------------------------------------------------------------------- |
|
218 |
$(OUTPUT) : $(OFILES) |
|
219 |
||
220 |
#--------------------------------------------------------------------------------- |
|
221 |
%.bin.o : %.bin |
|
222 |
#--------------------------------------------------------------------------------- |
|
223 |
@echo $(notdir $<) |
|
224 |
@$(bin2o) |
|
225 |
||
226 |
||
227 |
-include $(DEPENDS) |
|
228 |
||
229 |
#--------------------------------------------------------------------------------------- |
|
230 |
endif |
|
231 |
#--------------------------------------------------------------------------------------- |