]> git.proxmox.com Git - rustc.git/blob - tests/run-make/cdylib-dylib-linkage/Makefile
New upstream version 1.70.0+dfsg1
[rustc.git] / tests / run-make / cdylib-dylib-linkage / Makefile
1 # ignore-cross-compile
2 include ../tools.mk
3
4 TARGET_SYSROOT := $(shell $(RUSTC) --print sysroot)/lib/rustlib/$(TARGET)/lib
5
6 ifdef IS_MSVC
7 LIBSTD := $(wildcard $(TARGET_SYSROOT)/libstd-*.dll.lib)
8 else
9 LIBSTD := $(wildcard $(TARGET_SYSROOT)/$(call DYLIB_GLOB,std))
10 STD := $(basename $(patsubst lib%,%, $(notdir $(LIBSTD))))
11 endif
12
13 all: $(call RUN_BINFILE,foo)
14 $(call RUN,foo)
15
16 ifdef IS_MSVC
17 CLIBS := $(TMPDIR)/foo.dll.lib $(TMPDIR)/bar.dll.lib $(LIBSTD)
18 $(call RUN_BINFILE,foo): $(call DYLIB,foo)
19 $(CC) $(CFLAGS) foo.c $(CLIBS) $(call OUT_EXE,foo)
20 else
21 CLIBS := -lfoo -lbar -l$(STD) -L $(TMPDIR) -L $(TARGET_SYSROOT)
22 $(call RUN_BINFILE,foo): $(call DYLIB,foo)
23 $(CC) $(CFLAGS) foo.c $(CLIBS) -o $(call RUN_BINFILE,foo)
24 endif
25
26 $(call DYLIB,foo):
27 $(RUSTC) -C prefer-dynamic bar.rs
28 $(RUSTC) foo.rs