Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
0675dffa
R
Rust
项目概览
int
/
Rust
大约 1 年 前同步成功
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
Rust
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
0675dffa
编写于
8月 26, 2015
作者:
A
Alex Crichton
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
rmake: Get all tests passing on MSVC
上级
3887ca27
变更
34
隐藏空白更改
内联
并排
Showing
34 changed file
with
155 addition
and
78 deletion
+155
-78
mk/tests.mk
mk/tests.mk
+7
-2
src/etc/maketest.py
src/etc/maketest.py
+10
-2
src/test/run-make/archive-duplicate-names/Makefile
src/test/run-make/archive-duplicate-names/Makefile
+2
-2
src/test/run-make/c-dynamic-dylib/cfoo.c
src/test/run-make/c-dynamic-dylib/cfoo.c
+3
-0
src/test/run-make/c-dynamic-rlib/cfoo.c
src/test/run-make/c-dynamic-rlib/cfoo.c
+4
-0
src/test/run-make/c-link-to-rust-dylib/Makefile
src/test/run-make/c-link-to-rust-dylib/Makefile
+12
-5
src/test/run-make/c-link-to-rust-staticlib/Makefile
src/test/run-make/c-link-to-rust-staticlib/Makefile
+3
-3
src/test/run-make/c-static-dylib/Makefile
src/test/run-make/c-static-dylib/Makefile
+2
-2
src/test/run-make/c-static-rlib/Makefile
src/test/run-make/c-static-rlib/Makefile
+2
-2
src/test/run-make/crate-name-priority/Makefile
src/test/run-make/crate-name-priority/Makefile
+1
-1
src/test/run-make/extern-fn-generic/Makefile
src/test/run-make/extern-fn-generic/Makefile
+3
-5
src/test/run-make/extern-fn-mangle/Makefile
src/test/run-make/extern-fn-mangle/Makefile
+2
-4
src/test/run-make/extern-fn-with-packed-struct/Makefile
src/test/run-make/extern-fn-with-packed-struct/Makefile
+2
-4
src/test/run-make/extern-fn-with-packed-struct/test.c
src/test/run-make/extern-fn-with-packed-struct/test.c
+10
-0
src/test/run-make/extern-fn-with-union/Makefile
src/test/run-make/extern-fn-with-union/Makefile
+3
-5
src/test/run-make/interdependent-c-libraries/Makefile
src/test/run-make/interdependent-c-libraries/Makefile
+1
-1
src/test/run-make/issue-12446/Makefile
src/test/run-make/issue-12446/Makefile
+1
-1
src/test/run-make/issue-14500/Makefile
src/test/run-make/issue-14500/Makefile
+1
-1
src/test/run-make/issue-15460/Makefile
src/test/run-make/issue-15460/Makefile
+1
-1
src/test/run-make/issue-15460/foo.c
src/test/run-make/issue-15460/foo.c
+4
-0
src/test/run-make/issue-15460/foo.rs
src/test/run-make/issue-15460/foo.rs
+2
-0
src/test/run-make/issue-25581/Makefile
src/test/run-make/issue-25581/Makefile
+2
-4
src/test/run-make/issue-26092/Makefile
src/test/run-make/issue-26092/Makefile
+1
-1
src/test/run-make/link-path-order/Makefile
src/test/run-make/link-path-order/Makefile
+5
-3
src/test/run-make/linkage-attr-on-static/Makefile
src/test/run-make/linkage-attr-on-static/Makefile
+2
-4
src/test/run-make/linkage-attr-on-static/bar.rs
src/test/run-make/linkage-attr-on-static/bar.rs
+1
-0
src/test/run-make/lto-smoke-c/Makefile
src/test/run-make/lto-smoke-c/Makefile
+3
-1
src/test/run-make/no-duplicate-libs/Makefile
src/test/run-make/no-duplicate-libs/Makefile
+5
-0
src/test/run-make/no-duplicate-libs/bar.c
src/test/run-make/no-duplicate-libs/bar.c
+0
-4
src/test/run-make/no-duplicate-libs/foo.c
src/test/run-make/no-duplicate-libs/foo.c
+0
-2
src/test/run-make/output-type-permutations/Makefile
src/test/run-make/output-type-permutations/Makefile
+8
-6
src/test/run-make/relocation-model/Makefile
src/test/run-make/relocation-model/Makefile
+10
-4
src/test/run-make/static-dylib-by-default/Makefile
src/test/run-make/static-dylib-by-default/Makefile
+8
-1
src/test/run-make/tools.mk
src/test/run-make/tools.mk
+34
-7
未找到文件。
mk/tests.mk
浏览文件 @
0675dffa
...
...
@@ -1046,6 +1046,10 @@ $$(call TEST_OK_FILE,$(1),$(2),$(3),rmake): \
$$(RMAKE_TESTS:%=$(3)/test/run-make/%-$(1)-T-$(2)-H-$(3).ok)
@
touch
$$
@
$(3)/test/run-make/%-$(1)-T-$(2)-H-$(3).ok
:
\
export INCLUDE := $$(CFG_MSVC_INCLUDE_PATH_$$(HOST_$(3)))
$(3)/test/run-make/%-$(1)-T-$(2)-H-$(3).ok
:
\
export LIB := $$(CFG_MSVC_LIB_PATH_$$(HOST_$(3)))
$(3)/test/run-make/%-$(1)-T-$(2)-H-$(3).ok
:
\
$(S)src/test/run-make/%/Makefile
\
$$(CSREQ$(1)_T_$(2)_H_$(3))
...
...
@@ -1056,7 +1060,7 @@ $(3)/test/run-make/%-$(1)-T-$(2)-H-$(3).ok: \
$
$(MAKE)
\
$$
(
HBIN
$(1)
_H_
$(3)
)
/rustc
$$
(
X_
$(3)
)
\
$(3)
/test/run-make/
$$
*
\
$$
(
CC_
$(3)
)
\
'$$(CC_
$(3)
)'
\
"
$$
(CFG_GCCISH_CFLAGS_
$(3)
)"
\
$$
(
HBIN
$(1)
_H_
$(3)
)
/rustdoc
$$
(
X_
$(3)
)
\
"
$
$(TESTNAME)
"
\
...
...
@@ -1064,7 +1068,8 @@ $(3)/test/run-make/%-$(1)-T-$(2)-H-$(3).ok: \
"
$$
(LD_LIBRARY_PATH_ENV_HOSTDIR
$(1)
_T_
$(2)
_H_
$(3)
)"
\
"
$$
(LD_LIBRARY_PATH_ENV_TARGETDIR
$(1)
_T_
$(2)
_H_
$(3)
)"
\
$(1)
\
$
$(S)
$
$(S)
\
$(3)
@
touch
-r
$$
@.start_time
$$
@
&&
rm
$$
@.start_time
else
# FIXME #11094 - The above rule doesn't work right for multiple targets
...
...
src/etc/maketest.py
浏览文件 @
0675dffa
...
...
@@ -12,6 +12,7 @@ import subprocess
import
os
import
sys
target_triple
=
sys
.
argv
[
14
]
def
normalize_path
(
v
):
"""msys1/msys2 automatically converts `/abs/path1:/abs/path2` into
...
...
@@ -22,8 +23,11 @@ def normalize_path(v):
windows paths so it is really error-prone. revert it for peace."""
v
=
v
.
replace
(
'
\\
'
,
'/'
)
# c:/path -> /c/path
if
':/'
in
v
:
v
=
'/'
+
v
.
replace
(
':/'
,
'/'
)
# "c:/path" -> "/c/path"
start
=
v
.
find
(
':/'
)
while
start
!=
-
1
:
v
=
v
[:
start
-
1
]
+
'/'
+
v
[
start
-
1
:
start
]
+
v
[
start
+
1
:]
start
=
v
.
find
(
':/'
)
return
v
...
...
@@ -50,6 +54,10 @@ putenv('TARGET_RPATH_DIR', os.path.abspath(sys.argv[11]))
putenv
(
'RUST_BUILD_STAGE'
,
sys
.
argv
[
12
])
putenv
(
'S'
,
os
.
path
.
abspath
(
sys
.
argv
[
13
]))
putenv
(
'PYTHON'
,
sys
.
executable
)
os
.
putenv
(
'TARGET'
,
target_triple
)
if
'msvc'
in
target_triple
:
os
.
putenv
(
'IS_MSVC'
,
'1'
)
if
filt
not
in
sys
.
argv
[
1
]:
sys
.
exit
(
0
)
...
...
src/test/run-make/archive-duplicate-names/Makefile
浏览文件 @
0675dffa
...
...
@@ -3,8 +3,8 @@
all
:
mkdir
$(TMPDIR)
/a
mkdir
$(TMPDIR)
/b
$(
CC)
-c
-o
$(TMPDIR)
/a/foo.o foo.c
$(
CC)
-c
-o
$(TMPDIR)
/b/foo.o bar.c
$(
call
COMPILE_OBJ,
$(TMPDIR)
/a/foo.o,foo.c
)
$(
call
COMPILE_OBJ,
$(TMPDIR)
/b/foo.o,bar.c
)
ar crus
$(TMPDIR)
/libfoo.a
$(TMPDIR)
/a/foo.o
$(TMPDIR)
/b/foo.o
$(RUSTC)
foo.rs
$(RUSTC)
bar.rs
...
...
src/test/run-make/c-dynamic-dylib/cfoo.c
浏览文件 @
0675dffa
// ignore-license
#ifdef _WIN32
__declspec
(
dllexport
)
#endif
int
foo
()
{
return
0
;
}
src/test/run-make/c-dynamic-rlib/cfoo.c
浏览文件 @
0675dffa
// ignore-license
#ifdef _WIN32
__declspec
(
dllexport
)
#endif
int
foo
()
{
return
0
;
}
src/test/run-make/c-link-to-rust-dylib/Makefile
浏览文件 @
0675dffa
-include
../tools.mk
HOST_LIB_DIR
=
$(TMPDIR)
/../../../stage
$(RUST_BUILD_STAGE)
/lib
all
:
$(RUSTC)
foo.rs
$(CC)
bar.c
-lfoo
-o
$(
call
RUN_BINFILE,bar
)
$(
call
RPATH_LINK_SEARCH,
$(HOST_LIB_DIR)
)
-Wl
,-rpath,
$(TMPDIR)
$(EXTRACFLAGS)
all
:
$(TMPDIR)/$(call BIN
,
bar)
$(
call
RUN,bar
)
$(
call
REMOVE_DYLIBS,foo
)
$(
call
FAIL,bar
)
ifdef
IS_MSVC
$(TMPDIR)/$(call BIN,bar)
:
$(call DYLIB
,
foo)
$(CC)
bar.c
$(TMPDIR)
/foo.lib
$(
call
OUT_EXE,bar
)
else
$(TMPDIR)/$(call BIN,bar)
:
$(call DYLIB
,
foo)
$(CC)
bar.c
-lfoo
-o
$(
call
RUN_BINFILE,bar
)
-L
$(TMPDIR)
endif
$(call DYLIB,foo)
:
foo.rs
$(RUSTC)
foo.rs
src/test/run-make/c-link-to-rust-staticlib/Makefile
浏览文件 @
0675dffa
-include
../tools.mk
EXTRAFLAGS
:=
$(EXTRACFLAGS)
# FIXME: ignore freebsd
ifneq
($(shell uname),FreeBSD)
all
:
$(RUSTC)
foo.rs
$(CC)
bar.c
-lfoo
-o
$(
call
RUN_BINFILE,bar
)
$(EXTRAFLAGS)
$(EXTRACXXFLAGS)
cp
$(TMPDIR)
/libfoo.a
$(
call
NATIVE_STATICLIB,foo2
)
$(CC)
bar.c
$(
call
NATIVE_STATICLIB,foo2
)
$(
call
OUT_EXE,bar
)
\
$(EXTRACFLAGS)
$(EXTRACXXFLAGS)
$(
call
RUN,bar
)
rm
$(
call
STATICLIB,foo
*
)
$(
call
RUN,bar
)
...
...
src/test/run-make/c-static-dylib/Makefile
浏览文件 @
0675dffa
-include
../tools.mk
all
:
$(call STATICLIB
,
cfoo)
all
:
$(call
NATIVE_
STATICLIB
,
cfoo)
$(RUSTC)
foo.rs
-C
prefer-dynamic
$(RUSTC)
bar.rs
rm
$(
TMPDIR)
/
$(
call
STATICLIB_GLO
B,cfoo
)
rm
$(
call
NATIVE_STATICLI
B,cfoo
)
$(
call
RUN,bar
)
$(
call
REMOVE_DYLIBS,foo
)
$(
call
FAIL,bar
)
src/test/run-make/c-static-rlib/Makefile
浏览文件 @
0675dffa
-include
../tools.mk
all
:
$(call STATICLIB
,
cfoo)
all
:
$(call
NATIVE_
STATICLIB
,
cfoo)
$(RUSTC)
foo.rs
$(RUSTC)
bar.rs
$(
call
REMOVE_RLIBS,foo
)
rm
$(
TMPDIR)
/
$(
call
STATICLIB_GLO
B,cfoo
)
rm
$(
call
NATIVE_STATICLI
B,cfoo
)
$(
call
RUN,bar
)
src/test/run-make/crate-name-priority/Makefile
浏览文件 @
0675dffa
...
...
@@ -7,5 +7,5 @@ all:
rm
$(TMPDIR)
/
$(
call
BIN,bar
)
$(RUSTC)
foo1.rs
rm
$(TMPDIR)
/
$(
call
BIN,foo
)
$(RUSTC)
foo1.rs
-o
$(TMPDIR)
/
bar1
$(RUSTC)
foo1.rs
-o
$(TMPDIR)
/
$(
call
BIN,bar1
)
rm
$(TMPDIR)
/
$(
call
BIN,bar1
)
src/test/run-make/extern-fn-generic/Makefile
浏览文件 @
0675dffa
-include
../tools.mk
all
:
$(CC)
-std
=
c99 test.c
-c
-o
$(TMPDIR)
/test.o
$(AR)
rcs
$(TMPDIR)
/libtest.a
$(TMPDIR)
/test.o
$(RUSTC)
testcrate.rs
-L
$(TMPDIR)
$(RUSTC)
test.rs
-L
$(TMPDIR)
all
:
$(call NATIVE_STATICLIB
,
test)
$(RUSTC)
testcrate.rs
$(RUSTC)
test.rs
$(
call
RUN,test
)
||
exit
1
src/test/run-make/extern-fn-mangle/Makefile
浏览文件 @
0675dffa
-include
../tools.mk
all
:
$(CC)
-std
=
c99 test.c
-c
-o
$(TMPDIR)
/test.o
$(AR)
rcs
$(TMPDIR)
/libtest.a
$(TMPDIR)
/test.o
$(RUSTC)
test.rs
-L
$(TMPDIR)
all
:
$(call NATIVE_STATICLIB
,
test)
$(RUSTC)
test.rs
$(
call
RUN,test
)
||
exit
1
src/test/run-make/extern-fn-with-packed-struct/Makefile
浏览文件 @
0675dffa
-include
../tools.mk
all
:
$(CC)
-std
=
c99 test.c
-c
-o
$(TMPDIR)
/test.o
$(AR)
rcs
$(TMPDIR)
/libtest.a
$(TMPDIR)
/test.o
$(RUSTC)
test.rs
-L
$(TMPDIR)
all
:
$(call NATIVE_STATICLIB
,
test)
$(RUSTC)
test.rs
$(
call
RUN,test
)
||
exit
1
src/test/run-make/extern-fn-with-packed-struct/test.c
浏览文件 @
0675dffa
// ignore-license
// Pragma needed cause of gcc bug on windows: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52991
#ifdef _MSC_VER
#pragma pack(push,1)
struct
Foo
{
char
a
;
short
b
;
char
c
;
};
#else
#pragma pack(1)
struct
__attribute__
((
packed
))
Foo
{
char
a
;
short
b
;
char
c
;
};
#endif
struct
Foo
foo
(
struct
Foo
foo
)
{
return
foo
;
...
...
src/test/run-make/extern-fn-with-union/Makefile
浏览文件 @
0675dffa
-include
../tools.mk
all
:
$(CC)
-std
=
c99 test.c
-c
-o
$(TMPDIR)
/test.o
$(AR)
rcs
$(TMPDIR)
/libtest.a
$(TMPDIR)
/test.o
$(RUSTC)
testcrate.rs
-L
$(TMPDIR)
$(RUSTC)
test.rs
-L
$(TMPDIR)
all
:
$(call NATIVE_STATICLIB
,
test)
$(RUSTC)
testcrate.rs
$(RUSTC)
test.rs
$(
call
RUN,test
)
||
exit
1
src/test/run-make/interdependent-c-libraries/Makefile
浏览文件 @
0675dffa
...
...
@@ -8,7 +8,7 @@
# correct to complete the linkage. If passed as "-lfoo -lbar", then the 'foo'
# library will be stripped out, and the linkage will fail.
all
:
$(call
STATICLIB
,
foo) $(call
STATICLIB
,
bar)
all
:
$(call
NATIVE_STATICLIB
,
foo) $(call NATIVE_
STATICLIB
,
bar)
$(RUSTC)
foo.rs
$(RUSTC)
bar.rs
$(RUSTC)
main.rs
-Z
print-link-args
src/test/run-make/issue-12446/Makefile
浏览文件 @
0675dffa
-include
../tools.mk
all
:
$(call STATICLIB
,
foo)
all
:
$(call
NATIVE_
STATICLIB
,
foo)
$(RUSTC)
foo.rs
$(RUSTC)
bar.rs
$(
call
RUN,bar
)
src/test/run-make/issue-14500/Makefile
浏览文件 @
0675dffa
...
...
@@ -13,5 +13,5 @@ endif
all
:
$(RUSTC)
foo.rs
--crate-type
=
rlib
$(RUSTC)
bar.rs
--crate-type
=
staticlib
-C
lto
-L
.
-o
$(TMPDIR)
/libbar.a
$(CC)
foo.c
-lbar
-o
$(
call
RUN_BINFILE,foo
)
$(EXTRACFLAGS
)
$(CC)
foo.c
$(TMPDIR)
/libbar.a
$(EXTRACFLAGS)
$(
call
OUT_EXE,foo
)
$(
call
RUN,foo
)
src/test/run-make/issue-15460/Makefile
浏览文件 @
0675dffa
-include
../tools.mk
all
:
$(
TMPDIR)/libfoo.a
all
:
$(
call NATIVE_STATICLIB
,
foo)
$(RUSTC)
foo.rs
-C
extra-filename
=
-383hf8
-C
prefer-dynamic
$(RUSTC)
bar.rs
$(
call
RUN,bar
)
src/test/run-make/issue-15460/foo.c
浏览文件 @
0675dffa
// ignore-license
#ifdef _WIN32
__declspec
(
dllexport
)
#endif
void
foo
()
{}
src/test/run-make/issue-15460/foo.rs
浏览文件 @
0675dffa
...
...
@@ -8,9 +8,11 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(linked_from)]
#![crate_type
=
"dylib"
]
#[link(name
=
"foo"
,
kind
=
"static"
)]
#[linked_from
=
"foo"
]
extern
{
pub
fn
foo
();
}
src/test/run-make/issue-25581/Makefile
浏览文件 @
0675dffa
-include
../tools.mk
all
:
$(CC)
-std
=
c99 test.c
-c
-o
$(TMPDIR)
/test.o
$(AR)
rcs
$(TMPDIR)
/libtest.a
$(TMPDIR)
/test.o
$(RUSTC)
test.rs
-L
$(TMPDIR)
all
:
$(call NATIVE_STATICLIB
,
test)
$(RUSTC)
test.rs
$(
call
RUN,test
)
||
exit
1
src/test/run-make/issue-26092/Makefile
浏览文件 @
0675dffa
...
...
@@ -2,4 +2,4 @@
all
:
$(RUSTC)
-o
""
blank.rs 2>&1 |
\
grep
'No such file or directory'
grep
-i
'No such file or directory'
src/test/run-make/link-path-order/Makefile
浏览文件 @
0675dffa
...
...
@@ -6,10 +6,12 @@
CORRECT_DIR
=
$(TMPDIR)
/correct
WRONG_DIR
=
$(TMPDIR)
/wrong
all
:
$(TMPDIR)/libcorrect.a $(TMPDIR)/libwrong.a
F
:=
$(
call
NATIVE_STATICLIB_FILE,foo
)
all
:
$(call NATIVE_STATICLIB
,
correct) $(call NATIVE_STATICLIB
,
wrong)
mkdir
-p
$(CORRECT_DIR)
$(WRONG_DIR)
mv
$(
TMPDIR)
/libcorrect.a
$(CORRECT_DIR)
/libfoo.a
mv
$(
TMPDIR)
/libwrong.a
$(WRONG_DIR)
/libfoo.a
mv
$(
call
NATIVE_STATICLIB,correct
)
$(CORRECT_DIR)
/
$(F)
mv
$(
call
NATIVE_STATICLIB,wrong
)
$(WRONG_DIR)
/
$(F)
$(RUSTC)
main.rs
-o
$(TMPDIR)
/should_succeed
-L
$(CORRECT_DIR)
-L
$(WRONG_DIR)
$(
call
RUN,should_succeed
)
$(RUSTC)
main.rs
-o
$(TMPDIR)
/should_fail
-L
$(WRONG_DIR)
-L
$(CORRECT_DIR)
...
...
src/test/run-make/linkage-attr-on-static/Makefile
浏览文件 @
0675dffa
-include
../tools.mk
all
:
$(CC)
foo.c
-c
-o
$(TMPDIR)
/foo.o
$(AR)
rcs
$(TMPDIR)
/libfoo.a
$(TMPDIR)
/foo.o
$(RUSTC)
bar.rs
-lfoo
-L
$(TMPDIR)
all
:
$(call NATIVE_STATICLIB
,
foo)
$(RUSTC)
bar.rs
$(
call
RUN,bar
)
||
exit
1
src/test/run-make/linkage-attr-on-static/bar.rs
浏览文件 @
0675dffa
...
...
@@ -14,6 +14,7 @@
#[linkage
=
"external"
]
static
BAZ
:
i32
=
21
;
#[link(name
=
"foo"
,
kind
=
"static"
)]
extern
{
fn
what
()
->
i32
;
}
...
...
src/test/run-make/lto-smoke-c/Makefile
浏览文件 @
0675dffa
...
...
@@ -5,5 +5,7 @@ CC := $(CC:-g=)
all
:
$(RUSTC)
foo.rs
-C
lto
$(CC)
bar.c
-lfoo
-o
$(
call
RUN_BINFILE,bar
)
$(EXTRACFLAGS)
$(EXTRACXXFLAGS)
$(CC)
bar.c
$(TMPDIR)
/libfoo.a
\
$(
call
OUT_EXE,bar
)
\
$(EXTRACFLAGS)
$(EXTRACXXFLAGS)
$(
call
RUN,bar
)
src/test/run-make/no-duplicate-libs/Makefile
浏览文件 @
0675dffa
-include
../tools.mk
ifdef
IS_MSVC
# FIXME(#27979)
all
:
else
all
:
$(RUSTC)
foo.rs
$(RUSTC)
bar.rs
$(RUSTC)
main.rs
$(
call
RUN,main
)
endif
src/test/run-make/no-duplicate-libs/bar.c
已删除
100644 → 0
浏览文件 @
3887ca27
// ignore-license
extern
void
foo
();
void
bar
()
{
foo
();
}
src/test/run-make/no-duplicate-libs/foo.c
已删除
100644 → 0
浏览文件 @
3887ca27
// ignore-license
void
foo
()
{}
src/test/run-make/output-type-permutations/Makefile
浏览文件 @
0675dffa
...
...
@@ -4,7 +4,8 @@ all:
$(RUSTC)
foo.rs
--crate-type
=
rlib,dylib,staticlib
$(
call
REMOVE_RLIBS,bar
)
$(
call
REMOVE_DYLIBS,bar
)
rm
$(TMPDIR)
/
$(
call
STATICLIB_GLOB,bar
)
rm
$(TMPDIR)
/libbar.a
rm
-f
$(TMPDIR)
/bar.
{
exp,lib
}
# Check that
$(TMPDIR)
is empty.
[
"
$$
(ls -1
$(TMPDIR)
| wc -l)"
-eq
"0"
]
...
...
@@ -36,7 +37,7 @@ all:
rm
$(TMPDIR)/foo
[
"$$(ls -1 $(TMPDIR) | wc -l)"
-eq
"0"
]
$(RUSTC)
foo.rs
--emit
=
link
-o
$(TMPDIR)
/
foo
$(RUSTC)
foo.rs
--emit
=
link
-o
$(TMPDIR)
/
$(
call
BIN,foo
)
rm
$(TMPDIR)/$(call
BIN,foo)
[
"$$(ls -1 $(TMPDIR) | wc -l)"
-eq
"0"
]
...
...
@@ -44,15 +45,16 @@ all:
rm
$(TMPDIR)/foo
[
"$$(ls -1 $(TMPDIR) | wc -l)"
-eq
"0"
]
$(RUSTC)
foo.rs
--crate-type
=
dylib
-o
$(TMPDIR)
/foo
rm
$(TMPDIR)/$(call
BIN,foo)
# FIXME 13794
$(RUSTC)
foo.rs
--crate-type
=
dylib
-o
$(TMPDIR)
/
$(
call
BIN,foo
)
rm
$(TMPDIR)/$(call
BIN,foo)
rm
-f
$(TMPDIR)/foo.{exp,lib}
[
"$$(ls -1 $(TMPDIR) | wc -l)"
-eq
"0"
]
$(RUSTC)
foo.rs
--crate-type
=
staticlib
-o
$(TMPDIR)
/foo
rm
$(TMPDIR)/foo
[
"$$(ls -1 $(TMPDIR) | wc -l)"
-eq
"0"
]
$(RUSTC)
foo.rs
--crate-type
=
bin
-o
$(TMPDIR)
/
foo
$(RUSTC)
foo.rs
--crate-type
=
bin
-o
$(TMPDIR)
/
$(
call
BIN,foo
)
rm
$(TMPDIR)/$(call
BIN,foo)
[
"$$(ls -1 $(TMPDIR) | wc -l)"
-eq
"0"
]
...
...
@@ -60,7 +62,7 @@ all:
rm
$(TMPDIR)/bar.ll
rm
$(TMPDIR)/bar.s
rm
$(TMPDIR)/bar.o
rm
$(TMPDIR)/
$(call
STATICLIB_GLOB,bar)
rm
$(TMPDIR)/
libbar.a
mv
$(TMPDIR)/bar.bc
$(TMPDIR)/foo.bc
# Don't check that the $(TMPDIR) is empty - we left `foo.bc` for later
# comparison.
...
...
src/test/run-make/relocation-model/Makefile
浏览文件 @
0675dffa
-include
../tools.mk
all
:
all
:
others
$(RUSTC)
-C
relocation-model
=
dynamic-no-pic foo.rs
$(
call
RUN,foo
)
$(RUSTC)
-C
relocation-model
=
default foo.rs
$(call
RUN,foo)
$(RUSTC)
-C
relocation-model
=
default
--crate-type
=
dylib foo.rs
$(RUSTC)
-C
relocation-model
=
dynamic-no-pic
--crate-type
=
dylib foo.rs
ifdef
IS_MSVC
# FIXME(#28026)
others
:
else
others
:
$(RUSTC)
-C
relocation-model
=
static foo.rs
$(
call
RUN,foo
)
$(RUSTC)
-C
relocation-model
=
default
--crate-type
=
dylib foo.rs
$(RUSTC)
-C
relocation-model
=
static
--crate-type
=
dylib foo.rs
$(RUSTC)
-C
relocation-model
=
dynamic-no-pic
--crate-type
=
dylib foo.rs
endif
src/test/run-make/static-dylib-by-default/Makefile
浏览文件 @
0675dffa
-include
../tools.mk
TO_LINK
:=
$(
call
DYLIB,bar
)
ifdef
IS_MSVC
LINK_ARG
=
$(TO_LINK:dll=lib)
else
LINK_ARG
=
$(TO_LINK)
endif
all
:
$(RUSTC)
foo.rs
$(RUSTC)
bar.rs
$(CC)
main.c
-o
$(
call
RUN_BINFILE,main
)
-lbar
$(EXTRACFLAGS)
$(CC)
main.c
$(
call
OUT_EXE,main
)
$(LINK_ARG)
$(EXTRACFLAGS)
rm
$(TMPDIR)
/
*
.rlib
rm
$(
call
DYLIB,foo
)
$(
call
RUN,main
)
src/test/run-make/tools.mk
浏览文件 @
0675dffa
...
...
@@ -7,7 +7,7 @@ TARGET_RPATH_ENV = \
BARE_RUSTC
:=
$(HOST_RPATH_ENV)
$(RUSTC)
RUSTC
:=
$(BARE_RUSTC)
--out-dir
$(TMPDIR)
-L
$(TMPDIR)
CC
:=
$(CC)
-L
$(TMPDIR)
#
CC := $(CC) -L $(TMPDIR)
HTMLDOCCK
:=
$(PYTHON)
$(S)
/src/etc/htmldocck.py
# This is the name of the binary we will generate and run; use this
...
...
@@ -19,8 +19,6 @@ RUN_BINFILE = $(TMPDIR)/$(1)
# variable before running the binary.
RLIB_GLOB
=
lib
$(1)
*
.rlib
STATICLIB
=
$(TMPDIR)
/lib
$(1)
.a
STATICLIB_GLOB
=
lib
$(1)
*
.a
BIN
=
$(1)
UNAME
=
$(
shell
uname
)
...
...
@@ -33,27 +31,48 @@ RUN = $(TARGET_RPATH_ENV) $(RUN_BINFILE)
FAIL
=
$(TARGET_RPATH_ENV)
$(RUN_BINFILE)
&&
exit
1
||
exit
0
DYLIB_GLOB
=
lib
$(1)
*
.dylib
DYLIB
=
$(TMPDIR)
/lib
$(1)
.dylib
RPATH_LINK_SEARCH
=
STATICLIB
=
$(TMPDIR)
/lib
$(1)
.a
STATICLIB_GLOB
=
lib
$(1)
*
.a
else
ifdef
IS_WINDOWS
RUN
=
PATH
=
"
$(PATH)
:
$(TARGET_RPATH_DIR)
"
$(RUN_BINFILE)
FAIL
=
PATH
=
"
$(PATH)
:
$(TARGET_RPATH_DIR)
"
$(RUN_BINFILE)
&&
exit
1
||
exit
0
DYLIB_GLOB
=
$(1)
*
.dll
DYLIB
=
$(TMPDIR)
/
$(1)
.dll
STATICLIB
=
$(TMPDIR)
/
$(1)
.lib
STATICLIB_GLOB
=
$(1)
*
.lib
BIN
=
$(1)
.exe
RPATH_LINK_SEARCH
=
else
RUN
=
$(TARGET_RPATH_ENV)
$(RUN_BINFILE)
FAIL
=
$(TARGET_RPATH_ENV)
$(RUN_BINFILE)
&&
exit
1
||
exit
0
DYLIB_GLOB
=
lib
$(1)
*
.so
DYLIB
=
$(TMPDIR)
/lib
$(1)
.so
RPATH_LINK_SEARCH
=
-Wl
,-rpath-link
=
$(1)
STATICLIB
=
$(TMPDIR)
/lib
$(1)
.a
STATICLIB_GLOB
=
lib
$(1)
*
.a
endif
endif
ifdef
IS_MSVC
COMPILE_OBJ
=
$(CC)
-c
-Fo
:
`
cygpath
-w
$(1)
`
$(2)
NATIVE_STATICLIB_FILE
=
$(1)
.lib
NATIVE_STATICLIB
=
$(TMPDIR)
/
$(
call
NATIVE_STATICLIB_FILE,
$(1)
)
OUT_EXE
=
-Fe
:
`
cygpath
-w
$(TMPDIR)
/
$(
call
BIN,
$(1)
)
`
\
-Fo
:
`
cygpath
-w
$(TMPDIR)
/
$(1)
.obj
`
else
COMPILE_OBJ
=
$(CC)
-c
-o
$(1)
$(2)
NATIVE_STATICLIB_FILE
=
lib
$(1)
.a
NATIVE_STATICLIB
=
$(
call
STATICLIB,
$(1)
)
OUT_EXE
=
-o
$(TMPDIR)
/
$(1)
endif
# Extra flags needed to compile a working executable with the standard library
ifdef
IS_WINDOWS
ifdef
IS_MSVC
EXTRACFLAGS
:=
ws2_32.lib userenv.lib shell32.lib advapi32.lib
else
EXTRACFLAGS
:=
-lws2_32
-luserenv
endif
else
ifeq
($(UNAME),Darwin)
else
...
...
@@ -80,12 +99,20 @@ REMOVE_RLIBS = rm $(TMPDIR)/$(call RLIB_GLOB,$(1))
%.a
:
%.o
ar crus
$@
$<
%.lib
:
lib%.o
ar crus
$@
$<
%.dylib
:
%.o
$(CC)
-dynamiclib
-Wl
,-dylib
-o
$@
$<
%.so
:
%.o
$(CC)
-o
$@
$<
-shared
ifdef
IS_MSVC
%.dll
:
lib%.o
$(CC)
$<
-link
-dll
-out
:
`
cygpath
-w
$@
`
else
%.dll
:
lib%.o
$(CC)
-o
$@
$<
-shared
endif
$(TMPDIR)/lib%.o
:
%.c
$(
CC)
-c
-o
$@
$<
$(
call
COMPILE_OBJ,
$@
,
$<
)
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录