diff --git a/.gitignore b/.gitignore index 5f68b7f..e04cf59 100644 --- a/.gitignore +++ b/.gitignore @@ -9,3 +9,5 @@ *.dummy cocoa-test build +/target +/Cargo.lock diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 0000000..f90a3b1 --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,12 @@ +[package] + +name = "cocoa" +version = "0.1.0" +authors = ["The Servo Project Developers"] + +build = "make -f makefile.msgsend" + +[lib] + +name = "cocoa" +crate-type = ["rlib"] diff --git a/Makefile.in b/Makefile.in index 378ddfc..6552cdd 100644 --- a/Makefile.in +++ b/Makefile.in @@ -6,16 +6,16 @@ AR ?= ar RUSTFLAGS ?= CFLAGS += -Wall -RUST_SRC = $(shell find $(VPATH)/. -type f -name '*.rs') +RUST_SRC = $(shell find $(VPATH)/src -type f -name '*.rs') .PHONY: all all: libcocoa.dummy -libcocoa.dummy: cocoa.rc $(RUST_SRC) libmsgsend.a +libcocoa.dummy: src/lib.rs $(RUST_SRC) libmsgsend.a $(RUSTC) $(RUSTFLAGS) $< --out-dir . touch $@ -cocoa-test: cocoa.rc $(RUST_SRC) libmsgsend.a +cocoa-test: src/lib.rs $(RUST_SRC) libmsgsend.a $(RUSTC) $(RUSTFLAGS) $< -o $@ --test libmsgsend.a: msgsend.o diff --git a/makefile.msgsend b/makefile.msgsend new file mode 100644 index 0000000..e76812a --- /dev/null +++ b/makefile.msgsend @@ -0,0 +1,20 @@ +CC ?= gcc +AR ?= ar +CFLAGS += -Wall + +.PHONY : all +ifeq (darwin,$(findstring darwin,$(TARGET))) + +all: $(OUT_DIR)/libmsgsend.a + +$(OUT_DIR)/libmsgsend.a: $(OUT_DIR)/msgsend.o + $(AR) rcs $(OUT_DIR)/libmsgsend.a $(OUT_DIR)/msgsend.o + +$(OUT_DIR)/msgsend.o: src/msgsend.m + $(CC) $(CFLAGS) $< -o $@ -c + +else + +all: + +endif diff --git a/appkit.rs b/src/appkit.rs similarity index 100% rename from appkit.rs rename to src/appkit.rs diff --git a/base.rs b/src/base.rs similarity index 100% rename from base.rs rename to src/base.rs diff --git a/cocoa.rc b/src/lib.rs similarity index 92% rename from cocoa.rc rename to src/lib.rs index b0bede1..c07bc78 100644 --- a/cocoa.rc +++ b/src/lib.rs @@ -20,6 +20,8 @@ extern crate libc; extern crate std; +#[cfg(target_os="macos")] pub mod appkit; +#[cfg(target_os="macos")] pub mod base; diff --git a/msgsend.m b/src/msgsend.m similarity index 100% rename from msgsend.m rename to src/msgsend.m