| OLD | NEW |
| 1 #!/usr/bin/python | 1 #!/usr/bin/python |
| 2 | 2 |
| 3 # Copyright (c) 2009 Google Inc. All rights reserved. | 3 # Copyright (c) 2009 Google Inc. All rights reserved. |
| 4 # Use of this source code is governed by a BSD-style license that can be | 4 # Use of this source code is governed by a BSD-style license that can be |
| 5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
| 6 | 6 |
| 7 # Notes: | 7 # Notes: |
| 8 # | 8 # |
| 9 # This is all roughly based on the Makefile system used by the Linux | 9 # This is all roughly based on the Makefile system used by the Linux |
| 10 # kernel, but is a non-recursive make -- we put the entire dependency | 10 # kernel, but is a non-recursive make -- we put the entire dependency |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 # C++ apps need to be linked with g++. Not sure what's appropriate. | 100 # C++ apps need to be linked with g++. Not sure what's appropriate. |
| 101 LINK ?= $(CXX) | 101 LINK ?= $(CXX) |
| 102 | 102 |
| 103 # We want to use GNU ar's T option if available because it's much faster. | 103 # We want to use GNU ar's T option if available because it's much faster. |
| 104 # We try to archive and link a file to see ar and ld support this feature. | 104 # We try to archive and link a file to see ar and ld support this feature. |
| 105 define detect_arflags | 105 define detect_arflags |
| 106 $(shell \ | 106 $(shell \ |
| 107 mkdir -p $(obj).$(1)/arflags; | 107 mkdir -p $(obj).$(1)/arflags; |
| 108 if echo 'int main(){}' > $(obj).$(1)/arflags/artest.c && | 108 if echo 'int main(){}' > $(obj).$(1)/arflags/artest.c && |
| 109 $(CXX.$(1)) -c $(obj).$(1)/arflags/artest.c -o $(obj).$(1)/arflags/artest
.o> /dev/null 2>&1 && | 109 $(CXX.$(1)) -c $(obj).$(1)/arflags/artest.c -o $(obj).$(1)/arflags/artest
.o> /dev/null 2>&1 && |
| 110 $(AR.$(1)) crT $(obj).$(1)/arflags/artest.a $(obj).$(1)/arflags/artest.o
> /dev/null 2>&1 && | 110 $(AR.$(1)) crsT $(obj).$(1)/arflags/artest.a $(obj).$(1)/arflags/artest.o
> /dev/null 2>&1 && |
| 111 $(LINK.$(1)) $(obj).$(1)/arflags/artest.a -o $(obj).$(1)/arflags/artest >
/dev/null 2>&1 ; then | 111 $(LINK.$(1)) $(obj).$(1)/arflags/artest.a -o $(obj).$(1)/arflags/artest >
/dev/null 2>&1 ; then |
| 112 arflags=crT; | 112 arflags=crsT; |
| 113 else | 113 else |
| 114 arflags=cr; | 114 arflags=crs; |
| 115 fi; | 115 fi; |
| 116 echo ARFLAGS.$(1) := $$arflags > $(obj).$(1)/arflags/arflags.mk; | 116 echo ARFLAGS.$(1) := $$arflags > $(obj).$(1)/arflags/arflags.mk; |
| 117 echo $$arflags; | 117 echo $$arflags; |
| 118 ) | 118 ) |
| 119 endef | 119 endef |
| 120 | 120 |
| 121 CC.target ?= $(CC) | 121 CC.target ?= $(CC) |
| 122 CFLAGS.target ?= $(CFLAGS) | 122 CFLAGS.target ?= $(CFLAGS) |
| 123 CXX.target ?= $(CXX) | 123 CXX.target ?= $(CXX) |
| 124 CXXFLAGS.target ?= $(CXXFLAGS) | 124 CXXFLAGS.target ?= $(CXXFLAGS) |
| 125 LINK.target ?= $(LINK) | 125 LINK.target ?= $(LINK) |
| 126 LDFLAGS.target ?= $(LDFLAGS) | 126 LDFLAGS.target ?= $(LDFLAGS) |
| 127 AR.target ?= $(AR) | 127 AR.target ?= $(AR) |
| 128 # We don't want to run the detection multiple times. So, we | 128 # We don't want to run the detection multiple times. So, we |
| 129 # - use $(obj).target/arflags/arflags.target.mk as the cache of the detection, | 129 # - use $(obj).target/arflags/arflags.target.mk as the cache of the detection, |
| 130 # - use := to avoid the right hand side multiple times, and | 130 # - use := to avoid the right hand side multiple times, and |
| 131 # - use ifeq instead of ?= because ?= is like ifeq and =, not ifeq and := . | 131 # - use ifeq instead of ?= because ?= is like ifeq and =, not ifeq and := . |
| 132 -include $(obj).target/arflags/arflags.mk | 132 -include $(obj).target/arflags/arflags.mk |
| 133 ifeq ($(ARFLAGS.target),) | 133 ifeq ($(ARFLAGS.target),) |
| 134 ARFLAGS.target := $(call detect_arflags,target) | 134 ARFLAGS.target := $(call detect_arflags,target) |
| 135 endif | 135 endif |
| 136 RANLIB.target ?= ranlib | |
| 137 | 136 |
| 138 CC.host ?= gcc | 137 CC.host ?= gcc |
| 139 CFLAGS.host ?= | 138 CFLAGS.host ?= |
| 140 CXX.host ?= g++ | 139 CXX.host ?= g++ |
| 141 CXXFLAGS.host ?= | 140 CXXFLAGS.host ?= |
| 142 LINK.host ?= g++ | 141 LINK.host ?= g++ |
| 143 LDFLAGS.host ?= | 142 LDFLAGS.host ?= |
| 144 AR.host ?= ar | 143 AR.host ?= ar |
| 145 # See the description for ARFLAGS.target. | 144 # See the description for ARFLAGS.target. |
| 146 -include $(obj).host/arflags/arflags.mk | 145 -include $(obj).host/arflags/arflags.mk |
| 147 ifeq ($(ARFLAGS.host),) | 146 ifeq ($(ARFLAGS.host),) |
| 148 ARFLAGS.host := $(call detect_arflags,host) | 147 ARFLAGS.host := $(call detect_arflags,host) |
| 149 endif | 148 endif |
| 150 RANLIB.host ?= ranlib | |
| 151 | 149 |
| 152 # Flags to make gcc output dependency info. Note that you need to be | 150 # Flags to make gcc output dependency info. Note that you need to be |
| 153 # careful here to use the flags that ccache and distcc can understand. | 151 # careful here to use the flags that ccache and distcc can understand. |
| 154 # We write to a dep file on the side first and then rename at the end | 152 # We write to a dep file on the side first and then rename at the end |
| 155 # so we can't end up with a broken dep file. | 153 # so we can't end up with a broken dep file. |
| 156 depfile = $(depsdir)/$@.d | 154 depfile = $(depsdir)/$@.d |
| 157 DEPFLAGS = -MMD -MF $(depfile).raw | 155 DEPFLAGS = -MMD -MF $(depfile).raw |
| 158 | 156 |
| 159 # We have to fixup the deps output in a few ways. | 157 # We have to fixup the deps output in a few ways. |
| 160 # (1) the file output should mention the proper .o file. | 158 # (1) the file output should mention the proper .o file. |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 193 # Command definitions: | 191 # Command definitions: |
| 194 # - cmd_foo is the actual command to run; | 192 # - cmd_foo is the actual command to run; |
| 195 # - quiet_cmd_foo is the brief-output summary of the command. | 193 # - quiet_cmd_foo is the brief-output summary of the command. |
| 196 | 194 |
| 197 quiet_cmd_cc = CC($(TOOLSET)) $@ | 195 quiet_cmd_cc = CC($(TOOLSET)) $@ |
| 198 cmd_cc = $(CC.$(TOOLSET)) $(CFLAGS.$(TOOLSET)) $(GYP_CFLAGS) $(DEPFLAGS) -c -o $
@ $< | 196 cmd_cc = $(CC.$(TOOLSET)) $(CFLAGS.$(TOOLSET)) $(GYP_CFLAGS) $(DEPFLAGS) -c -o $
@ $< |
| 199 | 197 |
| 200 quiet_cmd_cxx = CXX($(TOOLSET)) $@ | 198 quiet_cmd_cxx = CXX($(TOOLSET)) $@ |
| 201 cmd_cxx = $(CXX.$(TOOLSET)) $(CXXFLAGS.$(TOOLSET)) $(GYP_CXXFLAGS) $(DEPFLAGS) -
c -o $@ $< | 199 cmd_cxx = $(CXX.$(TOOLSET)) $(CXXFLAGS.$(TOOLSET)) $(GYP_CXXFLAGS) $(DEPFLAGS) -
c -o $@ $< |
| 202 | 200 |
| 203 quiet_cmd_alink = AR+RANLIB($(TOOLSET)) $@ | 201 quiet_cmd_alink = AR($(TOOLSET)) $@ |
| 204 cmd_alink = rm -f $@ && $(AR.$(TOOLSET)) $(ARFLAGS.$(TOOLSET)) $@ $(filter %.o,$
^) && $(RANLIB.$(TOOLSET)) $@ | 202 cmd_alink = rm -f $@ && $(AR.$(TOOLSET)) $(ARFLAGS.$(TOOLSET)) $@ $(filter %.o,$
^) |
| 205 | 203 |
| 206 quiet_cmd_touch = TOUCH $@ | 204 quiet_cmd_touch = TOUCH $@ |
| 207 cmd_touch = touch $@ | 205 cmd_touch = touch $@ |
| 208 | 206 |
| 209 quiet_cmd_copy = COPY $@ | 207 quiet_cmd_copy = COPY $@ |
| 210 # send stderr to /dev/null to ignore messages when linking directories. | 208 # send stderr to /dev/null to ignore messages when linking directories. |
| 211 cmd_copy = ln -f $< $@ 2>/dev/null || cp -af $< $@ | 209 cmd_copy = ln -f $< $@ 2>/dev/null || cp -af $< $@ |
| 212 | 210 |
| 213 # Due to circular dependencies between libraries :(, we wrap the | 211 # Due to circular dependencies between libraries :(, we wrap the |
| 214 # special "figure out circular dependencies" flags around the entire | 212 # special "figure out circular dependencies" flags around the entire |
| (...skipping 1093 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1308 makefile_name, | 1306 makefile_name, |
| 1309 ' '.join(map(Sourceify, build_files)), | 1307 ' '.join(map(Sourceify, build_files)), |
| 1310 gyp.common.EncodePOSIXShellList( | 1308 gyp.common.EncodePOSIXShellList( |
| 1311 [gyp_binary, '-fmake'] + | 1309 [gyp_binary, '-fmake'] + |
| 1312 gyp.RegenerateFlags(options) + | 1310 gyp.RegenerateFlags(options) + |
| 1313 build_files_args))) | 1311 build_files_args))) |
| 1314 | 1312 |
| 1315 root_makefile.write(SHARED_FOOTER) | 1313 root_makefile.write(SHARED_FOOTER) |
| 1316 | 1314 |
| 1317 root_makefile.close() | 1315 root_makefile.close() |
| OLD | NEW |