Skip to content

Commit bbed1dd

Browse files
committed
---
yaml --- r: 5501 b: refs/heads/master c: 5f066e0 h: refs/heads/master i: 5499: 781b4a6 v: v3
1 parent 5b44dd5 commit bbed1dd

File tree

214 files changed

+30555
-7210
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

214 files changed

+30555
-7210
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
---
2-
refs/heads/master: d8f6e9f23736f6a12dfa028d22557d1360648234
2+
refs/heads/master: 5f066e06b991041f2c1d988f493d5b29f8e56b7e

trunk/.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ rustc
5252
TAGS
5353
version.ml
5454
version.texi
55-
Makefile
55+
./Makefile
5656
config.mk
5757
/rt/
5858
/rustllvm/

trunk/configure

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -406,8 +406,4 @@ done
406406

407407
copy ${CFG_SRC_DIR}Makefile.in ./Makefile
408408

409-
copy ${CFG_SRC_DIR}src/rt/libuv/Makefile rt/libuv/Makefile
410-
copy ${CFG_SRC_DIR}src/rt/libuv/config-unix.mk rt/libuv/config-unix.mk
411-
copy ${CFG_SRC_DIR}src/rt/libuv/config-mingw.mk rt/libuv/config-mingw.mk
412-
413409
step_msg "complete"

trunk/mk/clean.mk

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,3 +54,4 @@ clean:
5454
aux cp fn ky log pdf html pg toc tp vr cps, \
5555
$(wildcard doc/*.$(ext)))
5656
$(Q)rm -Rf doc/version.texi
57+
$(Q)rm -rf rt/libuv

trunk/mk/libuv/mac/Makefile

Lines changed: 359 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,359 @@
1+
# We borrow heavily from the kernel build setup, though we are simpler since
2+
# we don't have Kconfig tweaking settings on us.
3+
4+
# The implicit make rules have it looking for RCS files, among other things.
5+
# We instead explicitly write all the rules we care about.
6+
# It's even quicker (saves ~200ms) to pass -r on the command line.
7+
MAKEFLAGS=-r
8+
9+
# The source directory tree.
10+
srcdir := ../../..
11+
12+
# The name of the builddir.
13+
builddir_name ?= out
14+
15+
# The V=1 flag on command line makes us verbosely print command lines.
16+
ifdef V
17+
quiet=
18+
else
19+
quiet=quiet_
20+
endif
21+
22+
# Specify BUILDTYPE=Release on the command line for a release build.
23+
BUILDTYPE ?= Default
24+
25+
# Directory all our build output goes into.
26+
# Note that this must be two directories beneath src/ for unit tests to pass,
27+
# as they reach into the src/ directory for data with relative paths.
28+
builddir ?= $(builddir_name)/$(BUILDTYPE)
29+
abs_builddir := $(abspath $(builddir))
30+
depsdir := $(builddir)/.deps
31+
32+
# Object output directory.
33+
obj := $(builddir)/obj
34+
abs_obj := $(abspath $(obj))
35+
36+
# We build up a list of every single one of the targets so we can slurp in the
37+
# generated dependency rule Makefiles in one pass.
38+
all_deps :=
39+
40+
# C++ apps need to be linked with g++. Not sure what's appropriate.
41+
#
42+
# Note, the flock is used to seralize linking. Linking is a memory-intensive
43+
# process so running parallel links can often lead to thrashing. To disable
44+
# the serialization, override FLOCK via an envrionment variable as follows:
45+
#
46+
# export FLOCK=
47+
#
48+
# This will allow make to invoke N linker processes as specified in -jN.
49+
FLOCK ?= ./gyp-mac-tool flock $(builddir)/linker.lock
50+
51+
52+
53+
LINK ?= $(FLOCK) $(CXX)
54+
CC.target ?= $(CC)
55+
CFLAGS.target ?= $(CFLAGS)
56+
CXX.target ?= $(CXX)
57+
CXXFLAGS.target ?= $(CXXFLAGS)
58+
LINK.target ?= $(LINK)
59+
LDFLAGS.target ?= $(LDFLAGS)
60+
AR.target ?= $(AR)
61+
ARFLAGS.target ?= crs
62+
63+
# N.B.: the logic of which commands to run should match the computation done
64+
# in gyp's make.py where ARFLAGS.host etc. is computed.
65+
# TODO(evan): move all cross-compilation logic to gyp-time so we don't need
66+
# to replicate this environment fallback in make as well.
67+
CC.host ?= gcc
68+
CFLAGS.host ?=
69+
CXX.host ?= g++
70+
CXXFLAGS.host ?=
71+
LINK.host ?= g++
72+
LDFLAGS.host ?=
73+
AR.host ?= ar
74+
ARFLAGS.host := crs
75+
76+
# Define a dir function that can handle spaces.
77+
# http://www.gnu.org/software/make/manual/make.html#Syntax-of-Functions
78+
# "leading spaces cannot appear in the text of the first argument as written.
79+
# These characters can be put into the argument value by variable substitution."
80+
empty :=
81+
space := $(empty) $(empty)
82+
83+
# http://stackoverflow.com/questions/1189781/using-make-dir-or-notdir-on-a-path-with-spaces
84+
replace_spaces = $(subst $(space),?,$1)
85+
unreplace_spaces = $(subst ?,$(space),$1)
86+
dirx = $(call unreplace_spaces,$(dir $(call replace_spaces,$1)))
87+
88+
# Flags to make gcc output dependency info. Note that you need to be
89+
# careful here to use the flags that ccache and distcc can understand.
90+
# We write to a dep file on the side first and then rename at the end
91+
# so we can't end up with a broken dep file.
92+
depfile = $(depsdir)/$(call replace_spaces,$@).d
93+
DEPFLAGS = -MMD -MF $(depfile).raw
94+
95+
# We have to fixup the deps output in a few ways.
96+
# (1) the file output should mention the proper .o file.
97+
# ccache or distcc lose the path to the target, so we convert a rule of
98+
# the form:
99+
# foobar.o: DEP1 DEP2
100+
# into
101+
# path/to/foobar.o: DEP1 DEP2
102+
# (2) we want missing files not to cause us to fail to build.
103+
# We want to rewrite
104+
# foobar.o: DEP1 DEP2 \
105+
# DEP3
106+
# to
107+
# DEP1:
108+
# DEP2:
109+
# DEP3:
110+
# so if the files are missing, they're just considered phony rules.
111+
# We have to do some pretty insane escaping to get those backslashes
112+
# and dollar signs past make, the shell, and sed at the same time.
113+
# Doesn't work with spaces, but that's fine: .d files have spaces in
114+
# their names replaced with other characters.
115+
define fixup_dep
116+
# The depfile may not exist if the input file didn't have any #includes.
117+
touch $(depfile).raw
118+
# Fixup path as in (1).
119+
sed -e "s|^$(notdir $@)|$@|" $(depfile).raw >> $(depfile)
120+
# Add extra rules as in (2).
121+
# We remove slashes and replace spaces with new lines;
122+
# remove blank lines;
123+
# delete the first line and append a colon to the remaining lines.
124+
sed -e 's|\\||' -e 'y| |\n|' $(depfile).raw |\
125+
grep -v '^$$' |\
126+
sed -e 1d -e 's|$$|:|' \
127+
>> $(depfile)
128+
rm $(depfile).raw
129+
endef
130+
131+
# Command definitions:
132+
# - cmd_foo is the actual command to run;
133+
# - quiet_cmd_foo is the brief-output summary of the command.
134+
135+
quiet_cmd_cc = CC($(TOOLSET)) $@
136+
cmd_cc = $(CC.$(TOOLSET)) $(GYP_CFLAGS) $(DEPFLAGS) $(CFLAGS.$(TOOLSET)) -c -o $@ $<
137+
138+
quiet_cmd_cxx = CXX($(TOOLSET)) $@
139+
cmd_cxx = $(CXX.$(TOOLSET)) $(GYP_CXXFLAGS) $(DEPFLAGS) $(CXXFLAGS.$(TOOLSET)) -c -o $@ $<
140+
141+
quiet_cmd_objc = CXX($(TOOLSET)) $@
142+
cmd_objc = $(CC.$(TOOLSET)) $(GYP_OBJCFLAGS) $(DEPFLAGS) -c -o $@ $<
143+
144+
quiet_cmd_objcxx = CXX($(TOOLSET)) $@
145+
cmd_objcxx = $(CXX.$(TOOLSET)) $(GYP_OBJCXXFLAGS) $(DEPFLAGS) -c -o $@ $<
146+
147+
# Commands for precompiled header files.
148+
quiet_cmd_pch_c = CXX($(TOOLSET)) $@
149+
cmd_pch_c = $(CC.$(TOOLSET)) $(GYP_PCH_CFLAGS) $(DEPFLAGS) $(CXXFLAGS.$(TOOLSET)) -c -o $@ $<
150+
quiet_cmd_pch_cc = CXX($(TOOLSET)) $@
151+
cmd_pch_cc = $(CC.$(TOOLSET)) $(GYP_PCH_CCFLAGS) $(DEPFLAGS) $(CXXFLAGS.$(TOOLSET)) -c -o $@ $<
152+
quiet_cmd_pch_m = CXX($(TOOLSET)) $@
153+
cmd_pch_m = $(CC.$(TOOLSET)) $(GYP_PCH_OBJCFLAGS) $(DEPFLAGS) -c -o $@ $<
154+
quiet_cmd_pch_mm = CXX($(TOOLSET)) $@
155+
cmd_pch_mm = $(CC.$(TOOLSET)) $(GYP_PCH_OBJCXXFLAGS) $(DEPFLAGS) -c -o $@ $<
156+
157+
# gyp-mac-tool is written next to the root Makefile by gyp.
158+
# Use $(4) for the command, since $(2) and $(3) are used as flag by do_cmd
159+
# already.
160+
quiet_cmd_mac_tool = MACTOOL $(4) $<
161+
cmd_mac_tool = ./gyp-mac-tool $(4) $< "$@"
162+
163+
quiet_cmd_mac_package_framework = PACKAGE FRAMEWORK $@
164+
cmd_mac_package_framework = ./gyp-mac-tool package-framework "$@" $(4)
165+
166+
quiet_cmd_touch = TOUCH $@
167+
cmd_touch = touch $@
168+
169+
quiet_cmd_copy = COPY $@
170+
# send stderr to /dev/null to ignore messages when linking directories.
171+
cmd_copy = ln -f "$<" "$@" 2>/dev/null || (rm -rf "$@" && cp -af "$<" "$@")
172+
173+
quiet_cmd_alink = LIBTOOL-STATIC $@
174+
cmd_alink = rm -f $@ && libtool -static -o $@ $(filter %.o,$^)
175+
176+
quiet_cmd_link = LINK($(TOOLSET)) $@
177+
cmd_link = $(LINK.$(TOOLSET)) $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -o "$@" $(LD_INPUTS) $(LIBS)
178+
179+
# TODO(thakis): Find out and document the difference between shared_library and
180+
# loadable_module on mac.
181+
quiet_cmd_solink = SOLINK($(TOOLSET)) $@
182+
cmd_solink = $(LINK.$(TOOLSET)) -shared $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -o "$@" $(LD_INPUTS) $(LIBS)
183+
184+
# TODO(thakis): The solink_module rule is likely wrong. Xcode seems to pass
185+
# -bundle -single_module here (for osmesa.so).
186+
quiet_cmd_solink_module = SOLINK_MODULE($(TOOLSET)) $@
187+
cmd_solink_module = $(LINK.$(TOOLSET)) -shared $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -o $@ $(filter-out FORCE_DO_CMD, $^) $(LIBS)
188+
189+
190+
# Define an escape_quotes function to escape single quotes.
191+
# This allows us to handle quotes properly as long as we always use
192+
# use single quotes and escape_quotes.
193+
escape_quotes = $(subst ','\'',$(1))
194+
# This comment is here just to include a ' to unconfuse syntax highlighting.
195+
# Define an escape_vars function to escape '$' variable syntax.
196+
# This allows us to read/write command lines with shell variables (e.g.
197+
# $LD_LIBRARY_PATH), without triggering make substitution.
198+
escape_vars = $(subst $$,$$$$,$(1))
199+
# Helper that expands to a shell command to echo a string exactly as it is in
200+
# make. This uses printf instead of echo because printf's behaviour with respect
201+
# to escape sequences is more portable than echo's across different shells
202+
# (e.g., dash, bash).
203+
exact_echo = printf '%s\n' '$(call escape_quotes,$(1))'
204+
205+
# Helper to compare the command we're about to run against the command
206+
# we logged the last time we ran the command. Produces an empty
207+
# string (false) when the commands match.
208+
# Tricky point: Make has no string-equality test function.
209+
# The kernel uses the following, but it seems like it would have false
210+
# positives, where one string reordered its arguments.
211+
# arg_check = $(strip $(filter-out $(cmd_$(1)), $(cmd_$@)) \
212+
# $(filter-out $(cmd_$@), $(cmd_$(1))))
213+
# We instead substitute each for the empty string into the other, and
214+
# say they're equal if both substitutions produce the empty string.
215+
# .d files contain ? instead of spaces, take that into account.
216+
command_changed = $(or $(subst $(cmd_$(1)),,$(cmd_$(call replace_spaces,$@))),\
217+
$(subst $(cmd_$(call replace_spaces,$@)),,$(cmd_$(1))))
218+
219+
# Helper that is non-empty when a prerequisite changes.
220+
# Normally make does this implicitly, but we force rules to always run
221+
# so we can check their command lines.
222+
# $? -- new prerequisites
223+
# $| -- order-only dependencies
224+
prereq_changed = $(filter-out FORCE_DO_CMD,$(filter-out $|,$?))
225+
226+
# do_cmd: run a command via the above cmd_foo names, if necessary.
227+
# Should always run for a given target to handle command-line changes.
228+
# Second argument, if non-zero, makes it do asm/C/C++ dependency munging.
229+
# Third argument, if non-zero, makes it do POSTBUILDS processing.
230+
# Note: We intentionally do NOT call dirx for depfile, since it contains ? for
231+
# spaces already and dirx strips the ? characters.
232+
define do_cmd
233+
$(if $(or $(command_changed),$(prereq_changed)),
234+
@$(call exact_echo, $($(quiet)cmd_$(1)))
235+
@mkdir -p "$(call dirx,$@)" "$(dir $(depfile))"
236+
$(if $(findstring flock,$(word 2,$(cmd_$1))),
237+
@$(cmd_$(1))
238+
@echo " $(quiet_cmd_$(1)): Finished",
239+
@$(cmd_$(1))
240+
)
241+
@$(call exact_echo,$(call escape_vars,cmd_$(call replace_spaces,$@) := $(cmd_$(1)))) > $(depfile)
242+
@$(if $(2),$(fixup_dep))
243+
$(if $(and $(3), $(POSTBUILDS)),
244+
@for p in $(POSTBUILDS); do eval $$p; done
245+
)
246+
)
247+
endef
248+
249+
# Declare "all" target first so it is the default, even though we don't have the
250+
# deps yet.
251+
.PHONY: all
252+
all:
253+
254+
# Use FORCE_DO_CMD to force a target to run. Should be coupled with
255+
# do_cmd.
256+
.PHONY: FORCE_DO_CMD
257+
FORCE_DO_CMD:
258+
259+
TOOLSET := target
260+
# Suffix rules, putting all outputs into $(obj).
261+
$(obj).$(TOOLSET)/%.o: $(srcdir)/%.c FORCE_DO_CMD
262+
@$(call do_cmd,cc,1)
263+
$(obj).$(TOOLSET)/%.o: $(srcdir)/%.cc FORCE_DO_CMD
264+
@$(call do_cmd,cxx,1)
265+
$(obj).$(TOOLSET)/%.o: $(srcdir)/%.cpp FORCE_DO_CMD
266+
@$(call do_cmd,cxx,1)
267+
$(obj).$(TOOLSET)/%.o: $(srcdir)/%.cxx FORCE_DO_CMD
268+
@$(call do_cmd,cxx,1)
269+
$(obj).$(TOOLSET)/%.o: $(srcdir)/%.m FORCE_DO_CMD
270+
@$(call do_cmd,objc,1)
271+
$(obj).$(TOOLSET)/%.o: $(srcdir)/%.mm FORCE_DO_CMD
272+
@$(call do_cmd,objcxx,1)
273+
$(obj).$(TOOLSET)/%.o: $(srcdir)/%.S FORCE_DO_CMD
274+
@$(call do_cmd,cc,1)
275+
$(obj).$(TOOLSET)/%.o: $(srcdir)/%.s FORCE_DO_CMD
276+
@$(call do_cmd,cc,1)
277+
278+
# Try building from generated source, too.
279+
$(obj).$(TOOLSET)/%.o: $(obj).$(TOOLSET)/%.c FORCE_DO_CMD
280+
@$(call do_cmd,cc,1)
281+
$(obj).$(TOOLSET)/%.o: $(obj).$(TOOLSET)/%.cc FORCE_DO_CMD
282+
@$(call do_cmd,cxx,1)
283+
$(obj).$(TOOLSET)/%.o: $(obj).$(TOOLSET)/%.cpp FORCE_DO_CMD
284+
@$(call do_cmd,cxx,1)
285+
$(obj).$(TOOLSET)/%.o: $(obj).$(TOOLSET)/%.cxx FORCE_DO_CMD
286+
@$(call do_cmd,cxx,1)
287+
$(obj).$(TOOLSET)/%.o: $(obj).$(TOOLSET)/%.m FORCE_DO_CMD
288+
@$(call do_cmd,objc,1)
289+
$(obj).$(TOOLSET)/%.o: $(obj).$(TOOLSET)/%.mm FORCE_DO_CMD
290+
@$(call do_cmd,objcxx,1)
291+
$(obj).$(TOOLSET)/%.o: $(obj).$(TOOLSET)/%.S FORCE_DO_CMD
292+
@$(call do_cmd,cc,1)
293+
$(obj).$(TOOLSET)/%.o: $(obj).$(TOOLSET)/%.s FORCE_DO_CMD
294+
@$(call do_cmd,cc,1)
295+
296+
$(obj).$(TOOLSET)/%.o: $(obj)/%.c FORCE_DO_CMD
297+
@$(call do_cmd,cc,1)
298+
$(obj).$(TOOLSET)/%.o: $(obj)/%.cc FORCE_DO_CMD
299+
@$(call do_cmd,cxx,1)
300+
$(obj).$(TOOLSET)/%.o: $(obj)/%.cpp FORCE_DO_CMD
301+
@$(call do_cmd,cxx,1)
302+
$(obj).$(TOOLSET)/%.o: $(obj)/%.cxx FORCE_DO_CMD
303+
@$(call do_cmd,cxx,1)
304+
$(obj).$(TOOLSET)/%.o: $(obj)/%.m FORCE_DO_CMD
305+
@$(call do_cmd,objc,1)
306+
$(obj).$(TOOLSET)/%.o: $(obj)/%.mm FORCE_DO_CMD
307+
@$(call do_cmd,objcxx,1)
308+
$(obj).$(TOOLSET)/%.o: $(obj)/%.S FORCE_DO_CMD
309+
@$(call do_cmd,cc,1)
310+
$(obj).$(TOOLSET)/%.o: $(obj)/%.s FORCE_DO_CMD
311+
@$(call do_cmd,cc,1)
312+
313+
314+
ifeq ($(strip $(foreach prefix,$(NO_LOAD),\
315+
$(findstring $(join ^,$(prefix)),\
316+
$(join ^,src/rt/libuv/run-benchmarks.target.mk)))),)
317+
include src/rt/libuv/run-benchmarks.target.mk
318+
endif
319+
ifeq ($(strip $(foreach prefix,$(NO_LOAD),\
320+
$(findstring $(join ^,$(prefix)),\
321+
$(join ^,src/rt/libuv/run-tests.target.mk)))),)
322+
include src/rt/libuv/run-tests.target.mk
323+
endif
324+
ifeq ($(strip $(foreach prefix,$(NO_LOAD),\
325+
$(findstring $(join ^,$(prefix)),\
326+
$(join ^,src/rt/libuv/uv.target.mk)))),)
327+
include src/rt/libuv/uv.target.mk
328+
endif
329+
330+
quiet_cmd_regen_makefile = ACTION Regenerating $@
331+
cmd_regen_makefile = ./src/rt/libuv/build/gyp/gyp -fmake --ignore-environment "--toplevel-dir=." "--depth=." "--generator-output=mk/libuv/mac" "-Dlibrary=static_library" "-Dtarget_arch=ia32" "-DOS=mac" src/rt/libuv/uv.gyp
332+
#Makefile: $(srcdir)/src/rt/libuv/uv.gyp
333+
# $(call do_cmd,regen_makefile)
334+
335+
# "all" is a concatenation of the "all" targets from all the included
336+
# sub-makefiles. This is just here to clarify.
337+
all:
338+
339+
# Add in dependency-tracking rules. $(all_deps) is the list of every single
340+
# target in our tree. Only consider the ones with .d (dependency) info:
341+
d_files := $(wildcard $(foreach f,$(all_deps),$(depsdir)/$(f).d))
342+
ifneq ($(d_files),)
343+
# Rather than include each individual .d file, concatenate them into a
344+
# single file which make is able to load faster. We split this into
345+
# commands that take 1000 files at a time to avoid overflowing the
346+
# command line.
347+
$(shell cat $(wordlist 1,1000,$(d_files)) > $(depsdir)/all.deps)
348+
349+
ifneq ($(word 1001,$(d_files)),)
350+
$(error Found unprocessed dependency files (gyp didn't generate enough rules!))
351+
endif
352+
353+
# make looks for ways to re-generate included makefiles, but in our case, we
354+
# don't have a direct way. Explicitly telling make that it has nothing to do
355+
# for them makes it go faster.
356+
$(depsdir)/all.deps: ;
357+
358+
include $(depsdir)/all.deps
359+
endif

0 commit comments

Comments
 (0)