Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(413)

Side by Side Diff: native_client_sdk/src/tools/host_gcc.mk

Issue 886583004: [NaCl SDK] Allow dsc files to omit TOOLS setting (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « native_client_sdk/src/tools/common.mk ('k') | native_client_sdk/src/tools/nacl_gcc.mk » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 # 11 #
12 # Macros for TOOLS 12 # Macros for TOOLS
13 # 13 #
14 # We use the C++ compiler for everything and then use the -Wl,-as-needed flag 14 # We use the C++ compiler for everything and then use the -Wl,-as-needed flag
15 # in the linker to drop libc++ unless it's actually needed. 15 # in the linker to drop libc++ unless it's actually needed.
16 # 16 #
17 CC ?= $(NACL_COMPILER_PREFIX) gcc 17 CC ?= $(NACL_COMPILER_PREFIX) gcc
18 CXX ?= $(NACL_COMPILER_PREFIX) g++ 18 CXX ?= $(NACL_COMPILER_PREFIX) g++
19 LINK ?= $(CXX) 19 LINK ?= $(CXX)
20 LIB ?= ar 20 AR ?= ar
21 ARFLAGS = -crs
21 STRIP ?= strip 22 STRIP ?= strip
22 23
24
25 ifneq ($(OSNAME),mac)
23 # Adding -Wl,-Bsymbolic means that symbols defined within the module are always 26 # Adding -Wl,-Bsymbolic means that symbols defined within the module are always
24 # used by the moulde, and not shadowed by symbols already loaded in, for 27 # used by the module, and not shadowed by symbols already loaded in, for
25 # exmaple, libc. Without this the libc symbols (or anything injected with 28 # exmaple, libc. Without this the libc symbols (or anything injected with
26 # LD_PRELOAD will take precedence). 29 # LD_PRELOAD will take precedence).
27 HOST_LDFLAGS ?= -Wl,-Map,$(OUTDIR)/$(TARGET).map -Wl,-Bsymbolic 30 # -pthread is not needed on mac (libpthread is a symlink to libSystem) and
31 # in fact generated a warning if passed at link time.
32 HOST_LDFLAGS ?= -Wl,-Map,$(OUTDIR)/$(TARGET).map -Wl,-Bsymbolic -pthread
33 else
34 HOST_LDFLAGS ?= -Wl,-map -Wl,$(OUTDIR)/$(TARGET).map
35 endif
36
28 37
29 ifeq (,$(findstring gcc,$(shell $(WHICH) gcc))) 38 ifeq (,$(findstring gcc,$(shell $(WHICH) gcc)))
30 $(warning To skip the host build use:) 39 $(warning To skip the host build use:)
31 $(warning "make all_versions NO_HOST_BUILDS=1") 40 $(warning "make all_versions NO_HOST_BUILDS=1")
32 $(error Unable to find gcc in PATH while building Host build) 41 $(error Unable to find gcc in PATH while building Host build)
33 endif 42 endif
34 43
35 HOST_WARNINGS ?= -Wno-long-long -Wall -Werror 44 HOST_WARNINGS ?= -Wno-long-long -Wall -Werror
36 HOST_CFLAGS = -fPIC -pthread $(HOST_WARNINGS) -I$(NACL_SDK_ROOT)/include -I$(NAC L_SDK_ROOT)/include/linux 45 HOST_CFLAGS = -fPIC -pthread $(HOST_WARNINGS) -I$(NACL_SDK_ROOT)/include -I$(NAC L_SDK_ROOT)/include/linux
37 46
38 47
39 # 48 #
40 # Individual Macros 49 # Individual Macros
41 # 50 #
42 # $1 = Source Name 51 # $1 = Source Name
43 # $2 = Compile Flags 52 # $2 = Compile Flags
44 # 53 #
45 define C_COMPILER_RULE 54 define C_COMPILER_RULE
46 -include $(call SRC_TO_DEP,$(1)) 55 -include $(call SRC_TO_DEP,$(1))
47 $(call SRC_TO_OBJ,$(1)): $(1) $(TOP_MAKE) | $(dir $(call SRC_TO_OBJ,$(1)))dir.st amp 56 $(call SRC_TO_OBJ,$(1)): $(1) $(TOP_MAKE) | $(dir $(call SRC_TO_OBJ,$(1)))dir.st amp
48 » $(call LOG,CC ,$$@,$(CC) -o $$@ -c $$< -fPIC $(POSIX_FLAGS) $(HOST_CFLA GS) $(2)) 57 » $(call LOG,CC ,$$@,$(CC) -o $$@ -c $$< -fPIC $(POSIX_CFLAGS) $(HOST_CFL AGS) $(2))
49 @$(FIXDEPS) $(call SRC_TO_DEP_PRE_FIXUP,$(1)) 58 @$(FIXDEPS) $(call SRC_TO_DEP_PRE_FIXUP,$(1))
50 endef 59 endef
51 60
52 define CXX_COMPILER_RULE 61 define CXX_COMPILER_RULE
53 -include $(call SRC_TO_DEP,$(1)) 62 -include $(call SRC_TO_DEP,$(1))
54 $(call SRC_TO_OBJ,$(1)): $(1) $(TOP_MAKE) | $(dir $(call SRC_TO_OBJ,$(1)))dir.st amp 63 $(call SRC_TO_OBJ,$(1)): $(1) $(TOP_MAKE) | $(dir $(call SRC_TO_OBJ,$(1)))dir.st amp
55 » $(call LOG,CXX ,$$@,$(CXX) -o $$@ -c $$< -fPIC $(POSIX_FLAGS) $(HOST_CFL AGS) $(2)) 64 » $(call LOG,CXX ,$$@,$(CXX) -o $$@ -c $$< -fPIC $(POSIX_CFLAGS) $(HOST_CF LAGS) $(2))
56 @$(FIXDEPS) $(call SRC_TO_DEP_PRE_FIXUP,$(1)) 65 @$(FIXDEPS) $(call SRC_TO_DEP_PRE_FIXUP,$(1))
57 endef 66 endef
58 67
59 # 68 #
60 # Compile Macro 69 # Compile Macro
61 # 70 #
62 # $1 = Source Name 71 # $1 = Source Name
63 # $2 = POSIX Compile Flags 72 # $2 = POSIX Compile Flags
64 # $3 = VC Flags (unused) 73 # $3 = VC Flags (unused)
65 # 74 #
(...skipping 26 matching lines...) Expand all
92 # 101 #
93 # 102 #
94 define LIB_RULE 103 define LIB_RULE
95 $(STAMPDIR)/$(1).stamp: $(LIBDIR)/$(OSNAME)_host/$(CONFIG)/lib$(1).a 104 $(STAMPDIR)/$(1).stamp: $(LIBDIR)/$(OSNAME)_host/$(CONFIG)/lib$(1).a
96 @echo "TOUCHED $$@" > $(STAMPDIR)/$(1).stamp 105 @echo "TOUCHED $$@" > $(STAMPDIR)/$(1).stamp
97 106
98 all: $(LIBDIR)/$(OSNAME)_host/$(CONFIG)/lib$(1).a 107 all: $(LIBDIR)/$(OSNAME)_host/$(CONFIG)/lib$(1).a
99 $(LIBDIR)/$(OSNAME)_host/$(CONFIG)/lib$(1).a: $(foreach src,$(2),$(call SRC_TO_O BJ,$(src))) 108 $(LIBDIR)/$(OSNAME)_host/$(CONFIG)/lib$(1).a: $(foreach src,$(2),$(call SRC_TO_O BJ,$(src)))
100 $(MKDIR) -p $$(dir $$@) 109 $(MKDIR) -p $$(dir $$@)
101 $(RM) -f $$@ 110 $(RM) -f $$@
102 » $(call LOG,LIB,$$@,$(LIB) -cr $$@ $$^) 111 » $(call LOG,LIB,$$@,$(AR) $(ARFLAGS) $$@ $$^)
103 endef 112 endef
104 113
105 114
106 # 115 #
107 # Link Macro 116 # Link Macro
108 # 117 #
109 # $1 = Target Name 118 # $1 = Target Name
110 # $2 = List of inputs 119 # $2 = List of inputs
111 # $3 = List of libs 120 # $3 = List of libs
112 # $4 = List of deps 121 # $4 = List of deps
113 # $5 = List of lib dirs 122 # $5 = List of lib dirs
114 # $6 = Linker Args 123 # $6 = Linker Args
115 # 124 #
116 ifdef STANDALONE 125 ifdef STANDALONE
117 define LINKER_RULE 126 define LINKER_RULE
118 all: $(1) 127 all: $(1)
119 $(1): $(2) $(foreach dep,$(4),$(STAMPDIR)/$(dep).stamp) 128 $(1): $(2) $(foreach dep,$(4),$(STAMPDIR)/$(dep).stamp)
120 » $(call LOG,LINK,$$@,$(LINK) -o $(1) $(2) $(HOST_LDFLAGS) $(NACL_LDFLAGS) $(LDFLAGS) $(foreach path,$(5),-L$(path)/$(OSNAME)_host)/$(CONFIG) $(foreach li b,$(3),-l$(lib)) $(6)) 129 » $(call LOG,LINK,$$@,$(LINK) -o $(1) $(2) $(HOST_LDFLAGS) $(LDFLAGS) $(fo reach path,$(5),-L$(path)/$(OSNAME)_host)/$(CONFIG) $(foreach lib,$(3),-l$(lib)) $(6))
121 endef 130 endef
122 else 131 else
123 define LINKER_RULE 132 define LINKER_RULE
124 all: $(1) 133 all: $(1)
125 $(1): $(2) $(foreach dep,$(4),$(STAMPDIR)/$(dep).stamp) 134 $(1): $(2) $(foreach dep,$(4),$(STAMPDIR)/$(dep).stamp)
126 » $(call LOG,LINK,$$@,$(LINK) -shared -o $(1) $(2) $(HOST_LDFLAGS) $(NACL_ LDFLAGS) $(LDFLAGS) $(foreach path,$(5),-L$(path)/$(OSNAME)_host)/$(CONFIG) $(fo reach lib,$(3),-l$(lib)) $(6)) 135 » $(call LOG,LINK,$$@,$(LINK) -shared -o $(1) $(2) $(HOST_LDFLAGS) $(LDFLA GS) $(foreach path,$(5),-L$(path)/$(OSNAME)_host)/$(CONFIG) $(foreach lib,$(3),- l$(lib)) $(6))
127 endef 136 endef
128 endif 137 endif
129 138
130 139
131 # 140 #
132 # Link Macro 141 # Link Macro
133 # 142 #
134 # $1 = Target Name 143 # $1 = Target Name
135 # $2 = List of Sources 144 # $2 = List of Sources
136 # $3 = List of LIBS 145 # $3 = List of LIBS
137 # $4 = List of DEPS 146 # $4 = List of DEPS
138 # $5 = POSIX Linker Switches 147 # $5 = POSIX Linker Switches
139 # $6 = VC Linker Switches 148 # $6 = VC Linker Switches
140 # 149 #
141 define LINK_RULE 150 define LINK_RULE
142 $(call LINKER_RULE,$(OUTDIR)/$(1)$(HOST_EXT),$(foreach src,$(2),$(call SRC_TO_OB J,$(src))),$(filter-out pthread,$(3)),$(4),$(LIB_PATHS),$(5)) 151 $(call LINKER_RULE,$(OUTDIR)/$(1)$(HOST_EXT),$(foreach src,$(2),$(call SRC_TO_OB J,$(src))),$(filter-out pthread,$(3)),$(4),$(LIB_PATHS),$(5))
143 endef 152 endef
144 153
145 all: $(LIB_LIST) $(DEPS_LIST) 154 all: $(LIB_LIST) $(DEPS_LIST)
146 155
147 156
148 # 157 #
149 # Strip Macro 158 # Strip Macro
150 # The host build makes shared libraries, so the best we can do is strip-debug. 159 # The host build makes shared libraries, so the best we can do is -S, which
151 # We cannot strip the symbol names. 160 # only strip debug symbols. We don't strip the symbol names.
152 # 161 #
153 # $1 = Target Name 162 # $1 = Target Name
154 # $2 = Input Name 163 # $2 = Input Name
155 # 164 #
156 define STRIP_RULE 165 define STRIP_RULE
157 all: $(OUTDIR)/$(1)$(HOST_EXT) 166 all: $(OUTDIR)/$(1)$(HOST_EXT)
158 $(OUTDIR)/$(1)$(HOST_EXT): $(OUTDIR)/$(2)$(HOST_EXT) 167 $(OUTDIR)/$(1)$(HOST_EXT): $(OUTDIR)/$(2)$(HOST_EXT)
159 » $(call LOG,STRIP,$$@,$(STRIP) --strip-debug -o $$@ $$^) 168 » $(call LOG,STRIP,$$@,$(STRIP) -S -o $$@ $$^)
160 endef 169 endef
161 170
162 171
163 # 172 #
164 # Run standalone builds (command line builds outside of chrome) 173 # Run standalone builds (command line builds outside of chrome)
165 # 174 #
166 ifdef STANDALONE 175 ifdef STANDALONE
167 run: all 176 run: all
168 $(RUN_UNDER) $(OUTDIR)/$(TARGET)$(HOST_EXT) $(EXE_ARGS) 177 $(RUN_UNDER) $(OUTDIR)/$(TARGET)$(HOST_EXT) $(EXE_ARGS)
169 endif 178 endif
OLDNEW
« no previous file with comments | « native_client_sdk/src/tools/common.mk ('k') | native_client_sdk/src/tools/nacl_gcc.mk » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698