]> git.lizzy.rs Git - rust.git/blob - tests/run-make-fulldeps/cdylib-dylib-linkage/Makefile
Rollup merge of #106570 - Xaeroxe:div-duration-tests, r=JohnTitor
[rust.git] / tests / run-make-fulldeps / cdylib-dylib-linkage / Makefile
1 include ../tools.mk
2
3 TARGET_SYSROOT := $(shell $(RUSTC) --print sysroot)/lib/rustlib/$(TARGET)/lib
4
5 ifdef IS_MSVC
6 LIBSTD := $(wildcard $(TARGET_SYSROOT)/libstd-*.dll.lib)
7 else
8 LIBSTD := $(wildcard $(TARGET_SYSROOT)/$(call DYLIB_GLOB,std))
9 STD := $(basename $(patsubst lib%,%, $(notdir $(LIBSTD))))
10 endif
11
12 all: $(call RUN_BINFILE,foo)
13         $(call RUN,foo)
14
15 ifdef IS_MSVC
16 CLIBS := $(TMPDIR)/foo.dll.lib $(TMPDIR)/bar.dll.lib $(LIBSTD)
17 $(call RUN_BINFILE,foo): $(call DYLIB,foo)
18         $(CC) $(CFLAGS) foo.c $(CLIBS) $(call OUT_EXE,foo)
19 else
20 CLIBS := -lfoo -lbar -l$(STD) -L $(TMPDIR) -L $(TARGET_SYSROOT)
21 $(call RUN_BINFILE,foo): $(call DYLIB,foo)
22         $(CC) $(CFLAGS) foo.c $(CLIBS) -o $(call RUN_BINFILE,foo)
23 endif
24
25 $(call DYLIB,foo):
26         $(RUSTC) -C prefer-dynamic bar.rs
27         $(RUSTC) foo.rs