|
|
|
# Created for android-8.1.0_r18
|
|
|
|
|
|
|
|
CFLAGS := -O2 -fdata-sections -ffunction-sections -flto \
|
|
|
|
-DADB_HOST \
|
|
|
|
-DADB_VERSION='"$(VERSION)"' \
|
|
|
|
-DFAKE_LOG_DEVICE \
|
|
|
|
-DFASTBOOT_VERSION='"$(VERSION)"' \
|
|
|
|
-D_GNU_SOURCE \
|
|
|
|
-D_Nonnull= \
|
|
|
|
-D_Nullable= \
|
|
|
|
-I boringssl/include \
|
|
|
|
-I core/adb \
|
|
|
|
-I core/base/include \
|
|
|
|
-I core/include \
|
|
|
|
-I core/libcrypto_utils/include \
|
|
|
|
-I core/libsparse/include \
|
|
|
|
-I core/libziparchive/include \
|
|
|
|
-I core/mkbootimg \
|
|
|
|
-I extras/ext4_utils/include \
|
|
|
|
-I extras/f2fs_utils \
|
|
|
|
-include string.h
|
|
|
|
|
|
|
|
CXXFLAGS := -std=gnu++14 -fpermissive \
|
|
|
|
$(CFLAGS)
|
|
|
|
|
|
|
|
CFLAGS += $(MYCFLAGS)
|
|
|
|
CXXFLAGS += $(MYCXXFLAGS)
|
|
|
|
|
|
|
|
FASTBOOT_OBJECTS := \
|
|
|
|
core/adb/diagnose_usb.o \
|
|
|
|
core/base/errors_unix.o \
|
|
|
|
core/base/file.o \
|
|
|
|
core/base/logging.o \
|
|
|
|
core/base/parsenetaddress.o \
|
|
|
|
core/base/stringprintf.o \
|
|
|
|
core/base/strings.o \
|
|
|
|
core/base/test_utils.o \
|
|
|
|
core/fastboot/bootimg_utils.o \
|
|
|
|
core/fastboot/engine.o \
|
|
|
|
core/fastboot/fastboot.o \
|
|
|
|
core/fastboot/fs.o \
|
|
|
|
core/fastboot/protocol.o \
|
|
|
|
core/fastboot/socket.o \
|
|
|
|
core/fastboot/tcp.o \
|
|
|
|
core/fastboot/udp.o \
|
|
|
|
core/fastboot/usb_linux.o \
|
|
|
|
core/fastboot/util.o \
|
|
|
|
core/libcutils/socket_network_client_unix.o \
|
|
|
|
core/libcutils/sockets_unix.o \
|
|
|
|
core/liblog/config_write.o \
|
|
|
|
core/liblog/fake_log_device.o \
|
|
|
|
core/liblog/fake_writer.o \
|
|
|
|
core/liblog/logger_lock.o \
|
|
|
|
core/liblog/logger_name.o \
|
|
|
|
core/liblog/logger_write.o \
|
|
|
|
core/libsparse/backed_block.o \
|
|
|
|
core/libsparse/output_file.o \
|
|
|
|
core/libsparse/sparse.o \
|
|
|
|
core/libsparse/sparse_crc32.o \
|
|
|
|
core/libsparse/sparse_err.o \
|
|
|
|
core/libsparse/sparse_read.o \
|
|
|
|
core/libutils/FileMap.o \
|
|
|
|
core/libziparchive/zip_archive.o
|
|
|
|
|
|
|
|
ADB_OBJECTS := \
|
|
|
|
core/adb/adb.o \
|
|
|
|
core/adb/adb_auth_host.o \
|
|
|
|
core/adb/adb_client.o \
|
|
|
|
core/adb/adb_io.o \
|
|
|
|
core/adb/adb_listeners.o \
|
|
|
|
core/adb/adb_trace.o \
|
|
|
|
core/adb/adb_utils.o \
|
|
|
|
core/adb/bugreport.o \
|
|
|
|
core/adb/client/main.o \
|
|
|
|
core/adb/client/usb_dispatch.o \
|
|
|
|
core/adb/client/usb_libusb.o \
|
|
|
|
core/adb/client/usb_linux.o \
|
|
|
|
core/adb/commandline.o \
|
|
|
|
core/adb/console.o \
|
|
|
|
core/adb/diagnose_usb.o \
|
|
|
|
core/adb/fdevent.o \
|
|
|
|
core/adb/file_sync_client.o \
|
|
|
|
core/adb/line_printer.o \
|
|
|
|
core/adb/services.o \
|
|
|
|
core/adb/shell_service_protocol.o \
|
|
|
|
core/adb/socket_spec.o \
|
|
|
|
core/adb/sockets.o \
|
|
|
|
core/adb/sysdeps/errno.o \
|
|
|
|
core/adb/sysdeps/posix/network.o \
|
|
|
|
core/adb/sysdeps_unix.o \
|
|
|
|
core/adb/transport.o \
|
|
|
|
core/adb/transport_local.o \
|
|
|
|
core/adb/transport_mdns_unsupported.o \
|
|
|
|
core/adb/transport_usb.o \
|
|
|
|
core/base/file.o \
|
|
|
|
core/base/logging.o \
|
|
|
|
core/base/parsenetaddress.o \
|
|
|
|
core/base/stringprintf.o \
|
|
|
|
core/base/strings.o \
|
|
|
|
core/libcrypto_utils/android_pubkey.o \
|
|
|
|
core/libcutils/socket_inaddr_any_server_unix.o \
|
|
|
|
core/libcutils/socket_local_client_unix.o \
|
|
|
|
core/libcutils/socket_local_server_unix.o \
|
|
|
|
core/libcutils/socket_network_client_unix.o \
|
|
|
|
core/libcutils/sockets.o \
|
|
|
|
core/libcutils/threads.o \
|
|
|
|
$(patsubst %.S, %.o, $(patsubst %.c, %.o, $(addprefix boringssl/, $(shell awk ' \
|
|
|
|
/^ name: "libcrypto_sources",$$/ { flag += 1; next } \
|
|
|
|
/^ linux_x86_64: {$$/ { flag += 2; next } \
|
|
|
|
/^ *srcs: \[$$/ { flag += 1; next } \
|
|
|
|
/^ *],$$/ { if (flag >= 3) exit; else flag = 0 } \
|
|
|
|
flag >= 2 { print gensub(/^ *"(.*)",$$/, "\\1", "g") }' \
|
|
|
|
boringssl/sources.bp))))
|
|
|
|
|
|
|
|
.PHONY: all
|
|
|
|
all: fastboot adb
|
|
|
|
|
|
|
|
.PHONY: clean
|
|
|
|
clean:
|
|
|
|
rm -rf fastboot $(FASTBOOT_OBJECTS) adb $(ADB_OBJECTS) fake_includes
|
|
|
|
|
|
|
|
fastboot: $(FASTBOOT_OBJECTS)
|
|
|
|
$(LINK.o) $(OUTPUT_OPTION) $^ -Wl,--gc-sections -flto -lstdc++ -lpthread -lz
|
|
|
|
|
|
|
|
adb: $(ADB_OBJECTS)
|
|
|
|
$(LINK.o) $(OUTPUT_OPTION) $^ -Wl,--gc-sections -flto -lstdc++ -lpthread -lm -lusb-1.0
|
|
|
|
|
|
|
|
# Shitty hack to create some fake includes to fix some things without directly patching the source.
|
|
|
|
$(FASTBOOT_OBJECTS) $(ADB_OBJECTS): fake_includes
|
|
|
|
$(FASTBOOT_OBJECTS) $(ADB_OBJECTS): CFLAGS += -I fake_includes
|
|
|
|
$(FASTBOOT_OBJECTS) $(ADB_OBJECTS): CXXFLAGS += -I fake_includes -isystem fake_includes/atomic
|
|
|
|
fake_includes:
|
|
|
|
mkdir -p $@/gtest $@/atomic
|
|
|
|
echo "#define FRIEND_TEST(...)" > $@/gtest/gtest_prod.h
|
|
|
|
ln -s /usr/include/libusb-1.0 $@/libusb
|
|
|
|
echo "#include <atomic>" >> $@/atomic/stdatomic.h
|
|
|
|
echo "#define _Atomic(T) atomic<T>" >> $@/atomic/stdatomic.h
|
|
|
|
echo "using namespace std;" >> $@/atomic/stdatomic.h
|