rust/src/test/run-make/tools.mk

31 lines
647 B
Makefile
Raw Normal View History

export LD_LIBRARY_PATH:=$(TMPDIR):$(LD_LIBRARY_PATH)
export DYLD_LIBRARY_PATH:=$(TMPDIR):$(DYLD_LIBRARY_PATH)
RUSTC := $(RUSTC) --out-dir $(TMPDIR) -L $(TMPDIR)
CC := $(CC) -L $(TMPDIR)
RUN = $(TMPDIR)/$(1)
FAILS = $(TMPDIR)/$(1) && exit 1 || exit 0
RLIB_GLOB = lib$(1)*.rlib
STATICLIB = $(TMPDIR)/lib$(1).a
STATICLIB_GLOB = lib$(1)*.a
ifeq ($(shell uname),Darwin)
DYLIB_GLOB = lib$(1)*.dylib
DYLIB = $(TMPDIR)/lib$(1).dylib
else
DYLIB_GLOB = lib$(1)*.so
DYLIB = $(TMPDIR)/lib$(1).so
endif
%.a: %.o
ar crus $@ $<
%.dylib: %.o
2013-11-28 20:03:38 -06:00
$(CC) -dynamiclib -Wl,-dylib -o $@ $<
%.so: %.o
2013-11-28 20:03:38 -06:00
$(CC) -o $@ $< -shared
$(TMPDIR)/lib%.o: %.c
$(CC) -c -o $@ $<