• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# This is included from the main Android emulator build script
2# to declare the SDL-related sources, compiler flags and libraries
3#
4
5SDL_OLD_LOCAL_PATH := $(LOCAL_PATH)
6
7LOCAL_PATH := $(call my-dir)
8
9SDL_CFLAGS := -I$(LOCAL_PATH)/include
10SDL_LDLIBS :=
11SDL_STATIC_LIBRARIES :=
12
13SDL_SOURCES :=
14
15ifeq ($(HOST_OS),linux)
16    SDL_CONFIG_LOADSO_DLOPEN := yes
17    SDL_CONFIG_THREAD_PTHREAD := yes
18    SDL_CONFIG_THREAD_PTHREAD_RECURSIVE_MUTEX_NP := yes
19    SDL_CONFIG_TIMER_UNIX := yes
20    SDL_CONFIG_VIDEO_X11 := yes
21    SDL_CONFIG_VIDEO_X11_DPMS := yes
22    SDL_CONFIG_VIDEO_X11_XINERAMA := yes
23    SDL_CONFIG_VIDEO_X11_XME := yes
24    SDL_CONFIG_MAIN_DUMMY := yes
25
26    SDL_CFLAGS += -D_GNU_SOURCE=1 -D_REENTRANT
27    SDL_LDLIBS += -lm -ldl -lpthread -lrt
28endif
29
30ifeq ($(HOST_OS),freebsd)
31    SDL_CONFIG_LOADSO_DLOPEN := yes
32    SDL_CONFIG_THREAD_PTHREAD := yes
33    SDL_CONFIG_THREAD_PTHREAD_RECURSIVE_MUTEX := yes
34    SDL_CONFIG_TIMER_UNIX := yes
35    SDL_CONFIG_VIDEO_X11 := yes
36    SDL_CONFIG_VIDEO_X11_DPMS := yes
37    SDL_CONFIG_VIDEO_X11_XINERAMA := yes
38    SDL_CONFIG_VIDEO_X11_XME := yes
39    SDL_CONFIG_MAIN_DUMMY := yes
40
41    SDL_CFLAGS += -D_GNU_SOURCE=1 -D_REENTRANT
42    SDL_LDLIBS += -lm -ldl -lpthread
43endif
44
45ifeq ($(HOST_OS),darwin)
46    SDL_CONFIG_LOADSO_DLCOMPAT := yes
47    SDL_CONFIG_THREAD_PTHREAD := yes
48    SDL_CONFIG_THREAD_PTHREAD_RECURSIVE_MUTEX := yes
49    SDL_CONFIG_TIMER_UNIX := yes
50    SDL_CONFIG_VIDEO_QUARTZ := yes
51    SDL_CONFIG_MAIN_MACOSX := yes
52
53    SDL_CFLAGS += -D_GNU_SOURCE=1 -DTHREAD_SAFE
54    FRAMEWORKS := OpenGL Cocoa ApplicationServices Carbon IOKit
55    SDL_LDLIBS += $(FRAMEWORKS:%=-Wl,-framework,%)
56
57    # SDK 10.6+ deprecates __dyld_func_lookup required by dlcompat_init_func
58    # in SDL_dlcompat.o this module depends.  Instruct linker to resolve it
59    # at runtime.
60    OSX_VERSION_MAJOR := $(shell echo $(mac_sdk_version) | cut -d . -f 2)
61    OSX_VERSION_MAJOR_GREATER_THAN_OR_EQUAL_TO_6 := $(shell [ $(OSX_VERSION_MAJOR) -ge 6 ] && echo true)
62    ifeq ($(OSX_VERSION_MAJOR_GREATER_THAN_OR_EQUAL_TO_6),true)
63        LOCAL_LDLIBS += -Wl,-undefined,dynamic_lookup
64    endif
65endif
66
67ifeq ($(HOST_OS),windows)
68    SDL_CONFIG_LOADSO_WIN32 := yes
69    SDL_CONFIG_THREAD_WIN32 := yes
70    SDL_CONFIG_TIMER_WIN32 := yes
71    SDL_CONFIG_VIDEO_WINDIB := yes
72    SDL_CONFIG_MAIN_WIN32 := yes
73
74    SDL_CFLAGS += -D_GNU_SOURCE=1 -Dmain=SDL_main -DNO_STDIO_REDIRECT=1
75    SDL_LDLIBS += -luser32 -lgdi32 -lwinmm
76endif
77
78
79# the main src/ sources
80#
81SRCS := SDL.c \
82        SDL_error.c \
83        SDL_fatal.c \
84
85SRCS += events/SDL_active.c \
86	events/SDL_events.c \
87	events/SDL_expose.c \
88	events/SDL_keyboard.c \
89	events/SDL_mouse.c \
90	events/SDL_quit.c \
91	events/SDL_resize.c \
92
93SRCS += file/SDL_rwops.c
94
95SRCS += stdlib/SDL_getenv.c \
96        stdlib/SDL_iconv.c \
97        stdlib/SDL_malloc.c \
98        stdlib/SDL_qsort.c \
99        stdlib/SDL_stdlib.c \
100        stdlib/SDL_string.c
101
102SRCS += cpuinfo/SDL_cpuinfo.c
103
104SDL_SOURCES += $(SRCS:%=src/%)
105
106# the LoadSO sources
107#
108
109SRCS :=
110
111ifeq ($(SDL_CONFIG_LOADSO_DLOPEN),yes)
112  SRCS += dlopen/SDL_sysloadso.c
113  SDL_LDLIBS += -ldl
114endif
115
116ifeq ($(SDL_CONFIG_LOADSO_DLCOMPAT),yes)
117  SRCS += macosx/SDL_dlcompat.c
118endif
119
120ifeq ($(SDL_CONFIG_LOADSO_WIN32),yes)
121  SRCS += win32/SDL_sysloadso.c
122endif
123
124SDL_SOURCES += $(SRCS:%=src/loadso/%)
125
126# the Thread sources
127#
128
129SRCS := SDL_thread.c
130
131ifeq ($(SDL_CONFIG_THREAD_PTHREAD),yes)
132  SRCS += pthread/SDL_syscond.c \
133          pthread/SDL_sysmutex.c \
134          pthread/SDL_syssem.c \
135          pthread/SDL_systhread.c
136endif
137
138ifeq ($(SDL_CONFIG_THREAD_WIN32),yes)
139  SRCS += win32/SDL_sysmutex.c \
140          win32/SDL_syssem.c \
141          win32/SDL_systhread.c
142endif
143
144SDL_SOURCES += $(SRCS:%=src/thread/%)
145
146# the Timer sources
147#
148
149SRCS := SDL_timer.c
150
151ifeq ($(SDL_CONFIG_TIMER_UNIX),yes)
152  SRCS += unix/SDL_systimer.c
153endif
154
155ifeq ($(SDL_CONFIG_TIMER_WIN32),yes)
156  SRCS += win32/SDL_systimer.c
157endif
158
159SDL_SOURCES += $(SRCS:%=src/timer/%)
160
161# the Video sources
162#
163
164SRCS := SDL_RLEaccel.c \
165	SDL_blit.c \
166	SDL_blit_0.c \
167	SDL_blit_1.c \
168	SDL_blit_A.c \
169	SDL_blit_N.c \
170	SDL_bmp.c \
171	SDL_cursor.c \
172	SDL_gamma.c \
173	SDL_pixels.c \
174	SDL_stretch.c \
175	SDL_surface.c \
176	SDL_video.c \
177	SDL_yuv.c \
178	SDL_yuv_mmx.c \
179	SDL_yuv_sw.c \
180
181SRCS += dummy/SDL_nullevents.c \
182        dummy/SDL_nullmouse.c \
183        dummy/SDL_nullvideo.c
184
185ifeq ($(SDL_CONFIG_VIDEO_WINDIB),yes)
186  SRCS += windib/SDL_dibevents.c \
187          windib/SDL_dibvideo.c \
188          wincommon/SDL_sysevents.c \
189          wincommon/SDL_sysmouse.c \
190          wincommon/SDL_syswm.c \
191          wincommon/SDL_wingl.c
192endif
193
194ifeq ($(SDL_CONFIG_VIDEO_QUARTZ),yes)
195  SRCS += quartz/SDL_QuartzGL.m \
196          quartz/SDL_QuartzVideo.m \
197          quartz/SDL_QuartzWM.m \
198          quartz/SDL_QuartzWindow.m \
199          quartz/SDL_QuartzEvents.m
200endif
201
202ifeq ($(SDL_CONFIG_VIDEO_X11),yes)
203  SRCS += x11/SDL_x11dyn.c \
204          x11/SDL_x11dga.c \
205          x11/SDL_x11events.c \
206          x11/SDL_x11gamma.c \
207          x11/SDL_x11gl.c \
208          x11/SDL_x11image.c \
209          x11/SDL_x11modes.c \
210          x11/SDL_x11mouse.c \
211          x11/SDL_x11video.c \
212          x11/SDL_x11wm.c \
213          x11/SDL_x11yuv.c
214endif
215
216ifeq ($(SDL_CONFIG_VIDEO_X11_DGAMOUSE),yes)
217  SRCS += x11/SDL_x11dga.c
218endif
219
220ifeq ($(SDL_CONFIG_VIDEO_X11_XME),yes)
221  SRCS += Xext/XME/xme.c
222endif
223
224ifeq ($(SDL_CONFIG_VIDEO_X11_XINERAMA),yes)
225  SRCS += Xext/Xinerama/Xinerama.c
226endif
227
228ifeq ($(SDL_CONFIG_VIDEO_X11_XV),yes)
229  SRCS += Xext/Xv/Xv.c
230endif
231
232SDL_SOURCES += $(SRCS:%=src/video/%)
233
234$(call start-emulator-library,emulator_libSDL)
235LOCAL_C_INCLUDES += $(LOCAL_PATH)/include
236LOCAL_SRC_FILES := $(SDL_SOURCES)
237$(call end-emulator-library)
238
239$(call start-emulator64-library,emulator_lib64SDL)
240LOCAL_SRC_FILES := $(SDL_SOURCES)
241LOCAL_C_INCLUDES += $(LOCAL_PATH)/include
242$(call end-emulator-library)
243
244## Build libSDLmain
245##
246
247SRCS :=
248
249ifeq ($(SDL_CONFIG_MAIN_DUMMY),yes)
250  SRCS += dummy/SDL_dummy_main.c
251endif
252
253ifeq ($(SDL_CONFIG_MAIN_MACOSX),yes)
254  SRCS += macosx/SDLMain.m
255endif
256
257ifeq ($(SDL_CONFIG_MAIN_WIN32),yes)
258  SRCS += win32/SDL_win32_main.c
259endif
260
261SDLMAIN_SOURCES := $(SRCS:%=src/main/%)
262
263$(call start-emulator-library,emulator_libSDLmain)
264LOCAL_C_INCLUDES += $(LOCAL_PATH)/include
265LOCAL_CFLAGS += $(SDL_CFLAGS)
266LOCAL_SRC_FILES := $(SDLMAIN_SOURCES)
267$(call end-emulator-library)
268
269$(call start-emulator64-library,emulator_lib64SDLmain)
270LOCAL_C_INCLUDES += $(LOCAL_PATH)/include
271LOCAL_CFLAGS += $(SDL_CFLAGS)
272LOCAL_SRC_FILES := $(SDLMAIN_SOURCES)
273$(call end-emulator-library)
274
275# Restore LOCAL_PATH
276LOCAL_PATH := $(SDL_OLD_LOCAL_PATH)
277