summaryrefslogtreecommitdiff
path: root/Android.mk
blob: 4341eef5fad361890e5b6c6fb7160eb40cb9c33c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
# Copyright (C) 2008 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

LOCAL_PATH := $(call my-dir)

# Common project flags.
bsdiff_common_cflags := \
    -D_FILE_OFFSET_BITS=64 \
    -Wall \
    -Werror \
    -Wextra \
    -Wno-unused-parameter

bsdiff_common_static_libs := \
    libbz

# "bsdiff" program.
bsdiff_shared_libs := \
    libdivsufsort64 \
    libdivsufsort

bsdiff_src_files := \
    bsdiff.cc

# "bspatch" program.
bspatch_src_files := \
    bspatch.cc \
    extents.cc \
    extents_file.cc \
    file.cc \
    memory_file.cc

# Unit test files.
bsdiff_common_unittests := \
    bsdiff_unittest.cc \
    bspatch_unittest.cc \
    extents_file_unittest.cc \
    extents_unittest.cc \
    test_utils.cc

# Target executables.

include $(CLEAR_VARS)
LOCAL_MODULE := bspatch
LOCAL_CPP_EXTENSION := .cc
LOCAL_SRC_FILES := \
    $(bspatch_src_files) \
    bspatch_main.cc
LOCAL_CFLAGS := $(bsdiff_common_cflags)
LOCAL_C_INCLUDES += external/bzip2
LOCAL_STATIC_LIBRARIES := $(bsdiff_common_static_libs)
include $(BUILD_EXECUTABLE)

# bspatch used in recovery by update_engine_sideload.
include $(CLEAR_VARS)
LOCAL_MODULE := bspatch_recovery
LOCAL_MODULE_STEM := bspatch
LOCAL_FORCE_STATIC_EXECUTABLE := true
LOCAL_MODULE_PATH := $(TARGET_RECOVERY_ROOT_OUT)/sbin
LOCAL_CPP_EXTENSION := .cc
LOCAL_SRC_FILES := \
    $(bspatch_src_files) \
    bspatch_main.cc
LOCAL_CFLAGS := $(bsdiff_common_cflags)
LOCAL_STATIC_LIBRARIES := \
    $(bsdiff_common_static_libs)
include $(BUILD_EXECUTABLE)

# Host executables.

include $(CLEAR_VARS)
LOCAL_MODULE := bsdiff
LOCAL_CPP_EXTENSION := .cc
LOCAL_SRC_FILES := \
    $(bsdiff_src_files) \
    bsdiff_main.cc
LOCAL_CFLAGS := $(bsdiff_common_cflags)
LOCAL_C_INCLUDES += external/bzip2
LOCAL_STATIC_LIBRARIES := $(bsdiff_common_static_libs)
LOCAL_SHARED_LIBRARIES := $(bsdiff_shared_libs)
include $(BUILD_HOST_EXECUTABLE)

include $(CLEAR_VARS)
LOCAL_MODULE := bspatch
LOCAL_CPP_EXTENSION := .cc
LOCAL_SRC_FILES := \
    $(bspatch_src_files) \
    bspatch_main.cc
LOCAL_CFLAGS := $(bsdiff_common_cflags)
LOCAL_C_INCLUDES += external/bzip2
LOCAL_STATIC_LIBRARIES := $(bsdiff_common_static_libs)
include $(BUILD_HOST_EXECUTABLE)

include $(CLEAR_VARS)
LOCAL_MODULE := bsdiff_unittest
LOCAL_MODULE_TAGS := debug tests
LOCAL_CPP_EXTENSION := .cc
LOCAL_SRC_FILES := \
    $(bsdiff_src_files) \
    $(bspatch_src_files) \
    $(bsdiff_common_unittests) \
    testrunner.cc
LOCAL_CFLAGS := $(bsdiff_common_cflags)
LOCAL_C_INCLUDES += external/bzip2
LOCAL_STATIC_LIBRARIES := \
    $(bsdiff_common_static_libs) \
    libgtest_host \
    libgmock_host
LOCAL_SHARED_LIBRARIES := $(bsdiff_shared_libs)
include $(BUILD_HOST_EXECUTABLE)