1 #!/usr/bin/env bash 2 # Copyright 2016 The TensorFlow Authors. All Rights Reserved. 3 # 4 # Licensed under the Apache License, Version 2.0 (the "License"); 5 # you may not use this file except in compliance with the License. 6 # You may obtain a copy of the License at 7 # 8 # http://www.apache.org/licenses/LICENSE-2.0 9 # 10 # Unless required by applicable law or agreed to in writing, software 11 # distributed under the License is distributed on an "AS IS" BASIS, 12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 # See the License for the specific language governing permissions and 14 # limitations under the License. 15 # ============================================================================== 16 # This sub Makefile compiles libraries under this directory. This is designed to 17 # be used as a sub Makefile with tensorflow/contrib/makefile/Makefile. 18 # You can build targets in this file by including this sub makefile like: 19 # $ make -f tensorflow/contrib/makefile/Makefile TARGET=<target> \ 20 # SUB_MAKEFILES=\ 21 # $(pwd)/tensorflow/contrib/makefile/sub_makefiles/quantization/Makefile.in \ 22 # (optional: NDK_ROOT=<ndk_root>) contrib_quantization_tests 23 # TODO(satok): Support more targets 24 25 GTEST_DIR := \ 26 $(MAKEFILE_DIR)/downloads/googletest/googletest 27 28 GTEST_HEADERS = \ 29 $(wildcard $(GTEST_DIR)/include/gtest/*.h) \ 30 $(wildcard $(GTEST_DIR)/include/gtest/internal/*.h) 31 32 GTEST_SRCS := \ 33 $(wildcard $(GTEST_DIR)/src/*.cc) \ 34 $(wildcard $(GTEST_DIR)/src/*.h) \ 35 $(GTEST_HEADERS) 36 37 # CAVEAT: We should disable TENSORFLOW_DISABLE_META while running 38 # quantized_matmul on Android because it crashes in 39 # MultiThreadGemm in tensorflow/core/kernels/meta_support.cc 40 # TODO(satok): Remove once it's fixed 41 CXXFLAGS += -DTENSORFLOW_DISABLE_META 42 43 GRAPH_TRANSFER_SRCS := \ 44 tensorflow/cc/framework/scope.cc \ 45 tensorflow/cc/framework/ops.cc \ 46 tensorflow/cc/ops/const_op.cc \ 47 tensorflow/core/kernels/hexagon/graph_transfer_utils.cc \ 48 tensorflow/core/kernels/hexagon/graph_transferer.cc \ 49 tensorflow/core/kernels/hexagon/graph_transferer_test.cc \ 50 tensorflow/core/kernels/hexagon/hexagon_control_wrapper.cc \ 51 tensorflow/core/kernels/hexagon/hexagon_ops_definitions.cc \ 52 tensorflow/core/kernels/remote_fused_graph_execute_op.cc \ 53 tensorflow/core/kernels/remote_fused_graph_execute_utils.cc \ 54 tensorflow/core/ops/remote_fused_graph_ops.cc \ 55 tensorflow/core/platform/posix/test.cc 56 57 QUANTIZATION_TEST_SRCS := \ 58 $(GRAPH_TRANSFER_SRCS) \ 59 tensorflow/core/kernels/hexagon/graph_transferer_test.cc \ 60 tensorflow/contrib/makefile/test/test_main.cc 61 62 QUANTIZATION_TEST_OBJS := $(addprefix $(OBJDIR), $(QUANTIZATION_TEST_SRCS:.cc=.o)) 63 64 QUANTIZATION_TEST_NAME := quantization_tests 65 QUANTIZATION_TEST_BIN_PATH := $(BINDIR)$(QUANTIZATION_TEST_NAME) 66 67 INCLUDES += \ 68 -I$(MAKEFILE_DIR)/downloads/gemmlowp \ 69 -I$(MAKEFILE_DIR)/downloads/googletest/googletest/include 70 71 QUANTIZATION_TEST_INCLUDES := $(INCLUDES) 72 73 $(OBJDIR)gtest-all.o: $(GTEST_SRCS) $(QUANTIZATION_TEST_OBJS) 74 $(CXX) $(CXXFLAGS) $(QUANTIZATION_TEST_INCLUDES) -I $(GTEST_DIR) -c \ 75 $(GTEST_DIR)/src/gtest-all.cc -o $@ 76 77 $(LIBDIR)gtest.a: $(OBJDIR)gtest-all.o 78 @mkdir -p $(dir $@) 79 $(AR) $(ARFLAGS) $@ $^ 80 81 $(QUANTIZATION_TEST_BIN_PATH): $(LIB_PATH) $(LIBDIR)gtest.a $(QUANTIZATION_TEST_OBJS) 82 @mkdir -p $(dir $@) 83 $(CXX) $(CXXFLAGS) $(QUANTIZATION_TEST_INCLUDES) \ 84 -o $(QUANTIZATION_TEST_BIN_PATH) $(QUANTIZATION_TEST_OBJS) \ 85 $(LIBFLAGS) $(LIB_PATH) $(LIBDIR)gtest.a $(LDFLAGS) $(LIBS) 86 87 $(QUANTIZATION_TEST_NAME): $(QUANTIZATION_TEST_BIN_PATH) 88