| OLD | NEW |
| 1 # Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 [[def ExpandDict(key, value_in, pre_list=[], post_list=[]):]] | 4 [[def ExpandDict(key, value_in, pre_list=[], post_list=[]):]] |
| 5 [[ value = value_in or [] ]] | 5 [[ value = value_in or [] ]] |
| 6 [[ pre = pre_list or [] ]] | 6 [[ pre = pre_list or [] ]] |
| 7 [[ post = post_list or [] ]] | 7 [[ post = post_list or [] ]] |
| 8 [[ if type(value) is not dict:]] | 8 [[ if type(value) is not dict:]] |
| 9 [[ out = pre]] | 9 [[ out = pre]] |
| 10 [[ out.extend(value)]] | 10 [[ out.extend(value)]] |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 [[if 'INCLUDES' in target:]] | 32 [[if 'INCLUDES' in target:]] |
| 33 EXTRA_INC_PATHS={{' '.join(target['INCLUDES'])}} | 33 EXTRA_INC_PATHS={{' '.join(target['INCLUDES'])}} |
| 34 [[]] | 34 [[]] |
| 35 | 35 |
| 36 TARGET = {{target['NAME']}} | 36 TARGET = {{target['NAME']}} |
| 37 | 37 |
| 38 include $(NACL_SDK_ROOT)/tools/common.mk | 38 include $(NACL_SDK_ROOT)/tools/common.mk |
| 39 | 39 |
| 40 [[ExpandDict('DEPS', targets[0].get('DEPS', []))]] | 40 [[ExpandDict('DEPS', targets[0].get('DEPS', []))]] |
| 41 [[ExpandDict('LIBS', targets[0].get('LIBS', []), pre_list=['$(DEPS)'])]] | 41 [[ExpandDict('LIBS', targets[0].get('LIBS', []), pre_list=['$(DEPS)'])]] |
| 42 [[flags = target.get('CFLAGS', [])]] | 42 |
| 43 [[flags.extend(target.get('CXXFLAGS', []))]] | 43 [[for target in targets:]] |
| 44 [[ExpandDict('CFLAGS', flags)]] | 44 [[ if target['TYPE'] != 'linker-script':]] |
| 45 [[if 'CFLAGS_GCC' in target:]] | 45 [[ source_list = (s for s in sorted(target['SOURCES']) if not s.endswith('.h'
))]] |
| 46 [[ source_list = ' \\\n '.join(source_list)]] |
| 47 [[ sources = target['NAME'] + '_SOURCES']] |
| 48 [[ cflags = target['NAME'] + '_CFLAGS']] |
| 49 [[ flags = target.get('CFLAGS', [])]] |
| 50 [[ flags.extend(target.get('CXXFLAGS', []))]] |
| 51 [[ if len(targets) == 1:]] |
| 52 [[» sources = 'SOURCES']] |
| 53 [[» cflags = 'CFLAGS']] |
| 54 [[ ]] |
| 55 [[ ExpandDict(cflags, flags)]] |
| 56 [[ for define in target.get('DEFINES', []):]] |
| 57 {{cflags}} += -D{{define}} |
| 58 [[ ]] |
| 59 [[ if 'CFLAGS_GCC' in target:]] |
| 46 ifneq ($(TOOLCHAIN),pnacl) | 60 ifneq ($(TOOLCHAIN),pnacl) |
| 47 CFLAGS += {{' '.join(target['CFLAGS_GCC'])}} | 61 {{cflags}} += {{' '.join(target['CFLAGS_GCC'])}} |
| 48 endif | 62 endif |
| 49 [[]] | 63 [[ ]] |
| 64 {{sources}} = {{source_list}} |
| 50 | 65 |
| 51 [[for define in target.get('DEFINES', []):]] | |
| 52 CFLAGS += -D{{define}} | |
| 53 [[]] | |
| 54 | |
| 55 SOURCES = \ | |
| 56 [[for source in sorted(target['SOURCES']):]] | |
| 57 {{source}} \ | |
| 58 [[]] | 66 [[]] |
| 59 | 67 |
| 60 all: install | 68 all: install |
| 61 | 69 |
| 62 # Build rules generated by macros from common.mk: | 70 # Build rules generated by macros from common.mk: |
| 63 | 71 |
| 64 [[if targets[0].get('DEPS'):]] | 72 [[if targets[0].get('DEPS'):]] |
| 65 $(foreach dep,$(DEPS),$(eval $(call DEPEND_RULE,$(dep)))) | 73 $(foreach dep,$(DEPS),$(eval $(call DEPEND_RULE,$(dep)))) |
| 66 [[]] | 74 [[for target in targets:]] |
| 67 $(foreach src,$(SOURCES),$(eval $(call COMPILE_RULE,$(src),$(CFLAGS)))) | 75 [[ name = target['NAME'] ]] |
| 68 $(eval $(call LIB_RULE,$(TARGET),$(SOURCES))) | 76 [[ if len(targets) == 1:]] |
| 69 | 77 [[ sources = 'SOURCES']] |
| 70 [[if target['TYPE'] != 'static-lib':]] | 78 [[ cflags = 'CFLAGS']] |
| 79 [[ else:]] |
| 80 [[ sources = name + '_SOURCES']] |
| 81 [[ cflags = name + '_CFLAGS']] |
| 82 [[ if target['TYPE'] == 'linker-script':]] |
| 83 $(eval $(call LINKER_SCRIPT_RULE,{{name}},{{target['SOURCES'][0]}},{{target['SOU
RCES'][1]}})) |
| 84 [[ else:]] |
| 85 $(foreach src,$({{sources}}),$(eval $(call COMPILE_RULE,$(src),$({{cflags}})))) |
| 86 $(eval $(call LIB_RULE,{{name}},$({{sources}}))) |
| 87 [[ if target['TYPE'] != 'static-lib':]] |
| 71 ifneq (,$(findstring $(TOOLCHAIN),glibc bionic)) | 88 ifneq (,$(findstring $(TOOLCHAIN),glibc bionic)) |
| 72 $(eval $(call SO_RULE,$(TARGET),$(SOURCES),$(LIBS),$(DEPS))) | 89 $(eval $(call SO_RULE,{{name}},$({{sources}}),$(LIBS),$(DEPS))) |
| 73 endif | 90 endif |
| 74 [[]] | 91 [[ ]] |
| 75 {{post}} | 92 {{post}} |
| OLD | NEW |