55a92e9985
This must build on non-mac platform too, since Cargo doesn't have support for conditional dependencies yet.
33 lines
596 B
Makefile
33 lines
596 B
Makefile
VPATH=%VPATH%
|
|
|
|
CC ?= gcc
|
|
RUSTC ?= rustc
|
|
AR ?= ar
|
|
RUSTFLAGS ?=
|
|
CFLAGS += -Wall
|
|
|
|
RUST_SRC = $(shell find $(VPATH)/src -type f -name '*.rs')
|
|
|
|
.PHONY: all
|
|
all: libcocoa.dummy
|
|
|
|
libcocoa.dummy: src/lib.rs $(RUST_SRC) libmsgsend.a
|
|
$(RUSTC) $(RUSTFLAGS) $< --out-dir .
|
|
touch $@
|
|
|
|
cocoa-test: src/lib.rs $(RUST_SRC) libmsgsend.a
|
|
$(RUSTC) $(RUSTFLAGS) $< -o $@ --test
|
|
|
|
libmsgsend.a: msgsend.o
|
|
$(AR) rcs libmsgsend.a msgsend.o
|
|
|
|
msgsend.o: msgsend.m
|
|
$(CC) $(CFLAGS) $< -o $@ -c
|
|
|
|
check: cocoa-test
|
|
./cocoa-test
|
|
|
|
.PHONY: clean
|
|
clean:
|
|
rm -f cocoa-test *.a *.o *.so *.dylib *.rlib *.dll *.dummy cocoa-test
|