1-include ../tools.mk 2 3# ignore-windows-msvc 4 5# rustc will remove one of the two redundant references to foo below. Depending 6# on which one gets removed, we'll get a linker error on SOME platforms (like 7# Linux). On these platforms, when a library is referenced, the linker will 8# only pull in the symbols needed _at that point in time_. If a later library 9# depends on additional symbols from the library, they will not have been pulled 10# in, and you'll get undefined symbols errors. 11# 12# So in this example, we need to ensure that rustc keeps the _later_ reference 13# to foo, and not the former one. 14RUSTC_FLAGS = \ 15 -l static=bar \ 16 -l foo \ 17 -l static=baz \ 18 -l foo \ 19 -Z print-link-args 20 21all: $(call DYLIB,foo) $(call STATICLIB,bar) $(call STATICLIB,baz) 22 $(RUSTC) $(RUSTC_FLAGS) main.rs 23 $(call RUN,main) 24