aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteven Fackler <[email protected]>2014-01-18 13:01:04 -0800
committerSteven Fackler <[email protected]>2014-01-18 13:01:04 -0800
commitbf2f31ef963e749d6e1f0405727f813a6d0428b7 (patch)
tree2e643712ce4dfcaa29da0ea1f2889c860dc84fb3
parentUpdate copyright date (diff)
downloadrust-openssl-bf2f31ef963e749d6e1f0405727f813a6d0428b7.tar.xz
rust-openssl-bf2f31ef963e749d6e1f0405727f813a6d0428b7.zip
Update build system
-rw-r--r--.gitignore3
-rw-r--r--Makefile35
2 files changed, 26 insertions, 12 deletions
diff --git a/.gitignore b/.gitignore
index 27a84a97..0c3fa56c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,4 +1,3 @@
/.rust/
/doc/
-/rust-openssl
-/rust-openssl.dSYM/
+/build/
diff --git a/Makefile b/Makefile
index bf12c6f5..ce3b7691 100644
--- a/Makefile
+++ b/Makefile
@@ -1,15 +1,30 @@
-RUSTPKG ?= rustpkg
-RUSTC ?= rustc
-RUST_FLAGS ?= -Z debug-info -O
+RUSTC = rustc
+BUILDDIR = build
+RUSTFLAGS = -O -Z debug-info
-all:
- $(RUSTPKG) $(RUST_FLAGS) install
+OPENSSL_LIB = lib.rs
+OPENSSL = $(BUILDDIR)/$(shell $(RUSTC) --crate-file-name $(OPENSSL_LIB))
+OPENSSL_TEST = $(BUILDDIR)/$(shell $(RUSTC) --test --crate-file-name $(OPENSSL_LIB))
-test:
- $(RUSTC) $(RUST_FLAGS) --test lib.rs
- ./rust-openssl
+all: $(OPENSSL)
-.PHONY: test
+-include $(BUILDDIR)/openssl.d
+-include $(BUILDDIR)/openssl_test.d
+
+$(BUILDDIR):
+ mkdir -p $@
+
+$(OPENSSL): $(OPENSSL_LIB) | $(BUILDDIR)
+ $(RUSTC) $(RUSTFLAGS) --dep-info $(@D)/openssl.d --out-dir $(@D) $<
+
+check: $(OPENSSL_TEST)
+ $<
+
+$(OPENSSL_TEST): $(OPENSSL_LIB) | $(BUILDDIR)
+ $(RUSTC) $(RUSTFLAGS) --test --dep-info $(@D)/openssl_test.d \
+ --out-dir $(@D) $<
clean:
- rm -rf .rust rust-openssl rust-openssl.dSYM
+ rm -rf $(BUILDDIR)
+
+.PHONY: all check clean