From e2554ea6af256c6ed3d7fd5a541ca2caac212181 Mon Sep 17 00:00:00 2001 From: Steven Fackler Date: Mon, 20 Jan 2014 20:20:10 -0800 Subject: Add a configure script and an install target --- .gitignore | 2 +- Makefile | 36 ------------------------------------ Makefile.in | 40 ++++++++++++++++++++++++++++++++++++++++ configure | 18 ++++++++++++++++++ 4 files changed, 59 insertions(+), 37 deletions(-) delete mode 100644 Makefile create mode 100644 Makefile.in create mode 100755 configure diff --git a/.gitignore b/.gitignore index 0c3fa56c..ff7df192 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,3 @@ -/.rust/ /doc/ /build/ +/Makefile diff --git a/Makefile b/Makefile deleted file mode 100644 index 7a1d064b..00000000 --- a/Makefile +++ /dev/null @@ -1,36 +0,0 @@ -RUSTC = rustc -BUILDDIR = build -RUSTFLAGS = -O -Z debug-info - -OPENSSL_LIB = lib.rs -OPENSSL = $(BUILDDIR)/$(shell $(RUSTC) --crate-file-name $(OPENSSL_LIB)) -OPENSSL_TEST = $(BUILDDIR)/$(shell $(RUSTC) --test --crate-file-name $(OPENSSL_LIB)) - -all: $(OPENSSL) - --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 $(BUILDDIR) - -doc: $(OPENSSL) - rustdoc $(OPENSSL_LIB) - -print-target: - @echo $(OPENSSL) - -.PHONY: all check clean print-target diff --git a/Makefile.in b/Makefile.in new file mode 100644 index 00000000..fc694754 --- /dev/null +++ b/Makefile.in @@ -0,0 +1,40 @@ +RUSTC = rustc +BUILDDIR = build +RUSTFLAGS = -O -Z debug-info +INSTALL_DIR = %PREFIX% + +OPENSSL_LIB = lib.rs +OPENSSL = $(BUILDDIR)/$(shell $(RUSTC) --crate-file-name $(OPENSSL_LIB)) +OPENSSL_TEST = $(BUILDDIR)/$(shell $(RUSTC) --test --crate-file-name $(OPENSSL_LIB)) + +all: $(OPENSSL) + +-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 $(BUILDDIR) + +doc: $(OPENSSL) + rustdoc $(OPENSSL_LIB) + +install: $(OPENSSL) + install $(OPENSSL) $(INSTALL_DIR) + +print-target: + @echo $(OPENSSL) + +.PHONY: all check clean print-target diff --git a/configure b/configure new file mode 100755 index 00000000..55cf6a0b --- /dev/null +++ b/configure @@ -0,0 +1,18 @@ +#!/bin/bash + +TEMP=`getopt -o "" --long prefix: -n "$0" -- "$@"` + +if [ $? != 0 ]; then exit 1; fi + +eval set -- "$TEMP" + +PREFIX=/usr/lib + +while true ; do + case "$1" in + --prefix) PREFIX=$2; shift 2;; + --) shift; break;; + esac +done + +sed -e "s|%PREFIX%|$PREFIX|" < Makefile.in > Makefile -- cgit v1.2.3