1 #
   2 # MacOs jfxmedia makefile
   3 #
   4 
   5 BUILD_DIR = $(OUTPUT_DIR)/$(BUILD_TYPE)
   6 TARGET_DIRS = $(BUILD_DIR)
   7 
   8 SRCBASE_DIR = ../..
   9 OBJBASE_DIR = $(BUILD_DIR)/obj/jfxmedia
  10 
  11 BASE_DIR = ../../..
  12 GSTREAMER_LITE_DIR = $(BASE_DIR)/gstreamer/gstreamer-lite
  13 GLIB_LITE_DIR = $(BASE_DIR)/gstreamer/3rd_party/glib/glib-2.28.8
  14 
  15 DIRLIST = MediaManagement    \
  16           Locator            \
  17           PipelineManagement \
  18           jni                \
  19           Utils              \
  20           Utils/posix        \
  21           platform/gstreamer \
  22           platform/osx       \
  23           Projects/utils
  24 
  25 TARGET_NAME = lib$(BASE_NAME).dylib
  26 TARGET = $(BUILD_DIR)/$(TARGET_NAME)
  27 
  28 CFLAGS = -arch x86_64 \
  29          -fPIC                     \
  30          -Werror=implicit-function-declaration \
  31          -DTARGET_OS_MAC=1         \
  32          -D_GNU_SOURCE             \
  33          -DGST_REMOVE_DEPRECATED   \
  34          -DGST_DISABLE_GST_DEBUG   \
  35          -DGST_DISABLE_LOADSAVE    \
  36          -DGST_DISABLE_XML         \
  37          -DHAVE_CONFIG_H           \
  38          -DJFXMEDIA_JNI_EXPORTS    \
  39          -DGSTREAMER_LITE          \
  40          -msse2                    \
  41          -mmacosx-version-min=10.7
  42 
  43 ifeq ($(BUILD_TYPE), release)
  44     CFLAGS += -Os
  45 else
  46     CFLAGS += -O0 -g -Wall
  47 endif
  48 
  49 BASE_INCLUDES = -I$(JAVA_HOME)/include \
  50                 -I$(JAVA_HOME)/include/darwin \
  51                 -I$(SRCBASE_DIR) \
  52                 -I$(SRCBASE_DIR)/jni \
  53                 -I$(GENERATED_HEADERS_DIR)
  54 
  55 INCLUDES = $(BASE_INCLUDES) \
  56            -I$(GLIB_LITE_DIR)/ \
  57            -I$(GLIB_LITE_DIR)/glib \
  58            -I$(GLIB_LITE_DIR)/gmodule \
  59            -I$(GLIB_LITE_DIR)/build/osx \
  60            -I$(GSTREAMER_LITE_DIR)/gstreamer \
  61            -I$(GSTREAMER_LITE_DIR)/gst-plugins-base/gst-libs \
  62            -I$(GSTREAMER_LITE_DIR)/gstreamer/libs
  63 
  64 LDFLAGS = -mmacosx-version-min=10.7 -arch x86_64 \
  65           -L$(BUILD_DIR) -Wl,-install_name,@rpath/$(TARGET_NAME) \
  66           -lgstreamer-lite -lglib-lite -lobjc \
  67           -framework CoreVideo -framework CoreAudio -framework QTKit \
  68           -framework Cocoa -framework Carbon -framework CoreServices -framework JavaVM
  69 
  70 CPP_SOURCES =                                                  \
  71               MediaManagement/Media.cpp                        \
  72               MediaManagement/MediaManager.cpp                 \
  73               Locator/Locator.cpp                              \
  74               Locator/LocatorStream.cpp                        \
  75               PipelineManagement/Pipeline.cpp                  \
  76               PipelineManagement/PipelineFactory.cpp           \
  77               PipelineManagement/VideoFrame.cpp                \
  78               PipelineManagement/Track.cpp                     \
  79               PipelineManagement/AudioTrack.cpp                \
  80               PipelineManagement/VideoTrack.cpp                \
  81               PipelineManagement/SubtitleTrack.cpp             \
  82               jni/JavaPlayerEventDispatcher.cpp                \
  83               jni/JniUtils.cpp                                 \
  84               jni/com_sun_media_jfxmedia_logging_Logger.cpp    \
  85               jni/Logger.cpp                                   \
  86               jni/JavaMediaWarningListener.cpp                 \
  87               jni/JavaInputStreamCallbacks.cpp                 \
  88               jni/JavaBandsHolder.cpp                          \
  89               jni/NativeVideoBuffer.cpp                        \
  90               Utils/MediaWarningDispatcher.cpp                 \
  91               Utils/LowLevelPerf.cpp                           \
  92               Utils/posix/posix_critical_section.cpp           \
  93               platform/gstreamer/GstAudioEqualizer.cpp         \
  94               platform/gstreamer/GstAudioPlaybackPipeline.cpp  \
  95               platform/gstreamer/GstAudioSpectrum.cpp          \
  96               platform/gstreamer/GstAVPlaybackPipeline.cpp     \
  97               platform/gstreamer/GstElementContainer.cpp       \
  98               platform/gstreamer/GstJniUtils.cpp               \
  99               platform/gstreamer/GstMediaManager.cpp           \
 100               platform/gstreamer/GstPipelineFactory.cpp        \
 101               platform/gstreamer/GstVideoFrame.cpp             \
 102               platform/gstreamer/GstPlatform.cpp               \
 103               platform/gstreamer/GstEqualizerBand.cpp          \
 104               platform/gstreamer/GstMedia.cpp                  \
 105               platform/gstreamer/GstMediaPlayer.cpp            \
 106 
 107 C_SOURCES =   Utils/ColorConverter.c
 108 
 109 OBJCMM_SOURCES =                                               \
 110               platform/osx/OSXPlatform.mm                      \
 111               platform/osx/OSXMediaPlayer.mm                   \
 112               platform/osx/QTKMediaPlayer.mm                   \
 113               platform/osx/CVVideoFrame.mm
 114 
 115 OBJCM_SOURCES =                                                \
 116               Utils/JObjectPeers.m                             \
 117               Utils/JavaUtils.m                                \
 118               Utils/MTObjectProxy.m
 119 
 120 OBJ_DIRS = $(addprefix $(OBJBASE_DIR)/,$(DIRLIST))
 121 OBJECTS  = $(patsubst %.cpp,$(OBJBASE_DIR)/%.o,$(CPP_SOURCES)) \
 122            $(patsubst %.c,$(OBJBASE_DIR)/%.o,$(C_SOURCES)) \
 123            $(patsubst %.mm,$(OBJBASE_DIR)/%.o,$(OBJCMM_SOURCES)) \
 124            $(patsubst %.m,$(OBJBASE_DIR)/%.o,$(OBJCM_SOURCES))
 125 
 126 .PHONY: default
 127 
 128 default: $(TARGET)
 129 
 130 $(OBJBASE_DIR)/%.o: $(SRCBASE_DIR)/%.cpp
 131         $(CC) $(CFLAGS) $(INCLUDES) -x c++ -c $< -o $@
 132 
 133 $(OBJBASE_DIR)/%.o: $(SRCBASE_DIR)/%.c
 134         $(CC) $(CFLAGS) $(INCLUDES) -x c -c $< -o $@
 135 
 136 $(OBJBASE_DIR)/%.o: $(SRCBASE_DIR)/%.mm
 137         $(CC) $(CFLAGS) $(INCLUDES) -x objective-c++ -c $< -o $@
 138 
 139 $(OBJBASE_DIR)/%.o: $(SRCBASE_DIR)/%.m
 140         $(CC) $(CFLAGS) $(INCLUDES) -x objective-c -c $< -o $@
 141 
 142 $(OBJECTS): | $(OBJ_DIRS) $(TARGET_DIRS)
 143 
 144 $(OBJ_DIRS):
 145         mkdir -p $(OBJ_DIRS)
 146 
 147 $(TARGET_DIRS):
 148         mkdir -p $(TARGET_DIRS)
 149 
 150 $(TARGET): $(OBJECTS)
 151         $(LINK) -dynamiclib $(OBJECTS) $(LDFLAGS) -o $@
 152