1 # This is included from the main Android emulator build script 2 # to declare the SDL-related sources, compiler flags and libraries 3 # 4 5 SDL_OLD_LOCAL_PATH := $(LOCAL_PATH) 6 7 LOCAL_PATH := $(call my-dir) 8 9 SDL_CFLAGS := -I$(LOCAL_PATH)/include 10 SDL_LDLIBS := 11 SDL_STATIC_LIBRARIES := 12 13 SDL_SOURCES := 14 15 ifeq ($(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 28 endif 29 30 ifeq ($(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 43 endif 44 45 ifeq ($(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 65 endif 66 67 ifeq ($(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 76 endif 77 78 79 # the main src/ sources 80 # 81 SRCS := SDL.c \ 82 SDL_error.c \ 83 SDL_fatal.c \ 84 85 SRCS += 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 93 SRCS += file/SDL_rwops.c 94 95 SRCS += 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 102 SRCS += cpuinfo/SDL_cpuinfo.c 103 104 SDL_SOURCES += $(SRCS:%=src/%) 105 106 # the LoadSO sources 107 # 108 109 SRCS := 110 111 ifeq ($(SDL_CONFIG_LOADSO_DLOPEN),yes) 112 SRCS += dlopen/SDL_sysloadso.c 113 SDL_LDLIBS += -ldl 114 endif 115 116 ifeq ($(SDL_CONFIG_LOADSO_DLCOMPAT),yes) 117 SRCS += macosx/SDL_dlcompat.c 118 endif 119 120 ifeq ($(SDL_CONFIG_LOADSO_WIN32),yes) 121 SRCS += win32/SDL_sysloadso.c 122 endif 123 124 SDL_SOURCES += $(SRCS:%=src/loadso/%) 125 126 # the Thread sources 127 # 128 129 SRCS := SDL_thread.c 130 131 ifeq ($(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 136 endif 137 138 ifeq ($(SDL_CONFIG_THREAD_WIN32),yes) 139 SRCS += win32/SDL_sysmutex.c \ 140 win32/SDL_syssem.c \ 141 win32/SDL_systhread.c 142 endif 143 144 SDL_SOURCES += $(SRCS:%=src/thread/%) 145 146 # the Timer sources 147 # 148 149 SRCS := SDL_timer.c 150 151 ifeq ($(SDL_CONFIG_TIMER_UNIX),yes) 152 SRCS += unix/SDL_systimer.c 153 endif 154 155 ifeq ($(SDL_CONFIG_TIMER_WIN32),yes) 156 SRCS += win32/SDL_systimer.c 157 endif 158 159 SDL_SOURCES += $(SRCS:%=src/timer/%) 160 161 # the Video sources 162 # 163 164 SRCS := 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 181 SRCS += dummy/SDL_nullevents.c \ 182 dummy/SDL_nullmouse.c \ 183 dummy/SDL_nullvideo.c 184 185 ifeq ($(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 192 endif 193 194 ifeq ($(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 200 endif 201 202 ifeq ($(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 214 endif 215 216 ifeq ($(SDL_CONFIG_VIDEO_X11_DGAMOUSE),yes) 217 SRCS += x11/SDL_x11dga.c 218 endif 219 220 ifeq ($(SDL_CONFIG_VIDEO_X11_XME),yes) 221 SRCS += Xext/XME/xme.c 222 endif 223 224 ifeq ($(SDL_CONFIG_VIDEO_X11_XINERAMA),yes) 225 SRCS += Xext/Xinerama/Xinerama.c 226 endif 227 228 ifeq ($(SDL_CONFIG_VIDEO_X11_XV),yes) 229 SRCS += Xext/Xv/Xv.c 230 endif 231 232 SDL_SOURCES += $(SRCS:%=src/video/%) 233 234 $(call start-emulator-library,emulator_libSDL) 235 LOCAL_C_INCLUDES += $(LOCAL_PATH)/include 236 LOCAL_SRC_FILES := $(SDL_SOURCES) 237 $(call end-emulator-library) 238 239 $(call start-emulator64-library,emulator_lib64SDL) 240 LOCAL_SRC_FILES := $(SDL_SOURCES) 241 LOCAL_C_INCLUDES += $(LOCAL_PATH)/include 242 $(call end-emulator-library) 243 244 ## Build libSDLmain 245 ## 246 247 SRCS := 248 249 ifeq ($(SDL_CONFIG_MAIN_DUMMY),yes) 250 SRCS += dummy/SDL_dummy_main.c 251 endif 252 253 ifeq ($(SDL_CONFIG_MAIN_MACOSX),yes) 254 SRCS += macosx/SDLMain.m 255 endif 256 257 ifeq ($(SDL_CONFIG_MAIN_WIN32),yes) 258 SRCS += win32/SDL_win32_main.c 259 endif 260 261 SDLMAIN_SOURCES := $(SRCS:%=src/main/%) 262 263 $(call start-emulator-library,emulator_libSDLmain) 264 LOCAL_C_INCLUDES += $(LOCAL_PATH)/include 265 LOCAL_CFLAGS += $(SDL_CFLAGS) 266 LOCAL_SRC_FILES := $(SDLMAIN_SOURCES) 267 $(call end-emulator-library) 268 269 $(call start-emulator64-library,emulator_lib64SDLmain) 270 LOCAL_C_INCLUDES += $(LOCAL_PATH)/include 271 LOCAL_CFLAGS += $(SDL_CFLAGS) 272 LOCAL_SRC_FILES := $(SDLMAIN_SOURCES) 273 $(call end-emulator-library) 274 275 # Restore LOCAL_PATH 276 LOCAL_PATH := $(SDL_OLD_LOCAL_PATH) 277