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                   -Werror=implicit-function-declaration \
  44                   -msse2 \
  45                   -DGSTREAMER_LITE
  46 
  47         PACKAGES_INCLUDES := $(shell pkg-config --cflags glib-2.0)
  48         PACKAGES_LIBS := $(shell pkg-config --libs glib-2.0 gobject-2.0 gmodule-2.0 gthread-2.0)
  49 
  50         INCLUDES = $(BASE_INCLUDES) \
  51                    -I$(JAVA_HOME)/include \
  52                    -I$(JAVA_HOME)/include/linux \
  53                    -I$(GSTREAMER_LITE_DIR)/gstreamer \
  54                    -I$(GSTREAMER_LITE_DIR)/gst-plugins-base/gst-libs \
  55                    -I$(GSTREAMER_LITE_DIR)/gstreamer/libs \
  56                   $(PACKAGES_INCLUDES)
  57 
  58         LDFLAGS = -Wl,-rpath,\$$ORIGIN -L$(BUILD_DIR) -lgstreamer-lite $(PACKAGES_LIBS) \
  59             -static-libgcc -static-libstdc++ -Wl,--gc-sections
  60 else
  61         CFLAGS += $(EXTRA_CFLAGS)
  62         INCLUDES = $(BASE_INCLUDES)
  63         LDFLAGS = -Wl,-rpath,\$$ORIGIN -L$(BUILD_DIR) $(EXTRA_LDFLAGS)
  64 endif
  65 
  66 ifeq ($(BUILD_TYPE), Release)
  67         CFLAGS += -Os
  68 else
  69         CFLAGS += -g -Wall -D_DEBUG
  70 endif
  71 
  72 ifeq ($(ARCH), x32)
  73     CFLAGS += -m32
  74     LDFLAGS += -m32
  75 endif
  76 
  77 CPP_SOURCES = \
  78         jni/com_sun_media_jfxmedia_logging_Logger.cpp           \
  79         jni/JavaBandsHolder.cpp                                 \
  80         jni/JavaMediaWarningListener.cpp                        \
  81         jni/JavaPlayerEventDispatcher.cpp                       \
  82         jni/JniUtils.cpp                                        \
  83         jni/Logger.cpp                                          \
  84         jni/NativeVideoBuffer.cpp                               \
  85         jni/NativeAudioEqualizer.cpp \
  86         jni/NativeAudioSpectrum.cpp \
  87         jni/NativeEqualizerBand.cpp \
  88         jni/JavaInputStreamCallbacks.cpp                        \
  89         PipelineManagement/AudioTrack.cpp                       \
  90         PipelineManagement/Pipeline.cpp                         \
  91         PipelineManagement/PipelineFactory.cpp                  \
  92         PipelineManagement/Track.cpp                            \
  93         PipelineManagement/VideoFrame.cpp                       \
  94         PipelineManagement/VideoTrack.cpp                       \
  95         PipelineManagement/SubtitleTrack.cpp                    \
  96         MediaManagement/Media.cpp                               \
  97         MediaManagement/MediaManager.cpp                        \
  98         Locator/Locator.cpp                                     \
  99         Locator/LocatorStream.cpp                               \
 100         Utils/MediaWarningDispatcher.cpp                        \
 101         Utils/posix/posix_critical_section.cpp          \
 102         platform/gstreamer/GstMedia.cpp                 \
 103         platform/gstreamer/GstMediaPlayer.cpp           \
 104         platform/gstreamer/GstPlatform.cpp              \
 105         platform/gstreamer/GstAudioEqualizer.cpp        \
 106         platform/gstreamer/GstAudioPlaybackPipeline.cpp \
 107         platform/gstreamer/GstAudioSpectrum.cpp         \
 108         platform/gstreamer/GstAVPlaybackPipeline.cpp    \
 109         platform/gstreamer/GstElementContainer.cpp      \
 110         platform/gstreamer/GstJniUtils.cpp              \
 111         platform/gstreamer/GstMediaManager.cpp          \
 112         platform/gstreamer/GstPipelineFactory.cpp       \
 113         platform/gstreamer/GstVideoFrame.cpp
 114 
 115 C_SOURCES = Utils/ColorConverter.c
 116 
 117 
 118 OBJECTS  = $(patsubst %.cpp,$(OBJBASE_DIR)/%.o,$(CPP_SOURCES)) $(patsubst %.c,$(OBJBASE_DIR)/%.o,$(C_SOURCES)) 
 119 DEPFILES = $(patsubst %.cpp,$(OBJBASE_DIR)/%.d,$(CPP_SOURCES))
 120 
 121 OBJ_DIRS = $(addprefix $(OBJBASE_DIR)/,$(DIRLIST))
 122 
 123 DEP_DIRS = $(BUILD_DIR) $(OBJ_DIRS)
 124 
 125 .PHONY: default list
 126 
 127 default: $(TARGET)
 128 
 129 $(DEPFILES): | $(DEP_DIRS)
 130 
 131 $(DEP_DIRS):
 132         mkdir -p $(DEP_DIRS)
 133 
 134 $(TARGET): $(DEPFILES) $(OBJECTS)
 135         $(LINKER) -shared $(OBJECTS) $(LDFLAGS) -o $@
 136 
 137 $(OBJBASE_DIR)/%.o: $(SRCBASE_DIR)/%.cpp
 138         $(CC) $(CFLAGS) $(CPPFLAGS) $(INCLUDES) -x c++ -c $< -o $@
 139 
 140 $(OBJBASE_DIR)/%.o: $(SRCBASE_DIR)/%.c
 141         $(CC) $(CFLAGS) $(INCLUDES) -x c -c $< -o $@
 142 
 143 # Build dependency graph
 144 $(OBJBASE_DIR)/%.d: $(SRCBASE_DIR)/%.cpp
 145         @set -e; rm -f $@; \
 146         $(CC) $(CFLAGS) $(CPPFLAGS) $(INCLUDES) -M $< > $@.$$$$; \
 147         sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@; \
 148         rm -f $@.$$$$
 149 
 150 -include $(DEPFILES)