1# Copyright 2017 The Fuchsia Authors. All rights reserved. 2# Use of this source code is governed by a BSD-style license that can be 3# found in the LICENSE file. 4 5# Three copies of libtrace-engine are built: 6# 1) Shared library for use by userspace tracing. 7# 2) Static library for use by userspace tracing. 8# 3) Static library to be linked into libdriver.so for use by driver tracing. 9# 10# N.B. Please DO NOT use (2) unless you KNOW you need to. Generally you do not. 11# If in doubt, ask. (2) is for very special circumstances where 12# libtrace-engine.so is not available. 13 14LOCAL_DIR := $(GET_LOCAL_DIR) 15 16# Common pieces. 17 18LOCAL_SRCS := \ 19 $(LOCAL_DIR)/context.cpp \ 20 $(LOCAL_DIR)/context_api.cpp \ 21 $(LOCAL_DIR)/engine.cpp \ 22 $(LOCAL_DIR)/nonce.cpp 23 24LOCAL_STATIC_LIBS := \ 25 system/ulib/async \ 26 system/ulib/async.cpp \ 27 system/ulib/fbl \ 28 system/ulib/zx \ 29 system/ulib/zxcpp 30 31LOCAL_LIBS := \ 32 system/ulib/c \ 33 system/ulib/zircon 34 35# The default version for the normal case. 36 37MODULE := $(LOCAL_DIR) 38 39MODULE_TYPE := userlib 40MODULE_COMPILEFLAGS += -fvisibility=hidden 41 42MODULE_SRCS := $(LOCAL_SRCS) 43 44MODULE_EXPORT := so 45MODULE_SO_NAME := trace-engine 46 47MODULE_STATIC_LIBS := $(LOCAL_STATIC_LIBS) 48 49MODULE_LIBS := $(LOCAL_LIBS) 50 51include make/module.mk 52 53# A special version for programs and shared libraries that can't use 54# libtrace-engine.so, e.g., because it is unavailable. 55# N.B. Please verify that you really need this before using it. 56# Generally you DO NOT want to use this. 57 58MODULE := $(LOCAL_DIR).static 59MODULE_NAME := trace-engine-static 60 61MODULE_TYPE := userlib 62MODULE_COMPILEFLAGS += -fvisibility=hidden 63MODULE_COMPILEFLAGS += -DSTATIC_LIBRARY 64 65MODULE_SRCS := $(LOCAL_SRCS) 66 67MODULE_STATIC_LIBS := $(LOCAL_STATIC_LIBS) 68 69MODULE_LIBS := $(LOCAL_LIBS) 70 71MODULE_PACKAGE := static 72 73include make/module.mk 74 75# And again, but this time for drivers. 76# This gets linked into libdriver.so. 77 78MODULE := $(LOCAL_DIR).driver 79MODULE_NAME := trace-engine-driver 80 81MODULE_TYPE := userlib 82MODULE_COMPILEFLAGS += -fvisibility=hidden 83MODULE_COMPILEFLAGS += -DDDK_TRACING 84 85# trace_generate_nonce() exists even when driver tracing is disabled 86MODULE_SRCS := \ 87 $(LOCAL_DIR)/nonce.cpp 88 89MODULE_STATIC_LIBS := \ 90 system/ulib/fbl 91 92ifeq ($(call TOBOOL,$(ENABLE_DRIVER_TRACING)),true) 93MODULE_SRCS += \ 94 $(LOCAL_DIR)/context.cpp \ 95 $(LOCAL_DIR)/context_api.cpp \ 96 $(LOCAL_DIR)/engine.cpp 97 98MODULE_STATIC_LIBS += \ 99 system/ulib/async.cpp \ 100 system/ulib/async \ 101 system/ulib/zx \ 102 system/ulib/zxcpp 103endif 104 105MODULE_LIBS := $(LOCAL_LIBS) 106 107include make/module.mk 108 109# Header-only src package for use by exported trace-reader package. 110 111MODULE := $(LOCAL_DIR).headers-for-reader 112MODULE_NAME := trace-engine-headers-for-reader 113 114MODULE_TYPE := userlib 115MODULE_COMPILEFLAGS += -fvisibility=hidden 116 117MODULE_PACKAGE_SRCS := none 118MODULE_PACKAGE_INCS := \ 119 $(LOCAL_DIR)/include/trace-engine/fields.h \ 120 $(LOCAL_DIR)/include/trace-engine/types.h 121 122MODULE_STATIC_LIBS := \ 123 system/ulib/fbl 124 125MODULE_LIBS := 126 127MODULE_PACKAGE := src 128 129include make/module.mk 130