]> git.lizzy.rs Git - rust.git/blob - src/test/run-make/sysroot-crates-are-unstable/Makefile
Rollup merge of #41456 - jessicah:haiku-support, r=alexcrichton
[rust.git] / src / test / run-make / sysroot-crates-are-unstable / Makefile
1 -include ../tools.mk
2
3 # This is a whitelist of files which are stable crates or simply are not crates,
4 # we don't check for the instability of these crates as they're all stable!
5 STABLE_CRATES := \
6         std \
7         core \
8         proc_macro \
9         rsbegin.o \
10         rsend.o \
11         dllcrt2.o \
12         crt2.o \
13         clang_rt.%_dynamic.dylib
14
15 # Generate a list of all crates in the sysroot. To do this we list all files in
16 # rustc's sysroot, look at the filename, strip everything after the `-`, and
17 # strip the leading `lib` (if present)
18 SYSROOT := $(shell $(RUSTC) --print sysroot)
19 LIBS := $(wildcard $(SYSROOT)/lib/rustlib/$(TARGET)/lib/*)
20 LIBS := $(foreach lib,$(LIBS),$(notdir $(lib)))
21 LIBS := $(foreach lib,$(LIBS),$(word 1,$(subst -, ,$(lib))))
22 LIBS := $(foreach lib,$(LIBS),$(patsubst lib%,%,$(lib)))
23 LIBS := $(filter-out $(STABLE_CRATES),$(LIBS))
24
25 all: $(foreach lib,$(LIBS),check-crate-$(lib)-is-unstable)
26
27 check-crate-%-is-unstable:
28         @echo verifying $* is an unstable crate
29         @echo 'extern crate $*;' | \
30                 $(RUSTC) - --crate-type rlib 2>&1 | cat > $(TMPDIR)/$*; \
31                 true
32         @grep -q 'use of unstable library feature' $(TMPDIR)/$* || \
33                 (echo crate $* is not unstable && \
34                 cat $(TMPDIR)/$* && \
35                 false)