Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Latest commit

 

History

History
231 lines (195 loc) · 7.35 KB

Makefile.ds

File metadata and controls

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