Android.mk
author Sam Lantinga <slouken@libsdl.org>
Fri, 02 Nov 2018 17:18:03 -0700
changeset 12387 2f02c753a5dc
parent 12365 09e3ef028bc8
child 12439 3a0793e5e134
permissions -rw-r--r--
Fixed bug 4315 - little Warning in Android_JNI_CaptureAudioBuffer

Sylvain

SDL_android.c
src/core/android/SDL_android.c:1302:5: warning: variable 'br' is used uninitialized whenever switch default is taken [-Wsometimes-uninitialized]
default:
^~~~~~~
src/core/android/SDL_android.c:1306:12: note: uninitialized use occurs here
return br;
^~
src/core/android/SDL_android.c:1270:12: note: initialize the variable 'br' to silence this warning
jint br;
^


Maybe we could add some basics warning flags, not to see all warnings, but so that new warnings are caught sooner.

I would go for -Wall -Wextra, and some -Wno-warning for the allowed warnings.
     1 LOCAL_PATH := $(call my-dir)
     2 
     3 ###########################
     4 #
     5 # SDL shared library
     6 #
     7 ###########################
     8 
     9 include $(CLEAR_VARS)
    10 
    11 LOCAL_MODULE := SDL2
    12 
    13 LOCAL_C_INCLUDES := $(LOCAL_PATH)/include
    14 
    15 LOCAL_EXPORT_C_INCLUDES := $(LOCAL_C_INCLUDES)
    16 
    17 LOCAL_SRC_FILES := \
    18 	$(subst $(LOCAL_PATH)/,, \
    19 	$(wildcard $(LOCAL_PATH)/src/*.c) \
    20 	$(wildcard $(LOCAL_PATH)/src/audio/*.c) \
    21 	$(wildcard $(LOCAL_PATH)/src/audio/android/*.c) \
    22 	$(wildcard $(LOCAL_PATH)/src/audio/dummy/*.c) \
    23 	$(LOCAL_PATH)/src/atomic/SDL_atomic.c.arm \
    24 	$(LOCAL_PATH)/src/atomic/SDL_spinlock.c.arm \
    25 	$(wildcard $(LOCAL_PATH)/src/core/android/*.c) \
    26 	$(wildcard $(LOCAL_PATH)/src/cpuinfo/*.c) \
    27 	$(wildcard $(LOCAL_PATH)/src/dynapi/*.c) \
    28 	$(wildcard $(LOCAL_PATH)/src/events/*.c) \
    29 	$(wildcard $(LOCAL_PATH)/src/file/*.c) \
    30 	$(wildcard $(LOCAL_PATH)/src/haptic/*.c) \
    31 	$(wildcard $(LOCAL_PATH)/src/haptic/android/*.c) \
    32 	$(wildcard $(LOCAL_PATH)/src/joystick/*.c) \
    33 	$(wildcard $(LOCAL_PATH)/src/joystick/android/*.c) \
    34 	$(wildcard $(LOCAL_PATH)/src/joystick/hidapi/*.c) \
    35 	$(wildcard $(LOCAL_PATH)/src/loadso/dlopen/*.c) \
    36 	$(wildcard $(LOCAL_PATH)/src/power/*.c) \
    37 	$(wildcard $(LOCAL_PATH)/src/power/android/*.c) \
    38 	$(wildcard $(LOCAL_PATH)/src/filesystem/android/*.c) \
    39 	$(wildcard $(LOCAL_PATH)/src/sensor/*.c) \
    40 	$(wildcard $(LOCAL_PATH)/src/sensor/android/*.c) \
    41 	$(wildcard $(LOCAL_PATH)/src/render/*.c) \
    42 	$(wildcard $(LOCAL_PATH)/src/render/*/*.c) \
    43 	$(wildcard $(LOCAL_PATH)/src/stdlib/*.c) \
    44 	$(wildcard $(LOCAL_PATH)/src/thread/*.c) \
    45 	$(wildcard $(LOCAL_PATH)/src/thread/pthread/*.c) \
    46 	$(wildcard $(LOCAL_PATH)/src/timer/*.c) \
    47 	$(wildcard $(LOCAL_PATH)/src/timer/unix/*.c) \
    48 	$(wildcard $(LOCAL_PATH)/src/video/*.c) \
    49 	$(wildcard $(LOCAL_PATH)/src/video/android/*.c) \
    50 	$(wildcard $(LOCAL_PATH)/src/video/yuv2rgb/*.c) \
    51 	$(wildcard $(LOCAL_PATH)/src/test/*.c))
    52 
    53 LOCAL_SHARED_LIBRARIES := hidapi
    54 
    55 LOCAL_CFLAGS += -DGL_GLEXT_PROTOTYPES
    56 LOCAL_CFLAGS += \
    57 	-Wall -Wextra \
    58 	-Wdocumentation \
    59 	-Wdocumentation-unknown-command \
    60 	-Wmissing-prototypes \
    61 	-Wunreachable-code-break \
    62 	-Wunneeded-internal-declaration \
    63 	-Wmissing-variable-declarations \
    64 	-Wfloat-conversion \
    65 	-Wshorten-64-to-32 \
    66 	-Wunreachable-code-return
    67 
    68 # Warnings we haven't fixed (yet)
    69 LOCAL_CFLAGS += -Wno-unused-parameter -Wno-sign-compare
    70  
    71 
    72 LOCAL_LDLIBS := -ldl -lGLESv1_CM -lGLESv2 -llog -landroid
    73 
    74 ifeq ($(NDK_DEBUG),1)
    75     cmd-strip :=
    76 endif
    77 
    78 include $(BUILD_SHARED_LIBRARY)
    79 
    80 ###########################
    81 #
    82 # SDL static library
    83 #
    84 ###########################
    85 
    86 LOCAL_MODULE := SDL2_static
    87 
    88 LOCAL_MODULE_FILENAME := libSDL2
    89 
    90 LOCAL_LDLIBS := 
    91 LOCAL_EXPORT_LDLIBS := -ldl -lGLESv1_CM -lGLESv2 -llog -landroid
    92 
    93 include $(BUILD_STATIC_LIBRARY)
    94 
    95 ###########################
    96 #
    97 # SDL main static library
    98 #
    99 ###########################
   100 
   101 include $(CLEAR_VARS)
   102 
   103 LOCAL_C_INCLUDES := $(LOCAL_PATH)/include
   104 
   105 LOCAL_MODULE := SDL2_main
   106 
   107 LOCAL_MODULE_FILENAME := libSDL2main
   108 
   109 include $(BUILD_STATIC_LIBRARY)
   110 
   111 ###########################
   112 #
   113 # hidapi library
   114 #
   115 ###########################
   116 
   117 include $(CLEAR_VARS)
   118 
   119 LOCAL_CPPFLAGS += -std=c++11
   120 
   121 LOCAL_SRC_FILES := src/hidapi/android/hid.cpp
   122 
   123 LOCAL_MODULE := libhidapi
   124 LOCAL_LDLIBS := -llog
   125 
   126 include $(BUILD_SHARED_LIBRARY)