2013-12-20 14:43:30 +01:00
|
|
|
UNAME=$(shell uname | tr A-Z a-z | tr -d \\-[:digit:].)
|
2014-01-28 12:35:36 +05:30
|
|
|
ARCH=$(shell uname -m)
|
2013-12-10 16:19:42 +08:00
|
|
|
LIBPREFIX=lib
|
|
|
|
LIBSUFFIX=a
|
2013-12-17 13:57:27 +02:00
|
|
|
CXX_O=-o $@
|
|
|
|
CXX_LINK_O=-o $@
|
|
|
|
AR_OPTS=cr $@
|
2014-01-10 14:19:05 +02:00
|
|
|
LINK_LIB=-l$(1)
|
2013-12-28 00:00:32 +02:00
|
|
|
CFLAGS_OPT=-O3
|
|
|
|
CFLAGS_DEBUG=-g
|
|
|
|
CFLAGS_M32=-m32
|
|
|
|
CFLAGS_M64=-m64
|
2014-01-23 15:03:15 +02:00
|
|
|
BUILDTYPE=Release
|
2014-01-30 11:32:51 +02:00
|
|
|
V=Yes
|
2014-01-27 14:54:47 +02:00
|
|
|
PREFIX=/usr/local
|
2013-12-12 12:24:55 +08:00
|
|
|
|
2014-01-28 12:35:36 +05:30
|
|
|
ifeq (, $(ENABLE64BIT))
|
|
|
|
ifeq ($(ARCH), x86_64)
|
|
|
|
ENABLE64BIT=Yes
|
|
|
|
endif
|
|
|
|
endif
|
2014-01-09 10:25:15 -08:00
|
|
|
|
2013-12-12 13:12:20 +08:00
|
|
|
ifeq (,$(wildcard ./gtest))
|
2013-12-12 12:24:55 +08:00
|
|
|
HAVE_GTEST=No
|
|
|
|
else
|
2013-12-12 10:56:52 +08:00
|
|
|
HAVE_GTEST=Yes
|
2013-12-12 12:24:55 +08:00
|
|
|
endif
|
2013-12-10 16:19:42 +08:00
|
|
|
|
2013-12-10 18:57:32 +08:00
|
|
|
# Configurations
|
|
|
|
ifeq ($(BUILDTYPE), Release)
|
2013-12-28 00:00:32 +02:00
|
|
|
CFLAGS += $(CFLAGS_OPT)
|
2013-12-10 18:57:32 +08:00
|
|
|
USE_ASM = Yes
|
|
|
|
else
|
2013-12-28 00:00:32 +02:00
|
|
|
CFLAGS = $(CFLAGS_DEBUG)
|
2013-12-10 18:57:32 +08:00
|
|
|
USE_ASM = No
|
|
|
|
endif
|
2014-01-03 14:49:45 +08:00
|
|
|
|
2014-01-09 10:25:15 -08:00
|
|
|
ifeq ($(USE_ASAN), Yes)
|
|
|
|
CFLAGS += -fsanitize=address
|
|
|
|
LDFLAGS += -fsanitize=address
|
|
|
|
endif
|
|
|
|
|
2013-12-14 20:37:33 -08:00
|
|
|
ifeq ($(ENABLE64BIT), Yes)
|
2013-12-28 00:00:32 +02:00
|
|
|
CFLAGS += $(CFLAGS_M64)
|
|
|
|
LDFLAGS += $(CFLAGS_M64)
|
2014-01-10 13:28:19 +02:00
|
|
|
ASMFLAGS_PLATFORM = -DUNIX64
|
2013-12-14 20:37:33 -08:00
|
|
|
else
|
2013-12-28 00:00:32 +02:00
|
|
|
CFLAGS += $(CFLAGS_M32)
|
|
|
|
LDFLAGS += $(CFLAGS_M32)
|
2014-01-10 13:28:19 +02:00
|
|
|
ASMFLAGS_PLATFORM = -DX86_32
|
2013-12-14 20:37:33 -08:00
|
|
|
endif
|
2014-01-03 14:49:45 +08:00
|
|
|
|
2013-12-13 13:50:04 +02:00
|
|
|
include build/platform-$(UNAME).mk
|
|
|
|
|
2013-12-10 18:57:32 +08:00
|
|
|
ifeq ($(USE_ASM),Yes)
|
2014-01-12 17:38:56 +05:30
|
|
|
CFLAGS += -DX86_ASM
|
2013-12-10 18:57:32 +08:00
|
|
|
endif
|
|
|
|
|
2014-01-10 12:26:44 +02:00
|
|
|
CFLAGS += -DNO_DYNAMIC_VP
|
2013-12-10 18:57:32 +08:00
|
|
|
LDFLAGS +=
|
2014-01-10 13:28:19 +02:00
|
|
|
ASMFLAGS += $(ASMFLAGS_PLATFORM) -DNO_DYNAMIC_VP
|
2013-12-10 18:57:32 +08:00
|
|
|
|
|
|
|
|
|
|
|
#### No user-serviceable parts below this line
|
2014-01-30 11:32:51 +02:00
|
|
|
ifneq ($(V),Yes)
|
|
|
|
QUIET_CXX = @printf "CXX\t$@\n";
|
2014-02-12 14:52:35 +08:00
|
|
|
QUIET_CC = @printf "CC\t$@\n";
|
2014-01-30 11:32:51 +02:00
|
|
|
QUIET_ASM = @printf "ASM\t$@\n";
|
|
|
|
QUIET_AR = @printf "AR\t$@\n";
|
|
|
|
QUIET = @
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
2014-01-19 20:24:10 +05:30
|
|
|
INCLUDES = -Icodec/api/svc -Icodec/common
|
2014-01-03 14:49:45 +08:00
|
|
|
#ASM_INCLUDES = -Iprocessing/src/asm/
|
|
|
|
ASM_INCLUDES = -Icodec/common/
|
2013-12-10 18:57:32 +08:00
|
|
|
|
2013-12-10 16:19:42 +08:00
|
|
|
DECODER_INCLUDES = \
|
|
|
|
-Icodec/decoder/core/inc \
|
|
|
|
-Icodec/decoder/plus/inc
|
|
|
|
|
|
|
|
ENCODER_INCLUDES = \
|
|
|
|
-Icodec/encoder/core/inc \
|
2014-01-26 00:36:55 +05:30
|
|
|
-Icodec/encoder/plus/inc
|
2013-12-10 16:19:42 +08:00
|
|
|
|
2014-02-19 14:39:43 +02:00
|
|
|
PROCESSING_INCLUDES = \
|
|
|
|
-Icodec/processing/interface \
|
|
|
|
-Icodec/processing/src/common
|
|
|
|
|
2014-01-17 09:55:21 +02:00
|
|
|
GTEST_INCLUDES = \
|
2014-01-19 20:24:10 +05:30
|
|
|
-Igtest \
|
|
|
|
-Igtest/include
|
|
|
|
|
|
|
|
CODEC_UNITTEST_INCLUDES = \
|
|
|
|
-Igtest/include
|
2014-01-17 09:55:21 +02:00
|
|
|
|
2013-12-10 16:19:42 +08:00
|
|
|
H264DEC_INCLUDES = $(DECODER_INCLUDES) -Icodec/console/dec/inc
|
2014-01-26 16:13:03 +02:00
|
|
|
H264DEC_LDFLAGS = -L. $(call LINK_LIB,decoder) $(call LINK_LIB,common)
|
2014-01-08 16:18:01 +02:00
|
|
|
H264DEC_DEPS = $(LIBPREFIX)decoder.$(LIBSUFFIX) $(LIBPREFIX)common.$(LIBSUFFIX)
|
2013-12-10 16:19:42 +08:00
|
|
|
|
|
|
|
H264ENC_INCLUDES = $(ENCODER_INCLUDES) -Icodec/console/enc/inc
|
2014-01-26 16:13:03 +02:00
|
|
|
H264ENC_LDFLAGS = -L. $(call LINK_LIB,encoder) $(call LINK_LIB,processing) $(call LINK_LIB,common)
|
2014-01-08 16:18:01 +02:00
|
|
|
H264ENC_DEPS = $(LIBPREFIX)encoder.$(LIBSUFFIX) $(LIBPREFIX)processing.$(LIBSUFFIX) $(LIBPREFIX)common.$(LIBSUFFIX)
|
2013-12-10 16:19:42 +08:00
|
|
|
|
2014-01-07 10:23:44 +08:00
|
|
|
CODEC_UNITTEST_LDFLAGS = -L. -lgtest -ldecoder -lcrypto -lencoder -lprocessing -lcommon
|
2014-01-09 12:42:42 +02:00
|
|
|
CODEC_UNITTEST_DEPS = $(LIBPREFIX)gtest.$(LIBSUFFIX) $(LIBPREFIX)decoder.$(LIBSUFFIX) $(LIBPREFIX)encoder.$(LIBSUFFIX) $(LIBPREFIX)processing.$(LIBSUFFIX) $(LIBPREFIX)common.$(LIBSUFFIX)
|
2013-12-12 10:56:52 +08:00
|
|
|
|
2014-01-12 17:38:56 +05:30
|
|
|
.PHONY: test gtest-bootstrap clean
|
2013-12-13 13:09:59 -08:00
|
|
|
|
2013-12-12 13:12:20 +08:00
|
|
|
all: libraries binaries
|
2013-12-10 16:19:42 +08:00
|
|
|
|
|
|
|
clean:
|
2014-01-30 11:32:51 +02:00
|
|
|
$(QUIET)rm -f $(OBJS) $(OBJS:.o=.d) $(LIBRARIES) $(BINARIES)
|
2013-12-10 16:19:42 +08:00
|
|
|
|
2013-12-12 12:24:55 +08:00
|
|
|
gtest-bootstrap:
|
|
|
|
svn co https://googletest.googlecode.com/svn/trunk/ gtest
|
2013-12-10 18:57:32 +08:00
|
|
|
|
2014-01-12 17:38:56 +05:30
|
|
|
ifeq ($(HAVE_GTEST),Yes)
|
2014-01-24 10:26:36 +02:00
|
|
|
test: codec_unittest$(EXEEXT)
|
2013-12-13 13:09:59 -08:00
|
|
|
./codec_unittest
|
2014-01-12 17:38:56 +05:30
|
|
|
else
|
2014-01-17 11:05:33 +02:00
|
|
|
test:
|
2014-01-12 17:38:56 +05:30
|
|
|
@echo "./gtest : No such file or directory."
|
|
|
|
@echo "You do not have gtest. Run make gtest-bootstrap to get gtest"
|
|
|
|
endif
|
2013-12-13 13:09:59 -08:00
|
|
|
|
2013-12-11 06:51:26 -08:00
|
|
|
include codec/common/targets.mk
|
2013-12-10 16:19:42 +08:00
|
|
|
include codec/decoder/targets.mk
|
|
|
|
include codec/encoder/targets.mk
|
2014-01-03 14:49:45 +08:00
|
|
|
include codec/processing/targets.mk
|
2013-12-10 16:19:42 +08:00
|
|
|
include codec/console/dec/targets.mk
|
|
|
|
include codec/console/enc/targets.mk
|
|
|
|
|
2014-01-27 14:42:36 +02:00
|
|
|
libraries: $(LIBPREFIX)wels.$(LIBSUFFIX)
|
|
|
|
LIBRARIES += $(LIBPREFIX)wels.$(LIBSUFFIX)
|
|
|
|
|
|
|
|
$(LIBPREFIX)wels.$(LIBSUFFIX): $(ENCODER_OBJS) $(DECODER_OBJS) $(PROCESSING_OBJS) $(COMMON_OBJS)
|
2014-02-18 10:33:09 +02:00
|
|
|
$(QUIET)rm -f $@
|
|
|
|
$(QUIET_AR)$(AR) $(AR_OPTS) $+
|
2014-01-27 14:42:36 +02:00
|
|
|
|
2014-01-27 14:54:47 +02:00
|
|
|
install: $(LIBPREFIX)wels.$(LIBSUFFIX)
|
|
|
|
mkdir -p $(PREFIX)/lib
|
|
|
|
mkdir -p $(PREFIX)/include/wels
|
|
|
|
install -m 644 $(LIBPREFIX)wels.$(LIBSUFFIX) $(PREFIX)/lib
|
|
|
|
install -m 644 codec/api/svc/codec*.h $(PREFIX)/include/wels
|
2014-01-27 14:42:36 +02:00
|
|
|
|
2013-12-12 12:24:55 +08:00
|
|
|
ifeq ($(HAVE_GTEST),Yes)
|
|
|
|
include build/gtest-targets.mk
|
2013-12-12 10:56:52 +08:00
|
|
|
include test/targets.mk
|
|
|
|
endif
|
2014-01-23 15:16:29 +02:00
|
|
|
|
|
|
|
-include $(OBJS:.o=.d)
|