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

Side by Side Diff: pylib/gyp/generator/make.py

Issue 11031005: Add "standalone_static_library" flag (Closed) Base URL: http://gyp.googlecode.com/svn/trunk/
Patch Set: Created 8 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | 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 Google Inc. All rights reserved. 1 # Copyright (c) 2012 Google Inc. 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 # Notes: 5 # Notes:
6 # 6 #
7 # This is all roughly based on the Makefile system used by the Linux 7 # This is all roughly based on the Makefile system used by the Linux
8 # kernel, but is a non-recursive make -- we put the entire dependency 8 # kernel, but is a non-recursive make -- we put the entire dependency
9 # graph in front of make and let it figure it out. 9 # graph in front of make and let it figure it out.
10 # 10 #
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 # file for 118 # file for
119 # Chromium\ Framework.framework/foo 119 # Chromium\ Framework.framework/foo
120 # is for example 120 # is for example
121 # out/Release/.deps/out/Release/Chromium?Framework.framework/foo 121 # out/Release/.deps/out/Release/Chromium?Framework.framework/foo
122 # This is the replacement character. 122 # This is the replacement character.
123 SPACE_REPLACEMENT = '?' 123 SPACE_REPLACEMENT = '?'
124 124
125 125
126 LINK_COMMANDS_LINUX = """\ 126 LINK_COMMANDS_LINUX = """\
127 quiet_cmd_alink = AR($(TOOLSET)) $@ 127 quiet_cmd_alink = AR($(TOOLSET)) $@
128 cmd_alink = rm -f $@ && $(AR.$(TOOLSET)) crsT $@ $(filter %.o,$^) 128 cmd_alink = rm -f $@ && $(AR.$(TOOLSET)) $(ARFLAGS.$(TOOLSET)) $@ $(filter %.o,$ ^)
129 129
130 # Due to circular dependencies between libraries :(, we wrap the 130 # Due to circular dependencies between libraries :(, we wrap the
131 # special "figure out circular dependencies" flags around the entire 131 # special "figure out circular dependencies" flags around the entire
132 # input list during linking. 132 # input list during linking.
133 quiet_cmd_link = LINK($(TOOLSET)) $@ 133 quiet_cmd_link = LINK($(TOOLSET)) $@
134 cmd_link = $(LINK.$(TOOLSET)) $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -o $@ -Wl,--s tart-group $(LD_INPUTS) -Wl,--end-group $(LIBS) 134 cmd_link = $(LINK.$(TOOLSET)) $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -o $@ -Wl,--s tart-group $(LD_INPUTS) -Wl,--end-group $(LIBS)
135 135
136 # We support two kinds of shared objects (.so): 136 # We support two kinds of shared objects (.so):
137 # 1) shared_library, which is just bundling together many dependent libraries 137 # 1) shared_library, which is just bundling together many dependent libraries
138 # into a link line. 138 # into a link line.
(...skipping 30 matching lines...) Expand all
169 cmd_solink = $(LINK.$(TOOLSET)) -shared $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -o "$@" $(LD_INPUTS) $(LIBS) 169 cmd_solink = $(LINK.$(TOOLSET)) -shared $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -o "$@" $(LD_INPUTS) $(LIBS)
170 170
171 # TODO(thakis): The solink_module rule is likely wrong. Xcode seems to pass 171 # TODO(thakis): The solink_module rule is likely wrong. Xcode seems to pass
172 # -bundle -single_module here (for osmesa.so). 172 # -bundle -single_module here (for osmesa.so).
173 quiet_cmd_solink_module = SOLINK_MODULE($(TOOLSET)) $@ 173 quiet_cmd_solink_module = SOLINK_MODULE($(TOOLSET)) $@
174 cmd_solink_module = $(LINK.$(TOOLSET)) -shared $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSE T)) -o $@ $(filter-out FORCE_DO_CMD, $^) $(LIBS) 174 cmd_solink_module = $(LINK.$(TOOLSET)) -shared $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSE T)) -o $@ $(filter-out FORCE_DO_CMD, $^) $(LIBS)
175 """ 175 """
176 176
177 LINK_COMMANDS_ANDROID = """\ 177 LINK_COMMANDS_ANDROID = """\
178 quiet_cmd_alink = AR($(TOOLSET)) $@ 178 quiet_cmd_alink = AR($(TOOLSET)) $@
179 cmd_alink = rm -f $@ && $(AR.$(TOOLSET)) crsT $@ $(filter %.o,$^) 179 cmd_alink = rm -f $@ && $(AR.$(TOOLSET)) $(ARFLAGS.$(TOOLSET)) $@ $(filter %.o,$ ^)
180 180
181 # Due to circular dependencies between libraries :(, we wrap the 181 # Due to circular dependencies between libraries :(, we wrap the
182 # special "figure out circular dependencies" flags around the entire 182 # special "figure out circular dependencies" flags around the entire
183 # input list during linking. 183 # input list during linking.
184 quiet_cmd_link = LINK($(TOOLSET)) $@ 184 quiet_cmd_link = LINK($(TOOLSET)) $@
185 quiet_cmd_link_host = LINK($(TOOLSET)) $@ 185 quiet_cmd_link_host = LINK($(TOOLSET)) $@
186 cmd_link = $(LINK.$(TOOLSET)) $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -o $@ -Wl,--s tart-group $(LD_INPUTS) -Wl,--end-group $(LIBS) 186 cmd_link = $(LINK.$(TOOLSET)) $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -o $@ -Wl,--s tart-group $(LD_INPUTS) -Wl,--end-group $(LIBS)
187 cmd_link_host = $(LINK.$(TOOLSET)) $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -o $@ $( LD_INPUTS) $(LIBS) 187 cmd_link_host = $(LINK.$(TOOLSET)) $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -o $@ $( LD_INPUTS) $(LIBS)
188 188
189 # Other shared-object link notes: 189 # Other shared-object link notes:
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 # This will allow make to invoke N linker processes as specified in -jN. 255 # This will allow make to invoke N linker processes as specified in -jN.
256 LINK ?= %(flock)s $(builddir)/linker.lock $(CXX) 256 LINK ?= %(flock)s $(builddir)/linker.lock $(CXX)
257 257
258 CC.target ?= %(CC.target)s 258 CC.target ?= %(CC.target)s
259 CFLAGS.target ?= $(CFLAGS) 259 CFLAGS.target ?= $(CFLAGS)
260 CXX.target ?= %(CXX.target)s 260 CXX.target ?= %(CXX.target)s
261 CXXFLAGS.target ?= $(CXXFLAGS) 261 CXXFLAGS.target ?= $(CXXFLAGS)
262 LINK.target ?= %(LINK.target)s 262 LINK.target ?= %(LINK.target)s
263 LDFLAGS.target ?= $(LDFLAGS) 263 LDFLAGS.target ?= $(LDFLAGS)
264 AR.target ?= $(AR) 264 AR.target ?= $(AR)
265 ARFLAGS.target ?= %(ARFLAGS.target)s
265 266
266 # TODO(evan): move all cross-compilation logic to gyp-time so we don't need 267 # TODO(evan): move all cross-compilation logic to gyp-time so we don't need
267 # to replicate this environment fallback in make as well. 268 # to replicate this environment fallback in make as well.
268 CC.host ?= %(CC.host)s 269 CC.host ?= %(CC.host)s
269 CFLAGS.host ?= 270 CFLAGS.host ?=
270 CXX.host ?= %(CXX.host)s 271 CXX.host ?= %(CXX.host)s
271 CXXFLAGS.host ?= 272 CXXFLAGS.host ?=
272 LINK.host ?= %(LINK.host)s 273 LINK.host ?= %(LINK.host)s
273 LDFLAGS.host ?= 274 LDFLAGS.host ?=
274 AR.host ?= %(AR.host)s 275 AR.host ?= %(AR.host)s
276 ARFLAGS.host ?= %(ARFLAGS.host)s
275 277
276 # Define a dir function that can handle spaces. 278 # Define a dir function that can handle spaces.
277 # http://www.gnu.org/software/make/manual/make.html#Syntax-of-Functions 279 # http://www.gnu.org/software/make/manual/make.html#Syntax-of-Functions
278 # "leading spaces cannot appear in the text of the first argument as written. 280 # "leading spaces cannot appear in the text of the first argument as written.
279 # These characters can be put into the argument value by variable substitution." 281 # These characters can be put into the argument value by variable substitution."
280 empty := 282 empty :=
281 space := $(empty) $(empty) 283 space := $(empty) $(empty)
282 284
283 # http://stackoverflow.com/questions/1189781/using-make-dir-or-notdir-on-a-path- with-spaces 285 # http://stackoverflow.com/questions/1189781/using-make-dir-or-notdir-on-a-path- with-spaces
284 replace_spaces = $(subst $(space),""" + SPACE_REPLACEMENT + """,$1) 286 replace_spaces = $(subst $(space),""" + SPACE_REPLACEMENT + """,$1)
(...skipping 1696 matching lines...) Expand 10 before | Expand all | Expand 10 after
1981 header_params.update({ 1983 header_params.update({
1982 'flock': './gyp-sun-tool flock', 1984 'flock': './gyp-sun-tool flock',
1983 'flock_index': 2, 1985 'flock_index': 2,
1984 'extra_commands': SHARED_HEADER_SUN_COMMANDS, 1986 'extra_commands': SHARED_HEADER_SUN_COMMANDS,
1985 }) 1987 })
1986 elif flavor == 'freebsd': 1988 elif flavor == 'freebsd':
1987 header_params.update({ 1989 header_params.update({
1988 'flock': 'lockf', 1990 'flock': 'lockf',
1989 }) 1991 })
1990 1992
1993 if generator_flags.get('fat_static_libraries', False):
Ryan Sleevi 2012/10/01 17:39:54 random drive by: If you're going to go through the
borenet 2012/10/01 18:07:10 This is what I was contemplating in my comment; it
1994 arflags_linux = 'crs'
1995 else:
1996 arflags_linux = 'crsT'
1997 header_params.update({
1998 'ARFLAGS.target': arflags_linux,
1999 'ARFLAGS.host': arflags_linux,
2000 })
2001
1991 header_params.update({ 2002 header_params.update({
1992 'CC.target': GetEnvironFallback(('CC_target', 'CC'), '$(CC)'), 2003 'CC.target': GetEnvironFallback(('CC_target', 'CC'), '$(CC)'),
1993 'AR.target': GetEnvironFallback(('AR_target', 'AR'), '$(AR)'), 2004 'AR.target': GetEnvironFallback(('AR_target', 'AR'), '$(AR)'),
1994 'CXX.target': GetEnvironFallback(('CXX_target', 'CXX'), '$(CXX)'), 2005 'CXX.target': GetEnvironFallback(('CXX_target', 'CXX'), '$(CXX)'),
1995 'LINK.target': GetEnvironFallback(('LD_target', 'LD'), '$(LINK)'), 2006 'LINK.target': GetEnvironFallback(('LD_target', 'LD'), '$(LINK)'),
1996 'CC.host': GetEnvironFallback(('CC_host',), 'gcc'), 2007 'CC.host': GetEnvironFallback(('CC_host',), 'gcc'),
1997 'AR.host': GetEnvironFallback(('AR_host',), 'ar'), 2008 'AR.host': GetEnvironFallback(('AR_host',), 'ar'),
1998 'CXX.host': GetEnvironFallback(('CXX_host',), 'g++'), 2009 'CXX.host': GetEnvironFallback(('CXX_host',), 'g++'),
1999 'LINK.host': GetEnvironFallback(('LD_host',), 'g++'), 2010 'LINK.host': GetEnvironFallback(('LD_host',), 'g++'),
2000 }) 2011 })
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
2127 root_makefile.write("endif\n") 2138 root_makefile.write("endif\n")
2128 root_makefile.write('\n') 2139 root_makefile.write('\n')
2129 2140
2130 if (not generator_flags.get('standalone') 2141 if (not generator_flags.get('standalone')
2131 and generator_flags.get('auto_regeneration', True)): 2142 and generator_flags.get('auto_regeneration', True)):
2132 WriteAutoRegenerationRule(params, root_makefile, makefile_name, build_files) 2143 WriteAutoRegenerationRule(params, root_makefile, makefile_name, build_files)
2133 2144
2134 root_makefile.write(SHARED_FOOTER) 2145 root_makefile.write(SHARED_FOOTER)
2135 2146
2136 root_makefile.close() 2147 root_makefile.close()
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698