OLD | NEW |
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2012 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 | 4 |
5 # | 5 # |
6 # GNU Make based build file. For details on GNU Make see: | 6 # GNU Make based build file. For details on GNU Make see: |
7 # http://www.gnu.org/software/make/manual/make.html | 7 # http://www.gnu.org/software/make/manual/make.html |
8 # | 8 # |
9 | 9 |
10 # | 10 # |
11 # Macros for TOOLS | 11 # Macros for TOOLS |
12 # | 12 # |
| 13 ifneq ($(TOOLCHAIN),bionic) |
13 X86_32_CC := $(NACL_COMPILER_PREFIX) $(shell $(NACL_CONFIG) -t $(TOOLCHAIN) -a x
86_32 --tool=cc) | 14 X86_32_CC := $(NACL_COMPILER_PREFIX) $(shell $(NACL_CONFIG) -t $(TOOLCHAIN) -a x
86_32 --tool=cc) |
14 X86_32_CXX := $(NACL_COMPILER_PREFIX) $(shell $(NACL_CONFIG) -t $(TOOLCHAIN) -a
x86_32 --tool=c++) | 15 X86_32_CXX := $(NACL_COMPILER_PREFIX) $(shell $(NACL_CONFIG) -t $(TOOLCHAIN) -a
x86_32 --tool=c++) |
15 X86_32_LINK := $(shell $(NACL_CONFIG) -t $(TOOLCHAIN) -a x86_32 --tool=c++) | 16 X86_32_LINK := $(shell $(NACL_CONFIG) -t $(TOOLCHAIN) -a x86_32 --tool=c++) |
16 X86_32_LIB := $(shell $(NACL_CONFIG) -t $(TOOLCHAIN) -a x86_32 --tool=ar) | 17 X86_32_LIB := $(shell $(NACL_CONFIG) -t $(TOOLCHAIN) -a x86_32 --tool=ar) |
17 X86_32_STRIP := $(shell $(NACL_CONFIG) -t $(TOOLCHAIN) -a x86_32 --tool=strip) | 18 X86_32_STRIP := $(shell $(NACL_CONFIG) -t $(TOOLCHAIN) -a x86_32 --tool=strip) |
18 X86_32_NM := $(shell $(NACL_CONFIG) -t $(TOOLCHAIN) -a x86_32 --tool=nm) | 19 X86_32_NM := $(shell $(NACL_CONFIG) -t $(TOOLCHAIN) -a x86_32 --tool=nm) |
19 | 20 |
20 X86_64_CC := $(NACL_COMPILER_PREFIX) $(shell $(NACL_CONFIG) -t $(TOOLCHAIN) -a x
86_64 --tool=cc) | 21 X86_64_CC := $(NACL_COMPILER_PREFIX) $(shell $(NACL_CONFIG) -t $(TOOLCHAIN) -a x
86_64 --tool=cc) |
21 X86_64_CXX := $(NACL_COMPILER_PREFIX) $(shell $(NACL_CONFIG) -t $(TOOLCHAIN) -a
x86_64 --tool=c++) | 22 X86_64_CXX := $(NACL_COMPILER_PREFIX) $(shell $(NACL_CONFIG) -t $(TOOLCHAIN) -a
x86_64 --tool=c++) |
22 X86_64_LINK := $(shell $(NACL_CONFIG) -t $(TOOLCHAIN) -a x86_64 --tool=c++) | 23 X86_64_LINK := $(shell $(NACL_CONFIG) -t $(TOOLCHAIN) -a x86_64 --tool=c++) |
23 X86_64_LIB := $(shell $(NACL_CONFIG) -t $(TOOLCHAIN) -a x86_64 --tool=ar) | 24 X86_64_LIB := $(shell $(NACL_CONFIG) -t $(TOOLCHAIN) -a x86_64 --tool=ar) |
24 X86_64_STRIP := $(shell $(NACL_CONFIG) -t $(TOOLCHAIN) -a x86_64 --tool=strip) | 25 X86_64_STRIP := $(shell $(NACL_CONFIG) -t $(TOOLCHAIN) -a x86_64 --tool=strip) |
25 X86_64_NM := $(shell $(NACL_CONFIG) -t $(TOOLCHAIN) -a x86_64 --tool=nm) | 26 X86_64_NM := $(shell $(NACL_CONFIG) -t $(TOOLCHAIN) -a x86_64 --tool=nm) |
| 27 endif |
26 | 28 |
27 ARM_CC := $(NACL_COMPILER_PREFIX) $(shell $(NACL_CONFIG) -t $(TOOLCHAIN) -a arm
--tool=cc) | 29 ARM_CC := $(NACL_COMPILER_PREFIX) $(shell $(NACL_CONFIG) -t $(TOOLCHAIN) -a arm
--tool=cc) |
28 ARM_CXX := $(NACL_COMPILER_PREFIX) $(shell $(NACL_CONFIG) -t $(TOOLCHAIN) -a arm
--tool=c++) | 30 ARM_CXX := $(NACL_COMPILER_PREFIX) $(shell $(NACL_CONFIG) -t $(TOOLCHAIN) -a arm
--tool=c++) |
29 ARM_LINK := $(shell $(NACL_CONFIG) -t $(TOOLCHAIN) -a arm --tool=c++) | 31 ARM_LINK := $(shell $(NACL_CONFIG) -t $(TOOLCHAIN) -a arm --tool=c++) |
30 ARM_LIB := $(shell $(NACL_CONFIG) -t $(TOOLCHAIN) -a arm --tool=ar) | 32 ARM_LIB := $(shell $(NACL_CONFIG) -t $(TOOLCHAIN) -a arm --tool=ar) |
31 ARM_STRIP := $(shell $(NACL_CONFIG) -t $(TOOLCHAIN) -a arm --tool=strip) | 33 ARM_STRIP := $(shell $(NACL_CONFIG) -t $(TOOLCHAIN) -a arm --tool=strip) |
32 ARM_NM := $(shell $(NACL_CONFIG) -t $(TOOLCHAIN) -a arm --tool=nm) | 34 ARM_NM := $(shell $(NACL_CONFIG) -t $(TOOLCHAIN) -a arm --tool=nm) |
33 | 35 |
34 NCVAL ?= python $(NACL_SDK_ROOT)/tools/ncval.py | 36 NCVAL ?= python $(NACL_SDK_ROOT)/tools/ncval.py |
35 | 37 |
(...skipping 26 matching lines...) Expand all Loading... |
62 ifeq (,$(MULTI_PLATFORM)) | 64 ifeq (,$(MULTI_PLATFORM)) |
63 X86_32_LDFLAGS ?= -Wl,-Map,$(OUTDIR)/$(TARGET)_x86_32.map | 65 X86_32_LDFLAGS ?= -Wl,-Map,$(OUTDIR)/$(TARGET)_x86_32.map |
64 X86_64_LDFLAGS ?= -Wl,-Map,$(OUTDIR)/$(TARGET)_x86_64.map | 66 X86_64_LDFLAGS ?= -Wl,-Map,$(OUTDIR)/$(TARGET)_x86_64.map |
65 ARM_LDFLAGS ?= -Wl,-Map,$(OUTDIR)/$(TARGET)_arm.map | 67 ARM_LDFLAGS ?= -Wl,-Map,$(OUTDIR)/$(TARGET)_arm.map |
66 else | 68 else |
67 X86_32_LDFLAGS ?= -Wl,-Map,$(X86_32_OUTDIR)/$(TARGET)_x86_32.map | 69 X86_32_LDFLAGS ?= -Wl,-Map,$(X86_32_OUTDIR)/$(TARGET)_x86_32.map |
68 X86_64_LDFLAGS ?= -Wl,-Map,$(X86_64_OUTDIR)/$(TARGET)_x86_64.map | 70 X86_64_LDFLAGS ?= -Wl,-Map,$(X86_64_OUTDIR)/$(TARGET)_x86_64.map |
69 ARM_LDFLAGS ?= -Wl,-Map,$(ARM_OUTDIR)/$(TARGET)_arm.map | 71 ARM_LDFLAGS ?= -Wl,-Map,$(ARM_OUTDIR)/$(TARGET)_arm.map |
70 endif | 72 endif |
71 | 73 |
| 74 # |
| 75 # Choose between static and dynamic linking for Bionic |
| 76 # (Default to dynamic) |
| 77 # |
| 78 ifeq ($(TOOLCHAIN),bionic) |
| 79 ifeq (,$(BIONIC_USE_DYNAMIC)) |
| 80 BIONIC_LINK:=-static |
| 81 else |
| 82 BIONIC_LINK:=-Wl,-Ttext-segment=0x100000 |
| 83 endif |
| 84 endif |
| 85 |
72 LDFLAGS_SHARED = -shared | 86 LDFLAGS_SHARED = -shared |
73 | 87 |
74 # | 88 # |
75 # Compile Macro | 89 # Compile Macro |
76 # | 90 # |
77 # $1 = Source name | 91 # $1 = Source name |
78 # $2 = Compiler flags | 92 # $2 = Compiler flags |
79 # | 93 # |
80 define C_COMPILER_RULE | 94 define C_COMPILER_RULE |
81 -include $(call SRC_TO_DEP,$(1),_x86_32) | 95 -include $(call SRC_TO_DEP,$(1),_x86_32) |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 $(call C_COMPILER_RULE,$(1),$(2) $(foreach inc,$(INC_PATHS),-I$(inc)) $(3)) | 167 $(call C_COMPILER_RULE,$(1),$(2) $(foreach inc,$(INC_PATHS),-I$(inc)) $(3)) |
154 else | 168 else |
155 $(call CXX_COMPILER_RULE,$(1),$(2) $(foreach inc,$(INC_PATHS),-I$(inc)) $(3)) | 169 $(call CXX_COMPILER_RULE,$(1),$(2) $(foreach inc,$(INC_PATHS),-I$(inc)) $(3)) |
156 endif | 170 endif |
157 endef | 171 endef |
158 | 172 |
159 # | 173 # |
160 # Determine which architectures to build for. The user can set NACL_ARCH or | 174 # Determine which architectures to build for. The user can set NACL_ARCH or |
161 # ARCHES in the environment to control this. | 175 # ARCHES in the environment to control this. |
162 # | 176 # |
163 VALID_ARCHES := x86_32 x86_64 arm | 177 ifneq ($(TOOLCHAIN),bionic) |
| 178 VALID_ARCHES := x86_32 x86_64 |
| 179 endif |
| 180 VALID_ARCHES += arm |
164 | 181 |
165 ifdef NACL_ARCH | 182 ifdef NACL_ARCH |
166 ifeq (,$(findstring $(NACL_ARCH),$(VALID_ARCHES))) | 183 ifeq (,$(findstring $(NACL_ARCH),$(VALID_ARCHES))) |
167 $(error Invalid arch specified in NACL_ARCH: $(NACL_ARCH). Valid values are: $(
VALID_ARCHES)) | 184 $(error Invalid arch specified in NACL_ARCH: $(NACL_ARCH). Valid values are: $(
VALID_ARCHES)) |
168 endif | 185 endif |
169 ARCHES = ${NACL_ARCH} | 186 ARCHES = ${NACL_ARCH} |
170 else | 187 else |
171 ARCHES ?= ${VALID_ARCHES} | 188 ARCHES ?= ${VALID_ARCHES} |
172 endif | 189 endif |
173 | 190 |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
337 $(X86_64_OUTDIR)/$(1)_x86_64.nexe: $(foreach src,$(2),$(call SRC_TO_OBJ,$(src),_
x86_64)) $(foreach dep,$(4),$(STAMPDIR)/$(dep).stamp) | 354 $(X86_64_OUTDIR)/$(1)_x86_64.nexe: $(foreach src,$(2),$(call SRC_TO_OBJ,$(src),_
x86_64)) $(foreach dep,$(4),$(STAMPDIR)/$(dep).stamp) |
338 $(MKDIR) -p $$(dir $$@) | 355 $(MKDIR) -p $$(dir $$@) |
339 $(call LOG,LINK,$$@,$(X86_64_LINK) -o $$@ $$(filter %.o,$$^) $(NACL_LDFL
AGS) $(X86_64_LDFLAGS) $(LDFLAGS) $(foreach path,$(6),-L$(path)/$(TOOLCHAIN)_x86
_64/$(CONFIG_DIR) -L$(path)/$(TOOLCHAIN)_x86_64/$(CONFIG)) $(foreach lib,$(3),-l
$(lib)) $(5)) | 356 $(call LOG,LINK,$$@,$(X86_64_LINK) -o $$@ $$(filter %.o,$$^) $(NACL_LDFL
AGS) $(X86_64_LDFLAGS) $(LDFLAGS) $(foreach path,$(6),-L$(path)/$(TOOLCHAIN)_x86
_64/$(CONFIG_DIR) -L$(path)/$(TOOLCHAIN)_x86_64/$(CONFIG)) $(foreach lib,$(3),-l
$(lib)) $(5)) |
340 $(call LOG,VALIDATE,$$@,$(NCVAL) $$@) | 357 $(call LOG,VALIDATE,$$@,$(NCVAL) $$@) |
341 endif | 358 endif |
342 | 359 |
343 ifneq (,$(findstring arm,$(ARCHES))) | 360 ifneq (,$(findstring arm,$(ARCHES))) |
344 all: $(ARM_OUTDIR)/$(1)_arm.nexe | 361 all: $(ARM_OUTDIR)/$(1)_arm.nexe |
345 $(ARM_OUTDIR)/$(1)_arm.nexe: $(foreach src,$(2),$(call SRC_TO_OBJ,$(src),_arm))
$(foreach dep,$(4),$(STAMPDIR)/$(dep).stamp) | 362 $(ARM_OUTDIR)/$(1)_arm.nexe: $(foreach src,$(2),$(call SRC_TO_OBJ,$(src),_arm))
$(foreach dep,$(4),$(STAMPDIR)/$(dep).stamp) |
346 $(MKDIR) -p $$(dir $$@) | 363 $(MKDIR) -p $$(dir $$@) |
347 » $(call LOG,LINK,$$@,$(ARM_LINK) -o $$@ $$(filter %.o,$$^) $(NACL_LDFLAGS
) $(ARM_LDFLAGS) $(LDFLAGS) $(foreach path,$(6),-L$(path)/$(TOOLCHAIN)_arm/$(CON
FIG_DIR) -L$(path)/$(TOOLCHAIN)_arm/$(CONFIG)) $(foreach lib,$(3),-l$(lib)) $(5)
) | 364 » $(call LOG,LINK,$$@,$(ARM_LINK) $(BIONIC_LINK) -o $$@ $$(filter %.o,$$^)
$(NACL_LDFLAGS) $(ARM_LDFLAGS) $(LDFLAGS) $(foreach path,$(6),-L$(path)/$(TOOLC
HAIN)_arm/$(CONFIG_DIR) -L$(path)/$(TOOLCHAIN)_arm/$(CONFIG)) $(foreach lib,$(3)
,-l$(lib)) $(5)) |
348 $(call LOG,VALIDATE,$$@,$(NCVAL) $$@) | 365 $(call LOG,VALIDATE,$$@,$(NCVAL) $$@) |
349 endif | 366 endif |
350 endef | 367 endef |
351 | 368 |
352 | 369 |
353 # | 370 # |
354 # Generalized Link Macro | 371 # Generalized Link Macro |
355 # | 372 # |
356 # $1 = Target name | 373 # $1 = Target name |
357 # $2 = List of source files | 374 # $2 = List of source files |
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
595 $(error Cannot run in sel_ldr unless $$NACL_ARCH is set) | 612 $(error Cannot run in sel_ldr unless $$NACL_ARCH is set) |
596 endif | 613 endif |
597 $(SEL_LDR_PATH) $(SEL_LDR_ARGS) $(OUTDIR)/$(TARGET)_$(NACL_ARCH).nexe --
$(EXE_ARGS) | 614 $(SEL_LDR_PATH) $(SEL_LDR_ARGS) $(OUTDIR)/$(TARGET)_$(NACL_ARCH).nexe --
$(EXE_ARGS) |
598 | 615 |
599 debug: all | 616 debug: all |
600 ifndef NACL_ARCH | 617 ifndef NACL_ARCH |
601 $(error Cannot run in sel_ldr unless $$NACL_ARCH is set) | 618 $(error Cannot run in sel_ldr unless $$NACL_ARCH is set) |
602 endif | 619 endif |
603 $(SEL_LDR_PATH) -d $(SEL_LDR_ARGS) $(OUTDIR)/$(TARGET)_$(NACL_ARCH).nexe
-- $(EXE_ARGS) | 620 $(SEL_LDR_PATH) -d $(SEL_LDR_ARGS) $(OUTDIR)/$(TARGET)_$(NACL_ARCH).nexe
-- $(EXE_ARGS) |
604 endif | 621 endif |
OLD | NEW |