Home | History | Annotate | Download | only in build
      1 #
      2 #  Copyright (C) 2015 Google, 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   # Include path for hardware/bluetooth.h
     19   libhw_include_path = ""
     20   core_include_path = ""
     21   audio_include_path = ""
     22 }
     23 
     24 config("default_include_dirs") {
     25   # TODO(armansito): Remove "core_include_path" once the cutils includes have
     26   # been removed.
     27   assert(libhw_include_path != "",
     28          "libhardware_include_path build argument wasn't provided.")
     29   assert(core_include_path != "",
     30          "core_include_path build argument wasn't provided.")
     31   assert(audio_include_path != "",
     32          "audio_include_path build argument wasn't provided.")
     33   include_dirs = [
     34     libhw_include_path,
     35     core_include_path,
     36     audio_include_path,
     37   ]
     38 }
     39 
     40 config("linux") {
     41   # TODO(keybuk): AndroidConfig.h or equivalent
     42 
     43   cflags = [
     44     #TODO(jpawlowski): uncomment once we have no warnings on linux build
     45     #    "-Wall",
     46     #    "-Werror",
     47     "-g",
     48     "-O0",
     49     "-fpic",
     50     "-fdata-sections",
     51     "-ffunction-sections",
     52     "-fvisibility=hidden",
     53   ]
     54 
     55   cflags_c = [ "-std=c99" ]
     56 
     57   cflags_cc = [
     58 #TODO(jpawlowski): we should use same c++ version as Android, which is c++11,
     59 # but we use some c++14 features. Uncomment when this get fixed in code.:
     60     "-std=c++14",
     61     "-fno-exceptions",
     62   ]
     63 
     64   defines = [
     65     "_FORTIFY_SOURCE=2",
     66     "_GNU_SOURCE",
     67     "HAS_NO_BDROID_BUILDCFG",
     68     "LOG_NDEBUG=1",
     69     "EXPORT_SYMBOL=__attribute__((visibility(\"default\")))",
     70     "KERNEL_MISSING_CLOCK_BOOTTIME_ALARM=TRUE",
     71 
     72     # This is a macro to that can be used by source code to detect if the
     73     # current build is done by GN or via Android.mk. This is a temporary
     74     # workaround until we can remove all Android-specific dependencies.
     75     "OS_GENERIC",
     76   ]
     77 }
     78 
     79 config("pic") {
     80   cflags = [ "-fPIC" ]
     81 }
     82 
     83 config("gc") {
     84   ldflags = [ "-Wl,--gc-sections" ]
     85 }
     86