2014-02-19 02:54:27 +01:00
|
|
|
OS=$(shell uname | tr A-Z a-z | tr -d \\-[:digit:].)
|
2014-01-28 08:05:36 +01:00
|
|
|
ARCH=$(shell uname -m)
|
2013-12-10 09:19:42 +01:00
|
|
|
LIBPREFIX=lib
|
|
|
|
LIBSUFFIX=a
|
2014-02-26 13:31:52 +01:00
|
|
|
CCAS=$(CC)
|
2013-12-17 12:57:27 +01:00
|
|
|
CXX_O=-o $@
|
|
|
|
CXX_LINK_O=-o $@
|
|
|
|
AR_OPTS=cr $@
|
2014-01-10 13:19:05 +01:00
|
|
|
LINK_LIB=-l$(1)
|
2013-12-27 23:00:32 +01:00
|
|
|
CFLAGS_OPT=-O3
|
|
|
|
CFLAGS_DEBUG=-g
|
2014-01-23 14:03:15 +01:00
|
|
|
BUILDTYPE=Release
|
2014-01-30 10:32:51 +01:00
|
|
|
V=Yes
|
2014-01-27 13:54:47 +01:00
|
|
|
PREFIX=/usr/local
|
2014-02-19 10:50:45 +01:00
|
|
|
SHARED=-shared
|
2014-03-18 10:21:46 +01:00
|
|
|
OBJ=o
|
2013-12-12 05:24:55 +01:00
|
|
|
|
2013-12-12 06:12:20 +01:00
|
|
|
ifeq (,$(wildcard ./gtest))
|
2013-12-12 05:24:55 +01:00
|
|
|
HAVE_GTEST=No
|
|
|
|
else
|
2013-12-12 03:56:52 +01:00
|
|
|
HAVE_GTEST=Yes
|
2013-12-12 05:24:55 +01:00
|
|
|
endif
|
2013-12-10 09:19:42 +01:00
|
|
|
|
2013-12-10 11:57:32 +01:00
|
|
|
# Configurations
|
|
|
|
ifeq ($(BUILDTYPE), Release)
|
2013-12-27 23:00:32 +01:00
|
|
|
CFLAGS += $(CFLAGS_OPT)
|
2013-12-10 11:57:32 +01:00
|
|
|
USE_ASM = Yes
|
|
|
|
else
|
2013-12-27 23:00:32 +01:00
|
|
|
CFLAGS = $(CFLAGS_DEBUG)
|
2013-12-10 11:57:32 +01:00
|
|
|
USE_ASM = No
|
|
|
|
endif
|
2014-01-03 07:49:45 +01:00
|
|
|
|
2014-01-09 19:25:15 +01:00
|
|
|
ifeq ($(USE_ASAN), Yes)
|
|
|
|
CFLAGS += -fsanitize=address
|
|
|
|
LDFLAGS += -fsanitize=address
|
|
|
|
endif
|
|
|
|
|
2014-02-19 02:54:27 +01:00
|
|
|
include build/platform-$(OS).mk
|
2013-12-13 12:50:04 +01:00
|
|
|
|
2013-12-10 11:57:32 +01:00
|
|
|
|
2014-01-10 11:26:44 +01:00
|
|
|
CFLAGS += -DNO_DYNAMIC_VP
|
2013-12-10 11:57:32 +01:00
|
|
|
LDFLAGS +=
|
|
|
|
|
2014-03-13 09:38:33 +01:00
|
|
|
ifeq (Yes, $(GCOV))
|
|
|
|
CFLAGS += -fprofile-arcs -ftest-coverage
|
|
|
|
LDFLAGS += -lgcov
|
|
|
|
endif
|
2013-12-10 11:57:32 +01:00
|
|
|
|
|
|
|
#### No user-serviceable parts below this line
|
2014-01-30 10:32:51 +01:00
|
|
|
ifneq ($(V),Yes)
|
|
|
|
QUIET_CXX = @printf "CXX\t$@\n";
|
2014-02-12 07:52:35 +01:00
|
|
|
QUIET_CC = @printf "CC\t$@\n";
|
2014-02-26 13:31:52 +01:00
|
|
|
QUIET_CCAS = @printf "CCAS\t$@\n";
|
2014-01-30 10:32:51 +01:00
|
|
|
QUIET_ASM = @printf "ASM\t$@\n";
|
|
|
|
QUIET_AR = @printf "AR\t$@\n";
|
|
|
|
QUIET = @
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
2014-03-19 03:47:26 +01:00
|
|
|
INCLUDES = -Icodec/api/svc -Icodec/common/inc
|
2013-12-10 11:57:32 +01:00
|
|
|
|
2013-12-10 09:19:42 +01:00
|
|
|
DECODER_INCLUDES = \
|
|
|
|
-Icodec/decoder/core/inc \
|
|
|
|
-Icodec/decoder/plus/inc
|
|
|
|
|
|
|
|
ENCODER_INCLUDES = \
|
|
|
|
-Icodec/encoder/core/inc \
|
2014-02-19 13:27:54 +01:00
|
|
|
-Icodec/encoder/plus/inc \
|
|
|
|
-Icodec/processing/interface
|
2013-12-10 09:19:42 +01:00
|
|
|
|
2014-02-19 13:39:43 +01:00
|
|
|
PROCESSING_INCLUDES = \
|
|
|
|
-Icodec/processing/interface \
|
|
|
|
-Icodec/processing/src/common
|
|
|
|
|
2014-02-20 11:07:57 +01:00
|
|
|
GTEST_INCLUDES += \
|
2014-01-19 15:54:10 +01:00
|
|
|
-Igtest \
|
|
|
|
-Igtest/include
|
|
|
|
|
2014-02-20 11:07:57 +01:00
|
|
|
CODEC_UNITTEST_INCLUDES += \
|
2014-03-14 09:40:02 +01:00
|
|
|
-Igtest/include \
|
2014-03-19 03:47:26 +01:00
|
|
|
-Icodec/common/inc \
|
2014-01-17 08:55:21 +01:00
|
|
|
|
2013-12-10 09:19:42 +01:00
|
|
|
H264DEC_INCLUDES = $(DECODER_INCLUDES) -Icodec/console/dec/inc
|
2014-01-26 15:13:03 +01:00
|
|
|
H264DEC_LDFLAGS = -L. $(call LINK_LIB,decoder) $(call LINK_LIB,common)
|
2014-01-08 15:18:01 +01:00
|
|
|
H264DEC_DEPS = $(LIBPREFIX)decoder.$(LIBSUFFIX) $(LIBPREFIX)common.$(LIBSUFFIX)
|
2013-12-10 09:19:42 +01:00
|
|
|
|
|
|
|
H264ENC_INCLUDES = $(ENCODER_INCLUDES) -Icodec/console/enc/inc
|
2014-01-26 15:13:03 +01:00
|
|
|
H264ENC_LDFLAGS = -L. $(call LINK_LIB,encoder) $(call LINK_LIB,processing) $(call LINK_LIB,common)
|
2014-01-08 15:18:01 +01:00
|
|
|
H264ENC_DEPS = $(LIBPREFIX)encoder.$(LIBSUFFIX) $(LIBPREFIX)processing.$(LIBSUFFIX) $(LIBPREFIX)common.$(LIBSUFFIX)
|
2013-12-10 09:19:42 +01:00
|
|
|
|
2014-02-20 11:21:14 +01:00
|
|
|
CODEC_UNITTEST_LDFLAGS = -L. $(call LINK_LIB,gtest) $(call LINK_LIB,decoder) $(call LINK_LIB,encoder) $(call LINK_LIB,processing) $(call LINK_LIB,common) $(CODEC_UNITTEST_LDFLAGS_SUFFIX)
|
2014-01-09 11:42:42 +01:00
|
|
|
CODEC_UNITTEST_DEPS = $(LIBPREFIX)gtest.$(LIBSUFFIX) $(LIBPREFIX)decoder.$(LIBSUFFIX) $(LIBPREFIX)encoder.$(LIBSUFFIX) $(LIBPREFIX)processing.$(LIBSUFFIX) $(LIBPREFIX)common.$(LIBSUFFIX)
|
2014-03-25 02:21:45 +01:00
|
|
|
DECODER_UNITTEST_INCLUDES = $(CODEC_UNITTEST_INCLUDES) $(DECODER_INCLUDES) -Itest -Itest/decoder
|
|
|
|
ENCODER_UNITTEST_INCLUDES = $(CODEC_UNITTEST_INCLUDES) $(ENCODER_INCLUDES) -Itest -Itest/encoder
|
|
|
|
API_TEST_INCLUDES = $(CODEC_UNITTEST_INCLUDES) -Itest -Itest/api
|
2014-01-12 13:08:56 +01:00
|
|
|
.PHONY: test gtest-bootstrap clean
|
2013-12-13 22:09:59 +01:00
|
|
|
|
2013-12-12 06:12:20 +01:00
|
|
|
all: libraries binaries
|
2013-12-10 09:19:42 +01:00
|
|
|
|
|
|
|
clean:
|
2014-03-18 10:21:46 +01:00
|
|
|
$(QUIET)rm -f $(OBJS) $(OBJS:.$(OBJ)=.d) $(LIBRARIES) $(BINARIES)
|
2013-12-10 09:19:42 +01:00
|
|
|
|
2013-12-12 05:24:55 +01:00
|
|
|
gtest-bootstrap:
|
|
|
|
svn co https://googletest.googlecode.com/svn/trunk/ gtest
|
2013-12-10 11:57:32 +01:00
|
|
|
|
2014-01-12 13:08:56 +01:00
|
|
|
ifeq ($(HAVE_GTEST),Yes)
|
2014-01-24 09:26:36 +01:00
|
|
|
test: codec_unittest$(EXEEXT)
|
2013-12-13 22:09:59 +01:00
|
|
|
./codec_unittest
|
2014-01-12 13:08:56 +01:00
|
|
|
else
|
2014-01-17 10:05:33 +01:00
|
|
|
test:
|
2014-01-12 13:08:56 +01:00
|
|
|
@echo "./gtest : No such file or directory."
|
|
|
|
@echo "You do not have gtest. Run make gtest-bootstrap to get gtest"
|
|
|
|
endif
|
2013-12-13 22:09:59 +01:00
|
|
|
|
2013-12-11 15:51:26 +01:00
|
|
|
include codec/common/targets.mk
|
2013-12-10 09:19:42 +01:00
|
|
|
include codec/decoder/targets.mk
|
|
|
|
include codec/encoder/targets.mk
|
2014-01-03 07:49:45 +01:00
|
|
|
include codec/processing/targets.mk
|
2014-02-19 02:54:27 +01:00
|
|
|
|
|
|
|
ifneq (android, $(OS))
|
2014-03-01 16:24:15 +01:00
|
|
|
ifneq (ios, $(OS))
|
2013-12-10 09:19:42 +01:00
|
|
|
include codec/console/dec/targets.mk
|
|
|
|
include codec/console/enc/targets.mk
|
2014-02-19 02:54:27 +01:00
|
|
|
endif
|
2014-03-01 16:24:15 +01:00
|
|
|
endif
|
2013-12-10 09:19:42 +01:00
|
|
|
|
2014-02-19 02:54:27 +01:00
|
|
|
libraries: $(LIBPREFIX)wels.$(LIBSUFFIX) $(LIBPREFIX)wels.$(SHAREDLIBSUFFIX)
|
|
|
|
LIBRARIES += $(LIBPREFIX)wels.$(LIBSUFFIX) $(LIBPREFIX)wels.$(SHAREDLIBSUFFIX)
|
2014-01-27 13:42:36 +01:00
|
|
|
|
|
|
|
$(LIBPREFIX)wels.$(LIBSUFFIX): $(ENCODER_OBJS) $(DECODER_OBJS) $(PROCESSING_OBJS) $(COMMON_OBJS)
|
2014-02-18 09:33:09 +01:00
|
|
|
$(QUIET)rm -f $@
|
|
|
|
$(QUIET_AR)$(AR) $(AR_OPTS) $+
|
2014-01-27 13:42:36 +01:00
|
|
|
|
2014-02-19 02:54:27 +01:00
|
|
|
$(LIBPREFIX)wels.$(SHAREDLIBSUFFIX): $(ENCODER_OBJS) $(DECODER_OBJS) $(PROCESSING_OBJS) $(COMMON_OBJS)
|
2014-02-19 10:47:09 +01:00
|
|
|
$(QUIET)rm -f $@
|
2014-02-19 10:51:50 +01:00
|
|
|
$(QUIET_CXX)$(CXX) $(SHARED) $(LDFLAGS) $(CXX_LINK_O) $+ $(SHLDFLAGS)
|
2014-02-19 02:54:27 +01:00
|
|
|
|
2014-03-07 14:10:46 +01:00
|
|
|
install-headers:
|
2014-01-27 13:54:47 +01:00
|
|
|
mkdir -p $(PREFIX)/include/wels
|
2014-03-07 14:10:46 +01:00
|
|
|
install -m 644 codec/api/svc/codec*.h $(PREFIX)/include/wels
|
|
|
|
|
|
|
|
install-static: $(LIBPREFIX)wels.$(LIBSUFFIX) install-headers
|
|
|
|
mkdir -p $(PREFIX)/lib
|
2014-01-27 13:54:47 +01:00
|
|
|
install -m 644 $(LIBPREFIX)wels.$(LIBSUFFIX) $(PREFIX)/lib
|
2014-03-07 14:10:46 +01:00
|
|
|
|
|
|
|
install-shared: $(LIBPREFIX)wels.$(SHAREDLIBSUFFIX) install-headers
|
|
|
|
mkdir -p $(PREFIX)/lib
|
2014-02-19 12:10:57 +01:00
|
|
|
install -m 755 $(LIBPREFIX)wels.$(SHAREDLIBSUFFIX) $(PREFIX)/lib
|
2014-02-19 12:12:52 +01:00
|
|
|
ifneq ($(EXTRA_LIBRARY),)
|
|
|
|
install -m 644 $(EXTRA_LIBRARY) $(PREFIX)/lib
|
|
|
|
endif
|
2014-03-07 14:10:46 +01:00
|
|
|
|
|
|
|
install: install-static install-shared
|
|
|
|
@:
|
2014-01-27 13:42:36 +01:00
|
|
|
|
2013-12-12 05:24:55 +01:00
|
|
|
ifeq ($(HAVE_GTEST),Yes)
|
|
|
|
include build/gtest-targets.mk
|
2014-03-25 02:21:45 +01:00
|
|
|
include test/api/targets.mk
|
|
|
|
include test/decoder/targets.mk
|
|
|
|
include test/encoder/targets.mk
|
2013-12-12 03:56:52 +01:00
|
|
|
endif
|
2014-01-23 14:16:29 +01:00
|
|
|
|
2014-03-25 04:11:53 +01:00
|
|
|
binaries: codec_unittest$(EXEEXT)
|
|
|
|
BINARIES += codec_unittest$(EXEEXT)
|
|
|
|
codec_unittest$(EXEEXT): $(DECODER_UNITTEST_OBJS) $(ENCODER_UNITTEST_OBJS) $(API_TEST_OBJS) $(CODEC_UNITTEST_DEPS)
|
2014-03-25 03:58:52 +01:00
|
|
|
$(QUIET)rm -f $@
|
2014-03-25 02:21:45 +01:00
|
|
|
$(QUIET_CXX)$(CXX) -o $@ $+ $(CODEC_UNITTEST_LDFLAGS) $(LDFLAGS)
|
2014-03-18 10:21:46 +01:00
|
|
|
-include $(OBJS:.$(OBJ)=.d)
|