1 #
   2 # Linux Makefile for fxplugins
   3 #
   4 
   5 BUILD_DIR = $(OUTPUT_DIR)/$(BUILD_TYPE)
   6 TARGET_DIRS = $(BUILD_DIR)
   7 
   8 SRCBASE_DIR = ../../../plugins
   9 OBJBASE_DIR = $(BUILD_DIR)/obj/fxplugins
  10 
  11 DIRLIST = progressbuffer       \
  12           progressbuffer/posix \
  13           javasource
  14 
  15 TARGET = $(BUILD_DIR)/lib$(BASE_NAME).so
  16 
  17 CFLAGS = -fPIC                   \
  18          -Wformat                \
  19          -Wextra                 \
  20          -Wformat-security       \
  21          -Werror=implicit-function-declaration \
  22          -msse2                  \
  23          -fbuiltin               \
  24          -DHAVE_STDINT_H         \
  25          -DLINUX                 \
  26          -DENABLE_PULL_MODE      \
  27          -DENABLE_SOURCE_SEEKING \
  28          -D__MEDIALIB_OLD_NAMES  \
  29          -DGST_DISABLE_LOADSAVE  \
  30          -DGST_DISABLE_GST_DEBUG \
  31          -DGSTREAMER_LITE \
  32          -ffunction-sections -fdata-sections
  33 
  34 ifeq ($(BUILD_TYPE), Release)
  35     CFLAGS += -Os
  36 else
  37     CFLAGS += -g -Wall
  38 endif
  39 
  40 
  41 INCLUDES = -I$(SRCBASE_DIR) \
  42            $(addprefix -I$(SRCBASE_DIR)/,$(DIRLIST)) \
  43            -I../../../gstreamer-lite/gstreamer       \
  44            -I../../../gstreamer-lite/gstreamer/libs
  45 
  46 PACKAGES_INCLUDES := $(shell pkg-config --cflags glib-2.0)
  47 PACKAGES_LIBS := $(shell pkg-config --libs glib-2.0 gobject-2.0)
  48 
  49 LDFLAGS = -L$(BUILD_DIR) -lgstreamer-lite $(PACKAGES_LIBS) \
  50           -static-libgcc -static-libstdc++ -Wl,--gc-sections
  51 
  52 ifeq ($(ARCH), x32)
  53     CFLAGS += -m32
  54     LDFLAGS += -m32
  55 endif
  56 
  57 SOURCES = fxplugins.c                        \
  58           progressbuffer/progressbuffer.c    \
  59           progressbuffer/hlsprogressbuffer.c \
  60           progressbuffer/posix/filecache.c   \
  61           javasource/javasource.c            \
  62           javasource/marshal.c
  63 
  64 OBJ_DIRS = $(addprefix $(OBJBASE_DIR)/,$(DIRLIST))
  65 OBJECTS = $(patsubst %.c,$(OBJBASE_DIR)/%.o,$(SOURCES))
  66 
  67 .PHONY: default list
  68 
  69 default: $(TARGET)
  70 
  71 $(OBJBASE_DIR)/%.o: $(SRCBASE_DIR)/%.c
  72         $(CC) $(CFLAGS) $(INCLUDES) $(PACKAGES_INCLUDES) -c $< -o $@
  73 
  74 $(OBJECTS): | $(OBJ_DIRS) $(TARGET_DIRS)
  75 
  76 $(OBJ_DIRS):
  77         mkdir -p $(OBJ_DIRS)
  78 
  79 $(TARGET_DIRS):
  80         mkdir -p $(TARGET_DIRS)
  81 
  82 $(TARGET): $(OBJECTS)
  83         $(LINKER) -shared $(OBJECTS) $(LDFLAGS) -o $@