Source release 19.6.0
GitOrigin-RevId: 13a33e34413c19da1bfe76abcc66be519c9ac9d1
This commit is contained in:
200
factory_upload_tool/ce/Makefile
Normal file
200
factory_upload_tool/ce/Makefile
Normal file
@@ -0,0 +1,200 @@
|
||||
#
|
||||
# Copyright 2024 Google LLC. All Rights Reserved. This file and proprietary
|
||||
# source code may only be used and distributed under the Widevine
|
||||
# License Agreement.
|
||||
#
|
||||
CDM_DIR ?= $(shell pwd)/../..
|
||||
|
||||
# CROSS_COMPILE: prefix for cross compilers, e.g. arm-none-gnueabihf-
|
||||
cc ?= $(CROSS_COMPILE)gcc
|
||||
cxx ?= $(CROSS_COMPILE)g++
|
||||
ARCH ?= 64
|
||||
IS_ARM ?= 0
|
||||
|
||||
project := wv_factory_extractor
|
||||
srcdir := $(shell realpath --relative-to=$(CURDIR) $(CDM_DIR))
|
||||
output = $(project)
|
||||
|
||||
# Place outputs in $CDM_DIR/out/wv_factory_extractor/
|
||||
default_build_dir := $(CDM_DIR)/out/$(project)
|
||||
# Check if OUT_DIR is set and not empty
|
||||
ifeq ($(strip $(OUT_DIR)),)
|
||||
builddir := $(default_build_dir)/
|
||||
else
|
||||
builddir := $(OUT_DIR)/
|
||||
endif
|
||||
|
||||
# All file locations are relative to the $CDM_DIR path.
|
||||
REPO_TOP :=
|
||||
|
||||
# Path to the modified example_main file used by tests
|
||||
MODIFIED_MAIN_SRC := example_main_modified.cpp
|
||||
|
||||
# Conditionally add the source file based on its existence
|
||||
ifneq ($(wildcard $(MODIFIED_MAIN_SRC)),)
|
||||
extractor_sources += $(REPO_TOP)/factory_upload_tool/ce/$MODIFIED_MAIN_SRC
|
||||
$(info Using modified source for tests)
|
||||
else
|
||||
extractor_sources += $(REPO_TOP)/factory_upload_tool/ce/example_main.cpp
|
||||
endif
|
||||
|
||||
# other sources
|
||||
extractor_sources += \
|
||||
$(REPO_TOP)/factory_upload_tool/ce/log.cpp \
|
||||
$(REPO_TOP)/factory_upload_tool/ce/properties_ce.cpp \
|
||||
$(REPO_TOP)/factory_upload_tool/ce/wv_factory_extractor.cpp \
|
||||
$(REPO_TOP)/util/src/string_conversions.cpp \
|
||||
$(REPO_TOP)/factory_upload_tool/common/src/WidevineOemcryptoInterface.cpp \
|
||||
|
||||
extractor_includes := \
|
||||
$(REPO_TOP)/factory_upload_tool/common/include \
|
||||
$(REPO_TOP)/oemcrypto/include \
|
||||
$(REPO_TOP)/util/include
|
||||
|
||||
srcs := $(extractor_sources)
|
||||
incs := $(extractor_includes)
|
||||
|
||||
ifdef USE_VALIDATOR
|
||||
oemcrypto_util_dir := $(REPO_TOP)/oemcrypto/util
|
||||
|
||||
validator_sources := \
|
||||
$(oemcrypto_util_dir)/src/bcc_validator.cpp \
|
||||
$(oemcrypto_util_dir)/src/cbor_validator.cpp \
|
||||
$(oemcrypto_util_dir)/src/device_info_validator.cpp \
|
||||
$(oemcrypto_util_dir)/src/prov4_validation_helper.cpp \
|
||||
$(oemcrypto_util_dir)/src/cmac.cpp \
|
||||
$(oemcrypto_util_dir)/src/oemcrypto_drm_key.cpp \
|
||||
$(oemcrypto_util_dir)/src/oemcrypto_ecc_key.cpp \
|
||||
$(oemcrypto_util_dir)/src/oemcrypto_key_deriver.cpp \
|
||||
$(oemcrypto_util_dir)/src/oemcrypto_oem_cert.cpp \
|
||||
$(oemcrypto_util_dir)/src/oemcrypto_rsa_key.cpp \
|
||||
$(oemcrypto_util_dir)/src/signed_csr_payload_validator.cpp \
|
||||
$(oemcrypto_util_dir)/src/wvcrc.cpp
|
||||
|
||||
validator_includes := \
|
||||
$(oemcrypto_util_dir)/include
|
||||
|
||||
cppbor_dir := $(REPO_TOP)/third_party/libcppbor
|
||||
|
||||
cppbor_sources += \
|
||||
$(cppbor_dir)/src/cppbor.cpp \
|
||||
$(cppbor_dir)/src/cppbor_parse.cpp
|
||||
|
||||
cppbor_includes += \
|
||||
$(cppbor_dir)/include \
|
||||
$(cppbor_dir)/include/cppbor
|
||||
|
||||
include $(CDM_DIR)/third_party/boringssl/kit/sources.mk
|
||||
boringssl_sources_raw += $(crypto_sources)
|
||||
ifeq ($(ARCH), 64)
|
||||
ifneq ($(IS_ARM), 0)
|
||||
boringssl_sources_raw += $(linux_aarch64_sources)
|
||||
else
|
||||
boringssl_sources_raw += $(linux_x86_64_sources)
|
||||
endif
|
||||
else ifeq ($(ARCH), 32)
|
||||
ifneq ($(IS_ARM), 0)
|
||||
boringssl_sources_raw += $(linux_arm_sources)
|
||||
else
|
||||
boringssl_sources_raw += $(linux_x86_sources)
|
||||
endif
|
||||
else
|
||||
$(error No known value for ARCH; assembly not included for BoringSSL)
|
||||
endif
|
||||
|
||||
boringssl_dir := $(REPO_TOP)/third_party/boringssl
|
||||
|
||||
boringssl_sources += \
|
||||
$(addprefix $(boringssl_dir)/kit/, $(boringssl_sources_raw))
|
||||
|
||||
boringssl_includes += \
|
||||
$(boringssl_dir)/kit/src/include
|
||||
|
||||
srcs += \
|
||||
$(validator_sources) \
|
||||
$(cppbor_sources) \
|
||||
$(boringssl_sources)
|
||||
|
||||
incs += \
|
||||
$(validator_includes) \
|
||||
$(cppbor_includes) \
|
||||
$(boringssl_includes)
|
||||
endif
|
||||
|
||||
# flags
|
||||
cflags += \
|
||||
-Wall \
|
||||
-Werror \
|
||||
-fPIC \
|
||||
-fsanitize=address \
|
||||
$(addprefix -I, $(includes))
|
||||
|
||||
cflags_c += \
|
||||
$(cflags) \
|
||||
-std=c11 \
|
||||
-D_POSIX_C_SOURCE=200809L \
|
||||
-fno-inline
|
||||
|
||||
cppflags += \
|
||||
$(cflags)
|
||||
|
||||
ifdef USE_VALIDATOR
|
||||
cppflags += -DUSE_VALIDATOR
|
||||
endif
|
||||
|
||||
ldflags = \
|
||||
-ldl \
|
||||
-rdynamic \
|
||||
-fsanitize=address \
|
||||
|
||||
# make rules
|
||||
ifneq ($V,1)
|
||||
q := @
|
||||
cmd-echo := true
|
||||
cmd-echo-silent := echo
|
||||
else
|
||||
q :=
|
||||
cmd-echo := echo
|
||||
cmd-echo-silent := true
|
||||
endif
|
||||
|
||||
ssrc := $(patsubst %.S, %.o, $(filter %.S, $(srcs)))
|
||||
csrc := $(patsubst %.c, %.o, $(filter %.c, $(srcs)))
|
||||
cppsrc := $(patsubst %.cpp, %.o, $(filter %.cpp, $(srcs)))
|
||||
ccsrc := $(patsubst %.cc, %.o, $(filter %.cc, $(srcs)))
|
||||
objs := $(sort $(addprefix $(builddir), $(csrc) $(cppsrc) $(ccsrc) $(ssrc)))
|
||||
|
||||
includes := $(addprefix $(srcdir), $(incs)) $(global-incs)
|
||||
|
||||
.PHONY: all
|
||||
all: $(builddir)$(output)
|
||||
|
||||
$(builddir)$(output): $(objs)
|
||||
@$(cmd-echo-silent) ' LD $@'
|
||||
${q}$(cxx) -o $@ $(objs) $(ldflags)
|
||||
|
||||
$(builddir)%.o: $(srcdir)%.c
|
||||
${q}mkdir -p $(shell dirname $@)
|
||||
@$(cmd-echo-silent) ' CC $@'
|
||||
${q}$(cc) $(cflags_c) -c $< -o $@
|
||||
|
||||
$(builddir)%.o: $(srcdir)%.cc
|
||||
${q}mkdir -p $(shell dirname $@)
|
||||
@$(cmd-echo-silent) ' CPP $@'
|
||||
${q}$(cxx) $(cppflags) -c $< -o $@
|
||||
|
||||
$(builddir)%.o: $(srcdir)%.cpp
|
||||
${q}mkdir -p $(shell dirname $@)
|
||||
@$(cmd-echo-silent) ' CPP $@'
|
||||
$(cxx) $(cppflags) -c $< -o $@
|
||||
|
||||
$(builddir)%.o: $(srcdir)%.S
|
||||
${q}mkdir -p $(shell dirname $@)
|
||||
@$(cmd-echo-silent) ' CC $@'
|
||||
${q}$(cc) $(cflags_c) -c $< -o $@
|
||||
|
||||
.PHONY: clean
|
||||
clean:
|
||||
@$(cmd-echo-silent) ' CLEAN $(builddir)'
|
||||
${q}rm -f $(objs) $(output)
|
||||
@if [ -d $(builddir) ]; then rm -r $(builddir); fi
|
||||
Reference in New Issue
Block a user