Skip to content

Commit 6284190

Browse files
committed
Merge branch 'master' into kmath
Conflicts: src/libcore/cmath.rs
2 parents 1640538 + 3971b52 commit 6284190

File tree

113 files changed

+2814
-766
lines changed

Some content is hidden

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

113 files changed

+2814
-766
lines changed

AUTHORS.txt

+1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ Jeffrey Yasskin <jyasskin@gmail.com>
2626
Jesse Ruderman <jruderman@gmail.com>
2727
Josh Matthews <josh@joshmatthews.net>
2828
Joshua Wise <joshua@joshuawise.com>
29+
Jyun-Yan You <jyyou@cs.nctu.edu.tw>
2930
Kelly Wilson <wilsonk@cpsc.ucalgary.ca>
3031
Lennart Kudling
3132
Lindsey Kuper <lkuper@mozilla.com>

configure

+1-1
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ case $CFG_CPUTYPE in
212212
CFG_CPUTYPE=arm
213213
;;
214214

215-
x86_64 | x86-64 | x64)
215+
x86_64 | x86-64 | x64 | amd64)
216216
CFG_CPUTYPE=x86_64
217217
;;
218218

doc/tutorial/args.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ de-initialized on the caller side, and give ownership of it to the
105105
called function. This is written `-`.
106106

107107
Finally, the default passing styles (by-value for non-structural
108-
types, by-reference for structural ones) are written `+` for by-value
108+
types, by-reference for structural ones) are written `++` for by-value
109109
and `&&` for by(-immutable)-reference. It is sometimes necessary to
110110
override the defaults. We'll talk more about this when discussing
111111
[generics][gens].

mk/libuv/x86_64/freebsd/Makefile

+353
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,353 @@
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+
41+
42+
# C++ apps need to be linked with g++.
43+
#
44+
# Note: flock is used to seralize linking. Linking is a memory-intensive
45+
# process so running parallel links can often lead to thrashing. To disable
46+
# the serialization, override LINK via an envrionment variable as follows:
47+
#
48+
# export LINK=g++
49+
#
50+
# This will allow make to invoke N linker processes as specified in -jN.
51+
LINK ?= lockf $(builddir)/linker.lock $(CXX)
52+
53+
CC.target ?= $(CC)
54+
CFLAGS.target ?= $(CFLAGS)
55+
CXX.target ?= $(CXX)
56+
CXXFLAGS.target ?= $(CXXFLAGS)
57+
LINK.target ?= $(LINK)
58+
LDFLAGS.target ?= $(LDFLAGS)
59+
AR.target ?= $(AR)
60+
ARFLAGS.target ?= crs
61+
62+
# N.B.: the logic of which commands to run should match the computation done
63+
# in gyp's make.py where ARFLAGS.host etc. is computed.
64+
# TODO(evan): move all cross-compilation logic to gyp-time so we don't need
65+
# to replicate this environment fallback in make as well.
66+
CC.host ?= gcc
67+
CFLAGS.host ?=
68+
CXX.host ?= g++
69+
CXXFLAGS.host ?=
70+
LINK.host ?= g++
71+
LDFLAGS.host ?=
72+
AR.host ?= ar
73+
ARFLAGS.host := crs
74+
75+
# Define a dir function that can handle spaces.
76+
# http://www.gnu.org/software/make/manual/make.html#Syntax-of-Functions
77+
# "leading spaces cannot appear in the text of the first argument as written.
78+
# These characters can be put into the argument value by variable substitution."
79+
empty :=
80+
space := $(empty) $(empty)
81+
82+
# http://stackoverflow.com/questions/1189781/using-make-dir-or-notdir-on-a-path-with-spaces
83+
replace_spaces = $(subst $(space),?,$1)
84+
unreplace_spaces = $(subst ?,$(space),$1)
85+
dirx = $(call unreplace_spaces,$(dir $(call replace_spaces,$1)))
86+
87+
# Flags to make gcc output dependency info. Note that you need to be
88+
# careful here to use the flags that ccache and distcc can understand.
89+
# We write to a dep file on the side first and then rename at the end
90+
# so we can't end up with a broken dep file.
91+
depfile = $(depsdir)/$(call replace_spaces,$@).d
92+
DEPFLAGS = -MMD -MF $(depfile).raw
93+
94+
# We have to fixup the deps output in a few ways.
95+
# (1) the file output should mention the proper .o file.
96+
# ccache or distcc lose the path to the target, so we convert a rule of
97+
# the form:
98+
# foobar.o: DEP1 DEP2
99+
# into
100+
# path/to/foobar.o: DEP1 DEP2
101+
# (2) we want missing files not to cause us to fail to build.
102+
# We want to rewrite
103+
# foobar.o: DEP1 DEP2 \
104+
# DEP3
105+
# to
106+
# DEP1:
107+
# DEP2:
108+
# DEP3:
109+
# so if the files are missing, they're just considered phony rules.
110+
# We have to do some pretty insane escaping to get those backslashes
111+
# and dollar signs past make, the shell, and sed at the same time.
112+
# Doesn't work with spaces, but that's fine: .d files have spaces in
113+
# their names replaced with other characters.
114+
define fixup_dep
115+
# The depfile may not exist if the input file didn't have any #includes.
116+
touch $(depfile).raw
117+
# Fixup path as in (1).
118+
sed -e "s|^$(notdir $@)|$@|" $(depfile).raw >> $(depfile)
119+
# Add extra rules as in (2).
120+
# We remove slashes and replace spaces with new lines;
121+
# remove blank lines;
122+
# delete the first line and append a colon to the remaining lines.
123+
sed -e 's|\\||' -e 'y| |\n|' $(depfile).raw |\
124+
grep -v '^$$' |\
125+
sed -e 1d -e 's|$$|:|' \
126+
>> $(depfile)
127+
rm $(depfile).raw
128+
endef
129+
130+
# Command definitions:
131+
# - cmd_foo is the actual command to run;
132+
# - quiet_cmd_foo is the brief-output summary of the command.
133+
134+
quiet_cmd_cc = CC($(TOOLSET)) $@
135+
cmd_cc = $(CC.$(TOOLSET)) $(GYP_CFLAGS) $(DEPFLAGS) $(CFLAGS.$(TOOLSET)) -c -o $@ $<
136+
137+
quiet_cmd_cxx = CXX($(TOOLSET)) $@
138+
cmd_cxx = $(CXX.$(TOOLSET)) $(GYP_CXXFLAGS) $(DEPFLAGS) $(CXXFLAGS.$(TOOLSET)) -c -o $@ $<
139+
140+
quiet_cmd_touch = TOUCH $@
141+
cmd_touch = touch $@
142+
143+
quiet_cmd_copy = COPY $@
144+
# send stderr to /dev/null to ignore messages when linking directories.
145+
cmd_copy = ln -f "$<" "$@" 2>/dev/null || (rm -rf "$@" && cp -af "$<" "$@")
146+
147+
quiet_cmd_alink = AR($(TOOLSET)) $@
148+
cmd_alink = rm -f $@ && $(AR.$(TOOLSET)) $(ARFLAGS.$(TOOLSET)) $@ $(filter %.o,$^)
149+
150+
# Due to circular dependencies between libraries :(, we wrap the
151+
# special "figure out circular dependencies" flags around the entire
152+
# input list during linking.
153+
quiet_cmd_link = LINK($(TOOLSET)) $@
154+
cmd_link = $(LINK.$(TOOLSET)) $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -o $@ -Wl,--start-group $(LD_INPUTS) -Wl,--end-group $(LIBS)
155+
156+
# We support two kinds of shared objects (.so):
157+
# 1) shared_library, which is just bundling together many dependent libraries
158+
# into a link line.
159+
# 2) loadable_module, which is generating a module intended for dlopen().
160+
#
161+
# They differ only slightly:
162+
# In the former case, we want to package all dependent code into the .so.
163+
# In the latter case, we want to package just the API exposed by the
164+
# outermost module.
165+
# This means shared_library uses --whole-archive, while loadable_module doesn't.
166+
# (Note that --whole-archive is incompatible with the --start-group used in
167+
# normal linking.)
168+
169+
# Other shared-object link notes:
170+
# - Set SONAME to the library filename so our binaries don't reference
171+
# the local, absolute paths used on the link command-line.
172+
quiet_cmd_solink = SOLINK($(TOOLSET)) $@
173+
cmd_solink = $(LINK.$(TOOLSET)) -shared $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -Wl,-soname=$(@F) -o $@ -Wl,--whole-archive $(LD_INPUTS) -Wl,--no-whole-archive $(LIBS)
174+
175+
quiet_cmd_solink_module = SOLINK_MODULE($(TOOLSET)) $@
176+
cmd_solink_module = $(LINK.$(TOOLSET)) -shared $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -Wl,-soname=$(@F) -o $@ -Wl,--start-group $(filter-out FORCE_DO_CMD, $^) -Wl,--end-group $(LIBS)
177+
178+
179+
# Define an escape_quotes function to escape single quotes.
180+
# This allows us to handle quotes properly as long as we always use
181+
# use single quotes and escape_quotes.
182+
escape_quotes = $(subst ','\'',$(1))
183+
# This comment is here just to include a ' to unconfuse syntax highlighting.
184+
# Define an escape_vars function to escape '$' variable syntax.
185+
# This allows us to read/write command lines with shell variables (e.g.
186+
# $LD_LIBRARY_PATH), without triggering make substitution.
187+
escape_vars = $(subst $$,$$$$,$(1))
188+
# Helper that expands to a shell command to echo a string exactly as it is in
189+
# make. This uses printf instead of echo because printf's behaviour with respect
190+
# to escape sequences is more portable than echo's across different shells
191+
# (e.g., dash, bash).
192+
exact_echo = printf '%s\n' '$(call escape_quotes,$(1))'
193+
194+
# Helper to compare the command we're about to run against the command
195+
# we logged the last time we ran the command. Produces an empty
196+
# string (false) when the commands match.
197+
# Tricky point: Make has no string-equality test function.
198+
# The kernel uses the following, but it seems like it would have false
199+
# positives, where one string reordered its arguments.
200+
# arg_check = $(strip $(filter-out $(cmd_$(1)), $(cmd_$@)) \
201+
# $(filter-out $(cmd_$@), $(cmd_$(1))))
202+
# We instead substitute each for the empty string into the other, and
203+
# say they're equal if both substitutions produce the empty string.
204+
# .d files contain ? instead of spaces, take that into account.
205+
command_changed = $(or $(subst $(cmd_$(1)),,$(cmd_$(call replace_spaces,$@))),\
206+
$(subst $(cmd_$(call replace_spaces,$@)),,$(cmd_$(1))))
207+
208+
# Helper that is non-empty when a prerequisite changes.
209+
# Normally make does this implicitly, but we force rules to always run
210+
# so we can check their command lines.
211+
# $? -- new prerequisites
212+
# $| -- order-only dependencies
213+
prereq_changed = $(filter-out FORCE_DO_CMD,$(filter-out $|,$?))
214+
215+
# Helper that executes all postbuilds, and deletes the output file when done
216+
# if any of the postbuilds failed.
217+
define do_postbuilds
218+
@E=0;\
219+
for p in $(POSTBUILDS); do\
220+
eval $$p;\
221+
F=$$?;\
222+
if [ $$F -ne 0 ]; then\
223+
E=$$F;\
224+
fi;\
225+
done;\
226+
if [ $$E -ne 0 ]; then\
227+
rm -rf "$@";\
228+
exit $$E;\
229+
fi
230+
endef
231+
232+
# do_cmd: run a command via the above cmd_foo names, if necessary.
233+
# Should always run for a given target to handle command-line changes.
234+
# Second argument, if non-zero, makes it do asm/C/C++ dependency munging.
235+
# Third argument, if non-zero, makes it do POSTBUILDS processing.
236+
# Note: We intentionally do NOT call dirx for depfile, since it contains ? for
237+
# spaces already and dirx strips the ? characters.
238+
define do_cmd
239+
$(if $(or $(command_changed),$(prereq_changed)),
240+
@$(call exact_echo, $($(quiet)cmd_$(1)))
241+
@mkdir -p "$(call dirx,$@)" "$(dir $(depfile))"
242+
$(if $(findstring flock,$(word 1,$(cmd_$1))),
243+
@$(cmd_$(1))
244+
@echo " $(quiet_cmd_$(1)): Finished",
245+
@$(cmd_$(1))
246+
)
247+
@$(call exact_echo,$(call escape_vars,cmd_$(call replace_spaces,$@) := $(cmd_$(1)))) > $(depfile)
248+
@$(if $(2),$(fixup_dep))
249+
$(if $(and $(3), $(POSTBUILDS)),
250+
$(call do_postbuilds)
251+
)
252+
)
253+
endef
254+
255+
# Declare the "all" target first so it is the default,
256+
# even though we don't have the deps yet.
257+
.PHONY: all
258+
all:
259+
260+
# Use FORCE_DO_CMD to force a target to run. Should be coupled with
261+
# do_cmd.
262+
.PHONY: FORCE_DO_CMD
263+
FORCE_DO_CMD:
264+
265+
TOOLSET := target
266+
# Suffix rules, putting all outputs into $(obj).
267+
$(obj).$(TOOLSET)/%.o: $(srcdir)/%.c FORCE_DO_CMD
268+
@$(call do_cmd,cc,1)
269+
$(obj).$(TOOLSET)/%.o: $(srcdir)/%.cc FORCE_DO_CMD
270+
@$(call do_cmd,cxx,1)
271+
$(obj).$(TOOLSET)/%.o: $(srcdir)/%.cpp FORCE_DO_CMD
272+
@$(call do_cmd,cxx,1)
273+
$(obj).$(TOOLSET)/%.o: $(srcdir)/%.cxx FORCE_DO_CMD
274+
@$(call do_cmd,cxx,1)
275+
$(obj).$(TOOLSET)/%.o: $(srcdir)/%.S FORCE_DO_CMD
276+
@$(call do_cmd,cc,1)
277+
$(obj).$(TOOLSET)/%.o: $(srcdir)/%.s FORCE_DO_CMD
278+
@$(call do_cmd,cc,1)
279+
280+
# Try building from generated source, too.
281+
$(obj).$(TOOLSET)/%.o: $(obj).$(TOOLSET)/%.c FORCE_DO_CMD
282+
@$(call do_cmd,cc,1)
283+
$(obj).$(TOOLSET)/%.o: $(obj).$(TOOLSET)/%.cc FORCE_DO_CMD
284+
@$(call do_cmd,cxx,1)
285+
$(obj).$(TOOLSET)/%.o: $(obj).$(TOOLSET)/%.cpp FORCE_DO_CMD
286+
@$(call do_cmd,cxx,1)
287+
$(obj).$(TOOLSET)/%.o: $(obj).$(TOOLSET)/%.cxx FORCE_DO_CMD
288+
@$(call do_cmd,cxx,1)
289+
$(obj).$(TOOLSET)/%.o: $(obj).$(TOOLSET)/%.S FORCE_DO_CMD
290+
@$(call do_cmd,cc,1)
291+
$(obj).$(TOOLSET)/%.o: $(obj).$(TOOLSET)/%.s FORCE_DO_CMD
292+
@$(call do_cmd,cc,1)
293+
294+
$(obj).$(TOOLSET)/%.o: $(obj)/%.c FORCE_DO_CMD
295+
@$(call do_cmd,cc,1)
296+
$(obj).$(TOOLSET)/%.o: $(obj)/%.cc FORCE_DO_CMD
297+
@$(call do_cmd,cxx,1)
298+
$(obj).$(TOOLSET)/%.o: $(obj)/%.cpp FORCE_DO_CMD
299+
@$(call do_cmd,cxx,1)
300+
$(obj).$(TOOLSET)/%.o: $(obj)/%.cxx FORCE_DO_CMD
301+
@$(call do_cmd,cxx,1)
302+
$(obj).$(TOOLSET)/%.o: $(obj)/%.S FORCE_DO_CMD
303+
@$(call do_cmd,cc,1)
304+
$(obj).$(TOOLSET)/%.o: $(obj)/%.s FORCE_DO_CMD
305+
@$(call do_cmd,cc,1)
306+
307+
308+
ifeq ($(strip $(foreach prefix,$(NO_LOAD),\
309+
$(findstring $(join ^,$(prefix)),\
310+
$(join ^,src/libuv/run-benchmarks.target.mk)))),)
311+
include src/libuv/run-benchmarks.target.mk
312+
endif
313+
ifeq ($(strip $(foreach prefix,$(NO_LOAD),\
314+
$(findstring $(join ^,$(prefix)),\
315+
$(join ^,src/libuv/run-tests.target.mk)))),)
316+
include src/libuv/run-tests.target.mk
317+
endif
318+
ifeq ($(strip $(foreach prefix,$(NO_LOAD),\
319+
$(findstring $(join ^,$(prefix)),\
320+
$(join ^,src/libuv/uv.target.mk)))),)
321+
include src/libuv/uv.target.mk
322+
endif
323+
324+
quiet_cmd_regen_makefile = ACTION Regenerating $@
325+
cmd_regen_makefile = ./src/libuv/build/gyp/gyp -fmake --ignore-environment "--toplevel-dir=." "--depth=." "--generator-output=mk/libuv/x86_64/unix" "-Dlibrary=static_library" "-Dtarget_arch=x86_64" "-DOS=freebsd" src/libuv/uv.gyp
326+
Makefile: $(srcdir)/src/libuv/uv.gyp
327+
# $(call do_cmd,regen_makefile)
328+
329+
# "all" is a concatenation of the "all" targets from all the included
330+
# sub-makefiles. This is just here to clarify.
331+
all:
332+
333+
# Add in dependency-tracking rules. $(all_deps) is the list of every single
334+
# target in our tree. Only consider the ones with .d (dependency) info:
335+
d_files := $(wildcard $(foreach f,$(all_deps),$(depsdir)/$(f).d))
336+
ifneq ($(d_files),)
337+
# Rather than include each individual .d file, concatenate them into a
338+
# single file which make is able to load faster. We split this into
339+
# commands that take 1000 files at a time to avoid overflowing the
340+
# command line.
341+
$(shell cat $(wordlist 1,1000,$(d_files)) > $(depsdir)/all.deps)
342+
343+
ifneq ($(word 1001,$(d_files)),)
344+
$(error Found unprocessed dependency files (gyp didn't generate enough rules!))
345+
endif
346+
347+
# make looks for ways to re-generate included makefiles, but in our case, we
348+
# don't have a direct way. Explicitly telling make that it has nothing to do
349+
# for them makes it go faster.
350+
$(depsdir)/all.deps: ;
351+
352+
include $(depsdir)/all.deps
353+
endif

0 commit comments

Comments
 (0)