2014-05-09 13:01:01 +00:00
|
|
|
SHELL = /bin/sh
|
2014-04-12 10:41:27 +00:00
|
|
|
|
2014-05-09 13:01:01 +00:00
|
|
|
CC = gcc
|
2014-08-17 08:19:54 +00:00
|
|
|
SYS := $(shell gcc -dumpmachine)
|
2014-07-01 13:09:26 +00:00
|
|
|
CFLAGS = -O3 -std=gnu99
|
2014-05-09 13:41:28 +00:00
|
|
|
INCLUDE = -I../src/gpacmp4/ -I../src/libpng -I../src/zlib
|
2014-07-28 13:57:54 +00:00
|
|
|
ALL_FLAGS = -Wno-write-strings -D_FILE_OFFSET_BITS=64
|
|
|
|
LDFLAGS = -lm
|
2014-04-12 10:41:27 +00:00
|
|
|
|
2014-08-17 08:19:54 +00:00
|
|
|
ifneq (, $(findstring linux, $(SYS)))
|
|
|
|
CFLAGS +=-DGPAC_CONFIG_LINUX
|
|
|
|
endif
|
2014-05-09 13:01:01 +00:00
|
|
|
TARGET = ccextractor
|
2014-04-12 10:41:27 +00:00
|
|
|
|
2014-05-09 13:01:01 +00:00
|
|
|
OBJS_DIR = objs
|
2014-04-12 10:41:27 +00:00
|
|
|
VPATH = ../src:../src/gpacmp4:../src/libpng:../src/zlib
|
|
|
|
|
2014-05-09 13:01:01 +00:00
|
|
|
SRCS_DIR = ../src
|
|
|
|
SRCS_C = $(wildcard $(SRCS_DIR)/*.c)
|
2014-06-01 17:51:00 +00:00
|
|
|
OBJS = $(SRCS_C:$(SRCS_DIR)/%.c=$(OBJS_DIR)/%.o)
|
2014-05-09 13:01:01 +00:00
|
|
|
|
|
|
|
SRCS_PNG_DIR = $(SRCS_DIR)/libpng
|
|
|
|
SRCS_PNG = $(wildcard $(SRCS_PNG_DIR)/*.c)
|
|
|
|
OBJS_PNG = $(SRCS_PNG:$(SRCS_PNG_DIR)/%.c=$(OBJS_DIR)/%.o)
|
|
|
|
|
|
|
|
SRCS_GPACMP4_DIR = $(SRCS_DIR)/gpacmp4
|
|
|
|
SRCS_GPACMP4_C = $(wildcard $(SRCS_GPACMP4_DIR)/*.c)
|
|
|
|
SRCS_GPACMP4_CPP = $(wildcard $(SRCS_GPACMP4_DIR)/*.cpp)
|
|
|
|
OBJS_GPACMP4 = $(SRCS_GPACMP4_C:$(SRCS_GPACMP4_DIR)/%.c=$(OBJS_DIR)/%.o) \
|
|
|
|
$(SRCS_GPACMP4_CPP:$(SRCS_GPACMP4_DIR)/%.cpp=$(OBJS_DIR)/%.o)
|
|
|
|
|
|
|
|
SRCS_ZLIB_DIR = $(SRCS_DIR)/zlib
|
|
|
|
SRCS_ZLIB = $(wildcard $(SRCS_ZLIB_DIR)/*.c)
|
|
|
|
OBJS_ZLIB = $(SRCS_ZLIB:$(SRCS_ZLIB_DIR)/%.c=$(OBJS_DIR)/%.o)
|
|
|
|
|
|
|
|
INSTLALL = cp -f -p
|
|
|
|
INSTLALL_PROGRAM = $(INSTLALL)
|
|
|
|
DESTDIR = /usr/bin
|
2014-04-12 10:41:27 +00:00
|
|
|
|
2014-06-07 19:45:32 +00:00
|
|
|
ifeq ($(ENABLE_OCR),yes)
|
|
|
|
CFLAGS+=-I/usr/local/include/tesseract -I/usr/local/include/leptonica
|
|
|
|
CFLAGS+=-DENABLE_OCR
|
|
|
|
LDFLAGS+= $(shell pkg-config --libs tesseract)
|
|
|
|
endif
|
2014-08-12 05:13:07 +00:00
|
|
|
ifeq ($(ENABLE_FFMPEG),yes)
|
|
|
|
CFLAGS+=-DENABLE_FFMPEG
|
2014-08-16 07:48:29 +00:00
|
|
|
CFLAGS+= $(shell pkg-config --cflags libavcodec)
|
|
|
|
CFLAGS+= $(shell pkg-config --cflags libavformat)
|
|
|
|
CFLAGS+= $(shell pkg-config --cflags libavutil)
|
2014-08-12 05:13:07 +00:00
|
|
|
LDFLAGS+= $(shell pkg-config --libs libavcodec )
|
|
|
|
LDFLAGS+= $(shell pkg-config --libs libavformat )
|
|
|
|
LDFLAGS+= $(shell pkg-config --libs libavutil )
|
|
|
|
endif
|
2014-07-01 13:09:26 +00:00
|
|
|
|
2014-04-12 10:41:27 +00:00
|
|
|
.PHONY: all
|
2014-05-09 13:01:01 +00:00
|
|
|
all: objs_dir $(TARGET)
|
|
|
|
|
|
|
|
.PHONY: objs_dir
|
|
|
|
objs_dir:
|
|
|
|
mkdir -p $(OBJS_DIR)
|
|
|
|
|
|
|
|
$(TARGET): $(OBJS) $(OBJS_PNG) $(OBJS_GPACMP4) $(OBJS_ZLIB)
|
2014-07-16 10:35:55 +00:00
|
|
|
$(CC) $(ALL_FLAGS) $(CFLAGS) $(OBJS) $(OBJS_PNG) $(OBJS_GPACMP4) $(OBJS_ZLIB) $(LDFLAGS) -o $@
|
2014-05-09 13:01:01 +00:00
|
|
|
|
|
|
|
$(OBJS_DIR)/%.o: %.c
|
2014-05-09 13:41:28 +00:00
|
|
|
$(CC) -c $(ALL_FLAGS) $(INCLUDE) $(CFLAGS) $< -o $@
|
2014-05-09 13:01:01 +00:00
|
|
|
|
|
|
|
$(OBJS_DIR)/%.o: %.cpp
|
2014-05-09 13:41:28 +00:00
|
|
|
$(CC) -c $(ALL_FLAGS) $(INCLUDE) $(CFLAGS) $< -o $@ -I../src/gpacmp4
|
2014-04-12 10:41:27 +00:00
|
|
|
|
|
|
|
.PHONY: clean
|
|
|
|
clean:
|
2014-05-09 13:01:01 +00:00
|
|
|
rm $(TARGET) 2>/dev/null || true
|
|
|
|
rm $(OBJS_PNG) $(OBJS_ZLIB) $(OBJS_GPACMP4) $(OBJS) 2>/dev/null || true
|
|
|
|
rm -rd $(OBJS_DIR) 2>/dev/null || true
|
|
|
|
rm .depend 2>/dev/null || true
|
2014-04-12 10:41:27 +00:00
|
|
|
|
|
|
|
.PHONY: install
|
2014-05-09 13:01:01 +00:00
|
|
|
install: $(TARGET)
|
|
|
|
$(INSTLALL_PROGRAM) $(TARGET) $(DESTDIR)
|
|
|
|
|
|
|
|
.PHONY: uninstall
|
|
|
|
uninstall:
|
|
|
|
rm -iv $(DESTDIR)/$(TARGET)
|
2014-04-12 10:41:27 +00:00
|
|
|
|
2014-05-09 13:01:01 +00:00
|
|
|
.PHONY: depend dep
|
|
|
|
depend dep:
|
2014-07-16 10:35:55 +00:00
|
|
|
$(CC) $(CFLAGS) -E -MM $(SRCS_C) $(SRCS_PNG) $(SRCS_ZLIB) \
|
2014-06-01 17:51:00 +00:00
|
|
|
$(SRCS_GPACMP4_C) $(SRCS_GPACMP4_CPP) |\
|
|
|
|
sed 's/^[a-zA-Z_0-9]*.o/$(OBJS_DIR)\/&/' > .depend
|
2014-04-12 10:41:27 +00:00
|
|
|
|
2014-05-09 13:01:01 +00:00
|
|
|
-include .depend
|