blob: 5a700a8b1886571eefbbb0a362bfde885ae582f0 [file] [log] [blame]
Chenghan Zhoud4f44d22020-06-18 15:42:06 -04001# Copyright 2020 The Pigweed Authors
2#
3# Licensed under the Apache License, Version 2.0 (the "License"); you may not
4# use this file except in compliance with the License. You may obtain a copy of
5# the License at
6#
7# https://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12# License for the specific language governing permissions and limitations under
13# the License.
14
Chenghan Zhoud4f44d22020-06-18 15:42:06 -040015import("//build_overrides/pigweed.gni")
16
17import("$dir_pw_build/facade.gni")
18import("$dir_pw_build/target_types.gni")
19import("$dir_pw_docgen/docs.gni")
20import("$dir_pw_malloc/backend.gni")
21import("$dir_pw_unit_test/test.gni")
Wyatt Heplerd49f8fe2020-10-15 10:13:47 -070022
Chenghan Zhoud4f44d22020-06-18 15:42:06 -040023config("default_config") {
24 include_dirs = [ "public" ]
25}
26
27config("pw_malloc_wrapper_config") {
28 # Link options that provides replace dynamic memory operations in standard
29 # library with the pigweed malloc.
30 ldflags = [
31 # memory allocation -- these must be re-entrant and do locking
32 "-Wl,--wrap=malloc",
33 "-Wl,--wrap=free",
34 "-Wl,--wrap=realloc",
35 "-Wl,--wrap=calloc",
36
37 # Wrap these in case internal newlib call them (e.g. strdup will)
38 # directly call _malloc_r)
39 "-Wl,--wrap=_malloc_r",
40 "-Wl,--wrap=_realloc_r",
41 "-Wl,--wrap=_free_r",
42 "-Wl,--wrap=_calloc_r",
43 ]
44}
45
46pw_facade("pw_malloc") {
47 public_configs = [ ":default_config" ]
48 public = [ "public/pw_malloc/malloc.h" ]
49 backend = pw_malloc_BACKEND
50}
51
52pw_doc_group("docs") {
53 sources = [ "docs.rst" ]
54}