]> git.lizzy.rs Git - rust.git/blob - tests/run-make/raw-dylib-inline-cross-dylib/Makefile
Auto merge of #107443 - cjgillot:generator-less-query, r=compiler-errors
[rust.git] / tests / run-make / raw-dylib-inline-cross-dylib / Makefile
1 # Regression test for calling an inline function that uses a raw-dylib function.
2
3 # only-windows
4
5 include ../../run-make-fulldeps/tools.mk
6
7 # We'd be using the llvm-objdump instead of the system objdump to ensure compatibility
8 # with the LLVM bitcode generated by rustc but on Windows  piping/IO redirection under MSYS2 is wonky with llvm-objdump.
9 OBJDUMP = objdump
10
11 all:
12         $(RUSTC) --crate-type dylib --crate-name raw_dylib_test lib.rs -C prefer-dynamic
13         $(RUSTC) --crate-type dylib --crate-name raw_dylib_test_wrapper lib_wrapper.rs -C prefer-dynamic
14         $(RUSTC) --crate-type bin driver.rs -L "$(TMPDIR)" -C prefer-dynamic
15         # Make sure we don't find an import to the functions we expect to be inlined.
16         $(OBJDUMP) -p $(TMPDIR)/driver.exe | $(CGREP) -v -e "inline_library_function"
17         $(OBJDUMP) -p $(TMPDIR)/driver.exe | $(CGREP) -v -e "inline_library_function_calls_inline"
18         # Make sure we do find an import to the functions we expect to be imported.
19         $(OBJDUMP) -p $(TMPDIR)/driver.exe | $(CGREP) -e "library_function"
20         $(call COMPILE_OBJ,"$(TMPDIR)"/extern_1.obj,extern_1.c)
21         $(call COMPILE_OBJ,"$(TMPDIR)"/extern_2.obj,extern_2.c)
22 ifdef IS_MSVC
23         $(CC) "$(TMPDIR)"/extern_1.obj -link -dll -out:"$(TMPDIR)"/extern_1.dll -noimplib
24         $(CC) "$(TMPDIR)"/extern_2.obj -link -dll -out:"$(TMPDIR)"/extern_2.dll -noimplib
25 else
26         $(CC) "$(TMPDIR)"/extern_1.obj -shared -o "$(TMPDIR)"/extern_1.dll
27         $(CC) "$(TMPDIR)"/extern_2.obj -shared -o "$(TMPDIR)"/extern_2.dll
28 endif
29         $(call RUN,driver) > "$(TMPDIR)"/output.txt
30
31 ifdef RUSTC_BLESS_TEST
32         cp "$(TMPDIR)"/output.txt output.txt
33 else
34         $(DIFF) output.txt "$(TMPDIR)"/output.txt
35 endif