rjw | 1f88458 | 2022-01-06 17:20:42 +0800 | [diff] [blame^] | 1 | # |
| 2 | # Copyright (C) 2017 MediaTek, Inc. |
| 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 | |
| 17 | declare_args() { |
| 18 | boots_socket_path = "" |
| 19 | boots_vcom_opened = "" |
| 20 | usb_udc_type = "" |
| 21 | } |
| 22 | |
| 23 | #assert(boots_socket_path != "", "boots_socket_path build argument wasn't provided.") |
| 24 | |
| 25 | config("default_include_dirs") { |
| 26 | include_dirs = [ |
| 27 | ] |
| 28 | } |
| 29 | |
| 30 | config("linux") { |
| 31 | # TODO(keybuk): AndroidConfig.h or equivalent |
| 32 | |
| 33 | cflags = [ |
| 34 | "-Wall", |
| 35 | #"-Werror", |
| 36 | "-g", |
| 37 | "-O0", |
| 38 | "-fpic", |
| 39 | "-fdata-sections", |
| 40 | "-ffunction-sections", |
| 41 | "-fvisibility=hidden", |
| 42 | boots_vcom_opened, |
| 43 | usb_udc_type, |
| 44 | ] |
| 45 | |
| 46 | cflags_c = [ "-std=c99" ] |
| 47 | |
| 48 | cflags_cc = [ |
| 49 | #TODO(jpawlowski): we should use same c++ version as Android, which is c++11, |
| 50 | # but we use some c++14 features. Uncomment when this get fixed in code.: |
| 51 | "-std=c++1y", |
| 52 | "-fno-exceptions", |
| 53 | ] |
| 54 | |
| 55 | defines = [ |
| 56 | "_FORTIFY_SOURCE=2", |
| 57 | "_GNU_SOURCE", |
| 58 | "LOG_NDEBUG=1", |
| 59 | "EXPORT_SYMBOL=__attribute__((visibility(\"default\")))", |
| 60 | "KERNEL_MISSING_CLOCK_BOOTTIME_ALARM=TRUE", |
| 61 | |
| 62 | # This is a macro to that can be used by source code to detect if the |
| 63 | # current build is done by GN or via Android.mk. This is a temporary |
| 64 | # workaround until we can remove all Android-specific dependencies. |
| 65 | |
| 66 | "BOOTS_SOCKET_PATH=\"$boots_socket_path/\"", |
| 67 | ] |
| 68 | } |
| 69 | |
| 70 | config("pic") { |
| 71 | cflags = [ "-fPIC" ] |
| 72 | } |
| 73 | |
| 74 | config("gc") { |
| 75 | ldflags = [ "-Wl,--gc-sections" ] |
| 76 | } |