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