1 #
   2 # Linux/ARM jfxmedia makefile
   3 #
   4 
   5 BUILD_DIR = $(OUTPUT_DIR)/$(BUILD_TYPE)
   6 
   7 SRCBASE_DIR = ../..
   8 OBJBASE_DIR = $(BUILD_DIR)/obj/jfxmedia
   9 
  10 DIRLIST = jni                \
  11           PipelineManagement \
  12           MediaManagement    \
  13           Locator            \
  14           Utils              \
  15           Utils/posix        \
  16           platform/gstreamer
  17 
  18 TARGET = $(BUILD_DIR)/lib$(BASE_NAME).so
  19 
  20 CFLAGS = -DTARGET_OS_LINUX=1     \
  21          -D_GNU_SOURCE           \
  22          -DGST_REMOVE_DEPRECATED \
  23          -DGST_DISABLE_GST_DEBUG \
  24          -DGST_DISABLE_LOADSAVE  \
  25          -DGST_DISABLE_XML       \
  26          -DHAVE_CONFIG_H         \
  27          -DJFXMEDIA_JNI_EXPORTS  \
  28          -DLINUX                 \
  29          -ffunction-sections -fdata-sections
  30 
  31 CPPFLAGS = -fno-rtti -ffunction-sections -fdata-sections
  32 
  33 BASE_INCLUDES = -I$(SRCBASE_DIR) \
  34                 -I$(GENERATED_HEADERS_DIR)
  35 
  36 ifdef HOST_COMPILE
  37         GSTREAMER_LITE_DIR = ../../../gstreamer/gstreamer-lite
  38 
  39         CFLAGS += -fPIC \
  40                   -Wformat \
  41                   -Wextra \
  42                   -Wformat-security \
  43                   -fstack-protector \
  44                   -Werror=implicit-function-declaration \
  45                   -msse2 \
  46                   -DGSTREAMER_LITE
  47 
  48         PACKAGES_INCLUDES := $(shell pkg-config --cflags glib-2.0)
  49         PACKAGES_LIBS := $(shell pkg-config --libs glib-2.0 gobject-2.0 gmodule-2.0 gthread-2.0)
  50 
  51         INCLUDES = $(BASE_INCLUDES) \
  52                    -I$(JAVA_HOME)/include \
  53                    -I$(JAVA_HOME)/include/linux \
  54                    -I$(GSTREAMER_LITE_DIR)/gstreamer \
  55                    -I$(GSTREAMER_LITE_DIR)/gst-plugins-base/gst-libs \
  56                    -I$(GSTREAMER_LITE_DIR)/gstreamer/libs \
  57                   $(PACKAGES_INCLUDES)
  58 
  59         LDFLAGS = -Wl,-rpath,\$$ORIGIN -L$(BUILD_DIR) -lgstreamer-lite $(PACKAGES_LIBS) \
  60             -z relro \
  61             -static-libgcc -static-libstdc++ -Wl,--gc-sections
  62 else
  63         CFLAGS += $(EXTRA_CFLAGS)
  64         INCLUDES = $(BASE_INCLUDES)
  65         LDFLAGS = -Wl,-rpath,\$$ORIGIN -L$(BUILD_DIR) $(EXTRA_LDFLAGS)
  66 endif
  67 
  68 ifeq ($(BUILD_TYPE), Release)
  69         CFLAGS += -Os
  70 else
  71         CFLAGS += -g -Wall -D_DEBUG
  72 endif
  73 
  74 ifeq ($(ARCH), x32)
  75     CFLAGS += -m32
  76     LDFLAGS += -m32
  77 endif
  78 
  79 CPP_SOURCES = \
  80         jni/com_sun_media_jfxmedia_logging_Logger.cpp           \
  81         jni/JavaBandsHolder.cpp                                 \
  82         jni/JavaMediaWarningListener.cpp                        \
  83         jni/JavaPlayerEventDispatcher.cpp                       \
  84         jni/JniUtils.cpp                                        \
  85         jni/Logger.cpp                                          \
  86         jni/NativeVideoBuffer.cpp                               \
  87         jni/NativeAudioEqualizer.cpp \
  88         jni/NativeAudioSpectrum.cpp \
  89         jni/NativeEqualizerBand.cpp \
  90         jni/JavaInputStreamCallbacks.cpp                        \
  91         PipelineManagement/AudioTrack.cpp                       \
  92         PipelineManagement/Pipeline.cpp                         \
  93         PipelineManagement/PipelineFactory.cpp                  \
  94         PipelineManagement/Track.cpp                            \
  95         PipelineManagement/VideoFrame.cpp                       \
  96         PipelineManagement/VideoTrack.cpp                       \
  97         PipelineManagement/SubtitleTrack.cpp                    \
  98         MediaManagement/Media.cpp                               \
  99         MediaManagement/MediaManager.cpp                        \
 100         Locator/Locator.cpp                                     \
 101         Locator/LocatorStream.cpp                               \
 102         Utils/MediaWarningDispatcher.cpp                        \
 103         Utils/posix/posix_critical_section.cpp          \
 104         platform/gstreamer/GstMedia.cpp                 \
 105         platform/gstreamer/GstMediaPlayer.cpp           \
 106         platform/gstreamer/GstPlatform.cpp              \
 107         platform/gstreamer/GstAudioEqualizer.cpp        \
 108         platform/gstreamer/GstAudioPlaybackPipeline.cpp \
 109         platform/gstreamer/GstAudioSpectrum.cpp         \
 110         platform/gstreamer/GstAVPlaybackPipeline.cpp    \
 111         platform/gstreamer/GstElementContainer.cpp      \
 112         platform/gstreamer/GstJniUtils.cpp              \
 113         platform/gstreamer/GstMediaManager.cpp          \
 114         platform/gstreamer/GstPipelineFactory.cpp       \
 115         platform/gstreamer/GstVideoFrame.cpp
 116 
 117 C_SOURCES = Utils/ColorConverter.c
 118 
 119 
 120 OBJECTS  = $(patsubst %.cpp,$(OBJBASE_DIR)/%.o,$(CPP_SOURCES)) $(patsubst %.c,$(OBJBASE_DIR)/%.o,$(C_SOURCES)) 
 121 DEPFILES = $(patsubst %.cpp,$(OBJBASE_DIR)/%.d,$(CPP_SOURCES))
 122 
 123 OBJ_DIRS = $(addprefix $(OBJBASE_DIR)/,$(DIRLIST))
 124 
 125 DEP_DIRS = $(BUILD_DIR) $(OBJ_DIRS)
 126 
 127 .PHONY: default list
 128 
 129 default: $(TARGET)
 130 
 131 $(DEPFILES): | $(DEP_DIRS)
 132 
 133 $(DEP_DIRS):
 134         mkdir -p $(DEP_DIRS)
 135 
 136 $(TARGET): $(DEPFILES) $(OBJECTS)
 137         $(LINKER) -shared $(OBJECTS) $(LDFLAGS) -o $@
 138 
 139 $(OBJBASE_DIR)/%.o: $(SRCBASE_DIR)/%.cpp
 140         $(CC) $(CFLAGS) $(CPPFLAGS) $(INCLUDES) -x c++ -c $< -o $@
 141 
 142 $(OBJBASE_DIR)/%.o: $(SRCBASE_DIR)/%.c
 143         $(CC) $(CFLAGS) $(INCLUDES) -x c -c $< -o $@
 144 
 145 # Build dependency graph
 146 $(OBJBASE_DIR)/%.d: $(SRCBASE_DIR)/%.cpp
 147         @set -e; rm -f $@; \
 148         $(CC) $(CFLAGS) $(CPPFLAGS) $(INCLUDES) -M $< > $@.$$$$; \
 149         sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@; \
 150         rm -f $@.$$$$
 151 
 152 -include $(DEPFILES)