ccextractor/linux/Makefile

121 lines
3.4 KiB
Makefile
Raw Normal View History

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-10-06 19:29:17 +00:00
INCLUDE = -I../src/gpacmp4/ -I../src/libpng -I../src/zlib -I../src/lib_ccx -I../src/.
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-10-06 19:29:17 +00:00
VPATH = ../src:../src/gpacmp4:../src/libpng:../src/zlib:../src/lib_ccx
2014-04-12 10:41:27 +00:00
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
2014-10-06 19:29:17 +00:00
SRCS_CCX_DIR = $(SRCS_DIR)/lib_ccx
SRCS_CCX = $(wildcard $(SRCS_CCX_DIR)/*.c)
OBJS_CCX = $(SRCS_CCX:$(SRCS_CCX_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+=-DENABLE_OCR
2015-01-07 18:57:57 +00:00
TESS_LDFLAGS+= $(shell pkg-config --libs tesseract)
LEPT_LDFLAGS+= $(shell pkg-config --libs lept)
#error checking of library are there or not
ifeq ($(TESS_LDFLAGS),$(EMPTY))
$(error **ERROR** "tesseract not found")
else
#TODO print the version of library found
$(info "tesseract found")
endif
ifeq ($(LEPT_LDFLAGS),$(EMPTY))
$(error **ERROR** "leptonica not found")
else
#TODO print the version of library found
$(info "Leptonica found")
endif
CFLAGS += $(shell pkg-config --cflags tesseract)
CFLAGS += $(shell pkg-config --cflags lept)
LDFLAGS += $(TESS_LDFLAGS)
LDFLAGS += $(LEPT_LDFLAGS)
2014-06-07 19:45:32 +00:00
endif
2015-01-07 18:57:57 +00:00
2014-08-12 05:13:07 +00:00
ifeq ($(ENABLE_FFMPEG),yes)
CFLAGS+=-DENABLE_FFMPEG
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)
2014-10-06 19:29:17 +00:00
$(TARGET): $(OBJS) $(OBJS_PNG) $(OBJS_GPACMP4) $(OBJS_ZLIB) $(OBJS_CCX)
$(CC) $(ALL_FLAGS) $(CFLAGS) $(OBJS) $(OBJS_CCX) $(OBJS_PNG) $(OBJS_GPACMP4) $(OBJS_ZLIB) $(LDFLAGS) -o $@
2014-05-09 13:01:01 +00:00
$(OBJS_DIR)/%.o: %.c
$(CC) -c $(ALL_FLAGS) $(INCLUDE) $(CFLAGS) $< -o $@
2014-05-09 13:01:01 +00:00
$(OBJS_DIR)/%.o: %.cpp
$(CC) -c $(ALL_FLAGS) $(INCLUDE) $(CFLAGS) $< -o $@ -I../src/gpacmp4
2014-04-12 10:41:27 +00:00
$(OBJS_DIR)/ccextractor.o: ccextractor.c
$(CC) -c $(ALL_FLAGS) $(INCLUDE) $(CFLAGS) -O0 $< -o $@
2014-04-12 10:41:27 +00:00
.PHONY: clean
clean:
2015-05-19 14:26:33 +00:00
rm -rf $(TARGET) 2>/dev/null || true
rm -rf $(OBJS_CCX) $(OBJS_PNG) $(OBJS_ZLIB) $(OBJS_GPACMP4) $(OBJS) 2>/dev/null || true
rm -rdf $(OBJS_DIR) 2>/dev/null || true
rm -rf .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:
2015-06-10 18:50:01 +00:00
$(CC) $(CFLAGS) $(INCLUDE) -E -MM $(SRCS_C) $(SRCS_PNG) $(SRCS_ZLIB) $(SRCS_CCX) \
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