fork/rust
git clone https://git.julia.blue/fork/rust
3bcad65fbf6
master
1# ignore-cross-compile 2include ../tools.mk 3 4TARGET_SYSROOT := $(shell $(RUSTC) --print sysroot)/lib/rustlib/$(TARGET)/lib 5 6ifdef IS_MSVC 7LIBSTD := $(wildcard $(TARGET_SYSROOT)/libstd-*.dll.lib) 8else 9LIBSTD := $(wildcard $(TARGET_SYSROOT)/$(call DYLIB_GLOB,std)) 10STD := $(basename $(patsubst lib%,%, $(notdir $(LIBSTD)))) 11endif 12 13all: $(call RUN_BINFILE,foo) 14 $(call RUN,foo) 15 16ifdef IS_MSVC 17CLIBS := $(TMPDIR)/foo.dll.lib $(TMPDIR)/bar.dll.lib $(LIBSTD) 18$(call RUN_BINFILE,foo): $(call DYLIB,foo) 19 $(CC) $(CFLAGS) foo.c $(CLIBS) $(call OUT_EXE,foo) 20else 21CLIBS := -lfoo -lbar -l$(STD) -L $(TMPDIR) -L $(TARGET_SYSROOT) 22$(call RUN_BINFILE,foo): $(call DYLIB,foo) 23 $(CC) $(CFLAGS) foo.c $(CLIBS) -o $(call RUN_BINFILE,foo) 24endif 25 26$(call DYLIB,foo): 27 $(RUSTC) -C prefer-dynamic bar.rs 28 $(RUSTC) foo.rs