rust/tests/run-make/extern-flag-pathless/Makefile

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

35 lines
1.0 KiB
Makefile
Raw Normal View History

# ignore-cross-compile
include ../tools.mk
2019-09-29 20:17:27 -05:00
# Test mixing pathless --extern with paths.
# Test for static linking by checking that the binary runs if the dylib
# is removed and test for dynamic linking by checking that the binary
# fails to run if the dylib is removed.
2019-09-29 20:17:27 -05:00
all:
$(RUSTC) bar.rs --crate-type=rlib --crate-type=dylib -Cprefer-dynamic
2019-09-29 20:17:27 -05:00
# rlib preferred over dylib
$(RUSTC) foo.rs --extern bar
mv $(call DYLIB,bar) $(TMPDIR)/bar.tmp
$(call RUN,foo)
mv $(TMPDIR)/bar.tmp $(call DYLIB,bar)
2019-09-29 20:17:27 -05:00
$(RUSTC) foo.rs --extern bar=$(TMPDIR)/libbar.rlib --extern bar
mv $(call DYLIB,bar) $(TMPDIR)/bar.tmp
$(call RUN,foo)
mv $(TMPDIR)/bar.tmp $(call DYLIB,bar)
2019-09-29 20:17:27 -05:00
# explicit --extern overrides pathless
$(RUSTC) foo.rs --extern bar=$(call DYLIB,bar) --extern bar
mv $(call DYLIB,bar) $(TMPDIR)/bar.tmp
$(call FAIL,foo)
mv $(TMPDIR)/bar.tmp $(call DYLIB,bar)
2019-09-29 20:17:27 -05:00
# prefer-dynamic does what it says
$(RUSTC) foo.rs --extern bar -C prefer-dynamic
mv $(call DYLIB,bar) $(TMPDIR)/bar.tmp
$(call FAIL,foo)
mv $(TMPDIR)/bar.tmp $(call DYLIB,bar)