fork/rust

git clone https://git.julia.blue/fork/rust

borsAuto merge of #71365 - Mark-Simulacrum:stable-next, r=Mark-Simulacrum4fb7144ed15

1.43.0
773 B27 linesraw
1include ../tools.mk
2
3TARGET_SYSROOT := $(shell $(RUSTC) --print sysroot)/lib/rustlib/$(TARGET)/lib
4
5ifdef IS_MSVC
6LIBSTD := $(wildcard $(TARGET_SYSROOT)/libstd-*.dll.lib)
7else
8LIBSTD := $(wildcard $(TARGET_SYSROOT)/$(call DYLIB_GLOB,std))
9STD := $(basename $(patsubst lib%,%, $(notdir $(LIBSTD))))
10endif
11
12all: $(call RUN_BINFILE,foo)
13	$(call RUN,foo)
14
15ifdef IS_MSVC
16CLIBS := $(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)
19else
20CLIBS := -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)
23endif
24
25$(call DYLIB,foo):
26	$(RUSTC) -C prefer-dynamic bar.rs
27	$(RUSTC) foo.rs