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

47 lines
907 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
2014-04-27 02:52:36 -05:00
BIN = $(1)
2014-04-27 02:52:36 -05:00
UNAME = $(shell uname)
ifneq (,$(findstring MINGW,$(UNAME)))
IS_WINDOWS=1
endif
ifeq ($(UNAME),Darwin)
DYLIB_GLOB = lib$(1)*.dylib
DYLIB = $(TMPDIR)/lib$(1).dylib
else
2014-04-27 02:52:36 -05:00
ifdef IS_WINDOWS
DYLIB_GLOB = $(1)*.dll
DYLIB = $(TMPDIR)/$(1).dll
BIN = $(1).exe
export PATH := $(PATH):$(LD_LIBRARY_PATH)
else
DYLIB_GLOB = lib$(1)*.so
DYLIB = $(TMPDIR)/lib$(1).so
endif
2014-04-27 02:52:36 -05:00
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
2014-04-27 02:52:36 -05:00
%.dll: lib%.o
$(CC) -o $@ $< -shared
$(TMPDIR)/lib%.o: %.c
$(CC) -c -o $@ $<