fork/rust

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

borsAuto merge of #103046 - JanBeh:PR_clarify_cmp_terminology, r=workingjubilee3bcad65fbf6

master
742 B21 linesraw
1include ../tools.mk
2
3# ignore-cross-compile
4# ignore-msvc FIXME(bjorn3) can't figure out how to link with the MSVC toolchain
5# ignore-wasm wasm doesn't support dynamic libraries
6
7all:
8	$(RUSTC) -C prefer-dynamic bar.rs
9	$(RUSTC) foo.rs --crate-type staticlib --print native-static-libs \
10		-Z staticlib-allow-rdylib-deps 2>&1 | grep 'note: native-static-libs: ' \
11		| sed 's/note: native-static-libs: \(.*\)/\1/' > $(TMPDIR)/libs.txt
12	cat $(TMPDIR)/libs.txt
13
14ifdef IS_MSVC
15	$(CC) $(CFLAGS) /c foo.c /Fo:$(TMPDIR)/foo.o
16	$(RUSTC_LINKER) $(TMPDIR)/foo.o $(TMPDIR)/foo.lib $$(cat $(TMPDIR)/libs.txt) $(call OUT_EXE,foo)
17else
18	$(CC) $(CFLAGS) foo.c -L $(TMPDIR) -lfoo $$(cat $(TMPDIR)/libs.txt) -o $(call RUN_BINFILE,foo)
19endif
20
21	$(call RUN,foo)