]>
Commit | Line | Data |
---|---|---|
923072b8 FG |
1 | # ignore-cross-compile |
2 | # ignore-windows-msvc | |
3 | ||
f2b60f7d | 4 | include ../../run-make-fulldeps/tools.mk |
923072b8 | 5 | |
064997fb FG |
6 | # We're using the llvm-nm instead of the system nm to ensure it is compatible |
7 | # with the LLVM bitcode generated by rustc. | |
8 | NM = "$(LLVM_BIN_DIR)"/llvm-nm | |
9 | ||
923072b8 FG |
10 | all: $(call NATIVE_STATICLIB,native-staticlib) |
11 | # Build a staticlib and a rlib, the `native_func` symbol will be bundled into them | |
12 | $(RUSTC) bundled.rs --crate-type=staticlib --crate-type=rlib | |
064997fb FG |
13 | $(NM) $(TMPDIR)/libbundled.a | $(CGREP) -e "T _*native_func" |
14 | $(NM) $(TMPDIR)/libbundled.a | $(CGREP) -e "U _*native_func" | |
15 | $(NM) $(TMPDIR)/libbundled.rlib | $(CGREP) -e "T _*native_func" | |
16 | $(NM) $(TMPDIR)/libbundled.rlib | $(CGREP) -e "U _*native_func" | |
923072b8 FG |
17 | |
18 | # Build a staticlib and a rlib, the `native_func` symbol will not be bundled into it | |
19 | $(RUSTC) non-bundled.rs --crate-type=staticlib --crate-type=rlib | |
064997fb FG |
20 | $(NM) $(TMPDIR)/libnon_bundled.a | $(CGREP) -ve "T _*native_func" |
21 | $(NM) $(TMPDIR)/libnon_bundled.a | $(CGREP) -e "U _*native_func" | |
22 | $(NM) $(TMPDIR)/libnon_bundled.rlib | $(CGREP) -ve "T _*native_func" | |
23 | $(NM) $(TMPDIR)/libnon_bundled.rlib | $(CGREP) -e "U _*native_func" | |
923072b8 FG |
24 | |
25 | # Build a cdylib, `native-staticlib` will not appear on the linker line because it was bundled previously | |
26 | # The cdylib will contain the `native_func` symbol in the end | |
27 | $(RUSTC) cdylib-bundled.rs --crate-type=cdylib --print link-args | $(CGREP) -ve '-l[" ]*native-staticlib' | |
064997fb | 28 | $(NM) $(call DYLIB,cdylib_bundled) | $(CGREP) -e "[Tt] _*native_func" |
923072b8 FG |
29 | |
30 | # Build a cdylib, `native-staticlib` will appear on the linker line because it was not bundled previously | |
31 | # The cdylib will contain the `native_func` symbol in the end | |
32 | $(RUSTC) cdylib-non-bundled.rs --crate-type=cdylib --print link-args | $(CGREP) -e '-l[" ]*native-staticlib' | |
064997fb | 33 | $(NM) $(call DYLIB,cdylib_non_bundled) | $(CGREP) -e "[Tt] _*native_func" |